Beispiel #1
0
        private static Param match_param()
        {
            var param = new Param
            {
                match = Type.Match(),
                type  = null,
                name  = Look.ToString()
            };

            Match(ID);
            return(param);
        }
Beispiel #2
0
        public static Method Match(Class @class)
        {
            var function = new Method()
            {
                @class = @class
            };

            Match(FUNC);
            function.name = Look.ToString();
            Match(ID);
            Match('(');
            if (Check(BASIC) || Check(ID))
            {
                function.return_match = Type.Match();
            }
            else
            {
                function.@return = Type.Void;
            }

            Match('|');
            if (Check(BASIC) || Check(ID))
            {
                [email protected](match_param());
                while (Check(','))
                {
                    Move();
                    [email protected](match_param());
                }
            }
            Match(')');
            Match('{');
            function.statements = Stmts.Match();
            Match('}');
            return(function);
        }