private Node ConsumeAs(Node node, TokenType tokenType) { var ret = node.AddChild(tokenType, _currentToken.Text); Next(); return ret; }
private Node ConsumeAs(Node node, TokenType expectedTokenType, TokenType asTokenType) { if (IsTokenType(expectedTokenType)) { var ret = node.AddChild(asTokenType, _currentToken.Text); Next(); return ret; } throw new Exception("Expected " + expectedTokenType); }