示例#1
0
        public static TokenNode ParseToken(ParseContext context, IAstNode parent)
        {
            TokenStream <RToken> tokens = context.Tokens;
            TokenNode            node   = new TokenNode();

            node.Parse(context, parent);
            return(node);
        }
示例#2
0
        public static TokenNode ParseKeyword(ParseContext context, IAstNode parent)
        {
            TokenStream <RToken> tokens = context.Tokens;

            Debug.Assert(tokens.CurrentToken.TokenType == RTokenType.Keyword);

            TokenNode keyword = new TokenNode();

            keyword.Parse(context, parent);

            return(keyword);
        }
示例#3
0
        public static TokenNode ParseOpenBraceSequence(ParseContext context, IAstNode parent)
        {
            TokenStream <RToken> tokens = context.Tokens;

            if (tokens.CurrentToken.TokenType == RTokenType.OpenBrace)
            {
                TokenNode openBrace = new TokenNode();
                openBrace.Parse(context, parent);

                return(openBrace);
            }
            else
            {
                context.AddError(new MissingItemParseError(ParseErrorType.OpenBraceExpected, tokens.PreviousToken));
            }

            return(null);
        }