Exemple #1
0
        bool TypedFormalParamDef(out AST.Parameter param)
        {
            if (scan.Lexeme == Lexeme.Id)
            {
                param = new AST.Parameter(scan.TextValue());

                scan.Next();
                goto _1;
            }
            param = null;
            return(false);

_1:
            if (scan.Lexeme == Lexeme.Colon)
            {
                scan.Next();
                goto _2;
            }
            goto _end;
_2:
            if (Test(out param.Type))
            {
                goto _end;
            }
            throw new CompilationError(ErrorType.InvalidSyntax);
_end:
            return(true);
        }
Exemple #2
0
        bool Arg(out AST.Parameter argument)
        {
            if (TypedFormalParamDef(out argument))
            {
                goto _1;
            }
            return(false);

_1:
            goto _end;
_end:
            return(true);
        }