public static TokenNode ParseToken(ParseContext context, IAstNode parent) { TokenStream<RToken> tokens = context.Tokens; TokenNode node = new TokenNode(); node.Parse(context, parent); return node; }
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; }
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; }