• Home
  • Raw
  • Download

Lines Matching full:lexer

16 #include "lexer/token/tokenType.h"
67 #include "lexer/lexer.h"
68 #include "lexer/regexp/regexp.h"
69 #include "lexer/token/letters.h"
70 #include "lexer/token/sourceLocation.h"
71 #include "lexer/token/token.h"
83 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::KEYW_YIELD); in ParseYieldExpression()
85 lexer::SourcePosition startLoc = lexer_->GetToken().Start(); in ParseYieldExpression()
86 lexer::SourcePosition endLoc = lexer_->GetToken().End(); in ParseYieldExpression()
88 if ((lexer_->GetToken().Flags() & lexer::TokenFlags::HAS_ESCAPE) != 0) { in ParseYieldExpression()
97 …if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY && !lexer_->GetToken().NewL… in ParseYieldExpression()
105 …} else if (!lexer_->GetToken().NewLine() && lexer_->GetToken().Type() != lexer::TokenType::PUNCTUA… in ParseYieldExpression()
106 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS && in ParseYieldExpression()
107 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET && in ParseYieldExpression()
108 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COMMA && in ParseYieldExpression()
109 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_SEMI_COLON && in ParseYieldExpression()
110 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COLON && in ParseYieldExpression()
111 lexer_->GetToken().Type() != lexer::TokenType::EOS) { in ParseYieldExpression()
126 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA && in ParsePotentialExpressionSequence()
137 if (lexer_->GetToken().Type() == lexer::TokenType::KEYW_YIELD && in ParseExpression()
154 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA && in ParseExpression()
163 const lexer::SourcePosition &startLoc) in ParseArrayExpressionRightBracketHelper()
165 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA) { in ParseArrayExpressionRightBracketHelper()
172 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET) { in ParseArrayExpressionRightBracketHelper()
179 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET) { in ParseArrayExpressionRightBracketHelper()
183 if (lexer::Token::IsPunctuatorToken(lexer_->GetToken().Type())) { in ParseArrayExpressionRightBracketHelper()
186 lexer_->GetToken().SetTokenType(lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET); in ParseArrayExpressionRightBracketHelper()
197 lexer::SourcePosition startLoc = lexer_->GetToken().Start(); in ParseArrayExpression()
206 while (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET && in ParseArrayExpression()
207 lexer_->GetToken().Type() != lexer::TokenType::EOS) { in ParseArrayExpression()
210 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA) { in ParseArrayExpression()
221 } else if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD_PERIOD_PERIOD) { in ParseArrayExpression()
254 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_SUBSTITUTION && in ParseArrayExpressionErrorCheck()
257 … } else if (!inPattern && lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_SUBSTITUTION) { in ParseArrayExpressionErrorCheck()
337 lexer::SourcePosition endLoc; in ParseArrowFunctionExpressionBody()
338 lexer::SourcePosition bodyStart = lexer_->GetToken().Start(); in ParseArrowFunctionExpressionBody()
340 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_BRACE) { in ParseArrowFunctionExpressionBody()
355 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_BRACE) { in ParseArrowFunctionExpressionBody()
358 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_BRACE); in ParseArrowFunctionExpressionBody()
446 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_ARROW); in ParseArrowFunctionExpression()
463 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS) { in ValidateArrowFunctionRestParameter()
476 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS); in ParseCoverParenthesizedExpressionAndArrowParameterList()
477 lexer::SourcePosition start = lexer_->GetToken().Start(); in ParseCoverParenthesizedExpressionAndArrowParameterList()
480 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD_PERIOD_PERIOD) { in ParseCoverParenthesizedExpressionAndArrowParameterList()
491 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_ARROW) { in ParseCoverParenthesizedExpressionAndArrowParameterList()
493 LogExpectedToken(lexer::TokenType::PUNCTUATOR_ARROW); in ParseCoverParenthesizedExpressionAndArrowParameterList()
499 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS) { in ParseCoverParenthesizedExpressionAndArrowParameterList()
502 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_ARROW) { in ParseCoverParenthesizedExpressionAndArrowParameterList()
504 LogExpectedToken(lexer::TokenType::PUNCTUATOR_ARROW); in ParseCoverParenthesizedExpressionAndArrowParameterList()
517 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS) { in ParseCoverParenthesizedExpressionAndArrowParameterList()
519 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS); in ParseCoverParenthesizedExpressionAndArrowParameterList()
538 lexer::TokenType tokenType = lexer_->GetToken().Type(); in ValidateGroupedExpression()
539 if (lhsExpression->IsGrouped() && tokenType != lexer::TokenType::PUNCTUATOR_ARROW) { in ValidateGroupedExpression()
606 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COLON) { in ParseAssignmentExpressionHelper()
607 if (lexer::Token::IsPunctuatorToken(lexer_->GetToken().Type())) { in ParseAssignmentExpressionHelper()
610 LogExpectedToken(lexer::TokenType::PUNCTUATOR_COLON); in ParseAssignmentExpressionHelper()
623 … ir::Expression *lhsExpression, lexer::TokenType tokenType) in CreateBinaryAssignmentExpression()
642 lexer::TokenType tokenType = lexer_->GetToken().Type(); in ParseAssignmentExpression()
644 case lexer::TokenType::PUNCTUATOR_QUESTION_MARK: { in ParseAssignmentExpression()
656 case lexer::TokenType::PUNCTUATOR_ARROW: in ParseAssignmentExpression()
662 case lexer::TokenType::PUNCTUATOR_SUBSTITUTION: { in ParseAssignmentExpression()
669 case lexer::TokenType::KEYW_AS: in ParseAssignmentExpression()
691 ir::Expression *ParserImpl::ParseAssignmentBinaryExpression(const lexer::TokenType tokenType, in ParseAssignmentBinaryExpression()
696 case lexer::TokenType::KEYW_IN: { in ParseAssignmentBinaryExpression()
703 case lexer::TokenType::PUNCTUATOR_NULLISH_COALESCING: in ParseAssignmentBinaryExpression()
704 case lexer::TokenType::PUNCTUATOR_LOGICAL_OR: in ParseAssignmentBinaryExpression()
705 case lexer::TokenType::PUNCTUATOR_LOGICAL_AND: in ParseAssignmentBinaryExpression()
706 case lexer::TokenType::PUNCTUATOR_BITWISE_OR: in ParseAssignmentBinaryExpression()
707 case lexer::TokenType::PUNCTUATOR_BITWISE_XOR: in ParseAssignmentBinaryExpression()
708 case lexer::TokenType::PUNCTUATOR_BITWISE_AND: in ParseAssignmentBinaryExpression()
709 case lexer::TokenType::PUNCTUATOR_EQUAL: in ParseAssignmentBinaryExpression()
710 case lexer::TokenType::PUNCTUATOR_NOT_EQUAL: in ParseAssignmentBinaryExpression()
711 case lexer::TokenType::PUNCTUATOR_STRICT_EQUAL: in ParseAssignmentBinaryExpression()
712 case lexer::TokenType::PUNCTUATOR_NOT_STRICT_EQUAL: in ParseAssignmentBinaryExpression()
713 case lexer::TokenType::PUNCTUATOR_LESS_THAN: in ParseAssignmentBinaryExpression()
714 case lexer::TokenType::PUNCTUATOR_LESS_THAN_EQUAL: in ParseAssignmentBinaryExpression()
715 case lexer::TokenType::PUNCTUATOR_GREATER_THAN: in ParseAssignmentBinaryExpression()
716 case lexer::TokenType::PUNCTUATOR_GREATER_THAN_EQUAL: in ParseAssignmentBinaryExpression()
717 case lexer::TokenType::PUNCTUATOR_LEFT_SHIFT: in ParseAssignmentBinaryExpression()
718 case lexer::TokenType::PUNCTUATOR_RIGHT_SHIFT: in ParseAssignmentBinaryExpression()
719 case lexer::TokenType::PUNCTUATOR_UNSIGNED_RIGHT_SHIFT: in ParseAssignmentBinaryExpression()
720 case lexer::TokenType::PUNCTUATOR_PLUS: in ParseAssignmentBinaryExpression()
721 case lexer::TokenType::PUNCTUATOR_MINUS: in ParseAssignmentBinaryExpression()
722 case lexer::TokenType::PUNCTUATOR_MULTIPLY: in ParseAssignmentBinaryExpression()
723 case lexer::TokenType::PUNCTUATOR_DIVIDE: in ParseAssignmentBinaryExpression()
724 case lexer::TokenType::PUNCTUATOR_MOD: in ParseAssignmentBinaryExpression()
725 case lexer::TokenType::KEYW_INSTANCEOF: in ParseAssignmentBinaryExpression()
726 case lexer::TokenType::PUNCTUATOR_EXPONENTIATION: { in ParseAssignmentBinaryExpression()
736 ir::Expression *ParserImpl::ParseAssignmentEqualExpression(const lexer::TokenType tokenType, in ParseAssignmentEqualExpression()
741 case lexer::TokenType::PUNCTUATOR_UNSIGNED_RIGHT_SHIFT_EQUAL: in ParseAssignmentEqualExpression()
742 case lexer::TokenType::PUNCTUATOR_RIGHT_SHIFT_EQUAL: in ParseAssignmentEqualExpression()
743 case lexer::TokenType::PUNCTUATOR_LEFT_SHIFT_EQUAL: in ParseAssignmentEqualExpression()
744 case lexer::TokenType::PUNCTUATOR_PLUS_EQUAL: in ParseAssignmentEqualExpression()
745 case lexer::TokenType::PUNCTUATOR_MINUS_EQUAL: in ParseAssignmentEqualExpression()
746 case lexer::TokenType::PUNCTUATOR_MULTIPLY_EQUAL: in ParseAssignmentEqualExpression()
747 case lexer::TokenType::PUNCTUATOR_DIVIDE_EQUAL: in ParseAssignmentEqualExpression()
748 case lexer::TokenType::PUNCTUATOR_MOD_EQUAL: in ParseAssignmentEqualExpression()
749 case lexer::TokenType::PUNCTUATOR_BITWISE_AND_EQUAL: in ParseAssignmentEqualExpression()
750 case lexer::TokenType::PUNCTUATOR_BITWISE_OR_EQUAL: in ParseAssignmentEqualExpression()
751 case lexer::TokenType::PUNCTUATOR_BITWISE_XOR_EQUAL: in ParseAssignmentEqualExpression()
752 case lexer::TokenType::PUNCTUATOR_EXPONENTIATION_EQUAL: { in ParseAssignmentEqualExpression()
764 case lexer::TokenType::PUNCTUATOR_LOGICAL_AND_EQUAL: in ParseAssignmentEqualExpression()
765 case lexer::TokenType::PUNCTUATOR_LOGICAL_OR_EQUAL: in ParseAssignmentEqualExpression()
766 case lexer::TokenType::PUNCTUATOR_LOGICAL_NULLISH_EQUAL: { in ParseAssignmentEqualExpression()
780 lexer::SourcePosition startLoc = lexer_->GetToken().Start(); in ParseTemplateLiteral()
788 lexer_->ScanString<lexer::LEX_CHAR_BACK_TICK>(); in ParseTemplateLiteral()
795 element->SetRange({lexer::SourcePosition {startPos.Iterator().Index(), startPos.Line()}, in ParseTemplateLiteral()
796 lexer::SourcePosition {templateStr.end, lexer_->Line()}}); in ParseTemplateLiteral()
808 lexer::TemplateLiteralParserContext ctx(lexer_); in ParseTemplateLiteral()
814 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_BRACE) { in ParseTemplateLiteral()
815 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_BRACE); in ParseTemplateLiteral()
833 lexer::SourcePosition start = lexer_->GetToken().Start(); in ParseNewExpression()
849 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS) { in ParseNewExpression()
850 lexer::SourcePosition endLoc = callee->End(); in ParseNewExpression()
860 while (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS) { in ParseNewExpression()
864 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD_PERIOD_PERIOD) { in ParseNewExpression()
874 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA) { in ParseNewExpression()
878 if (lexer_->GetToken().Type() == lexer::TokenType::EOS) { in ParseNewExpression()
899 lexer::SourceRange loc = lexer_->GetToken().Loc(); in ParsePotentialNewTarget()
901 if (lexer_->Lookahead() == lexer::LEX_CHAR_DOT) { in ParsePotentialNewTarget()
905 if (lexer_->GetToken().KeywordType() == lexer::TokenType::KEYW_TARGET) { in ParsePotentialNewTarget()
910 if ((lexer_->GetToken().Flags() & lexer::TokenFlags::HAS_ESCAPE) != 0) { in ParsePotentialNewTarget()
935 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::LITERAL_TRUE || in ParseBooleanLiteral()
936 lexer_->GetToken().Type() == lexer::TokenType::LITERAL_FALSE); in ParseBooleanLiteral()
938 …auto *booleanNode = AllocNode<ir::BooleanLiteral>(lexer_->GetToken().Type() == lexer::TokenType::L… in ParseBooleanLiteral()
947 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::LITERAL_NULL); in ParseNullLiteral()
957 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::LITERAL_NUMBER); in ParseNumberLiteral()
961 if ((lexer_->GetToken().Flags() & lexer::TokenFlags::NUMBER_BIGINT) != 0U) { in ParseNumberLiteral()
975 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::LITERAL_CHAR); in ParseCharLiteral()
986 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::LITERAL_STRING); in ParseStringLiteral()
997 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::KEYW_UNDEFINED); in ParseUndefinedLiteral()
1007 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::KEYW_THIS); in ParseThisExpression()
1018 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_DIVIDE || in ParseRegularExpression()
1019 lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_DIVIDE_EQUAL); in ParseRegularExpression()
1024 lexer::RegExpParser reParser(regexp, Allocator(), *this); in ParseRegularExpression()
1037 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::KEYW_SUPER); in ParseSuperExpression()
1044 if ((lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD || in ParseSuperExpression()
1045 lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET) && in ParseSuperExpression()
1050 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS && in ParseSuperExpression()
1062 case lexer::TokenType::LITERAL_IDENT: { in ParsePrimaryExpressionWithLiterals()
1065 case lexer::TokenType::LITERAL_TRUE: in ParsePrimaryExpressionWithLiterals()
1066 case lexer::TokenType::LITERAL_FALSE: { in ParsePrimaryExpressionWithLiterals()
1069 case lexer::TokenType::LITERAL_NULL: { in ParsePrimaryExpressionWithLiterals()
1072 case lexer::TokenType::KEYW_UNDEFINED: { in ParsePrimaryExpressionWithLiterals()
1075 case lexer::TokenType::LITERAL_NUMBER: { in ParsePrimaryExpressionWithLiterals()
1078 case lexer::TokenType::LITERAL_STRING: { in ParsePrimaryExpressionWithLiterals()
1100 if (lexer_->GetToken().Type() != lexer::TokenType::KEYW_IN) { in ParseHashMaskOperator()
1102 lexer_->GetToken().SetTokenType(lexer::TokenType::KEYW_IN); in ParseHashMaskOperator()
1110 lexer::SourcePosition startLoc = lexer_->GetToken().Start(); in ParseClassExpression()
1122 case lexer::TokenType::PUNCTUATOR_DIVIDE: in ParsePunctuators()
1123 case lexer::TokenType::PUNCTUATOR_DIVIDE_EQUAL: { in ParsePunctuators()
1126 case lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET: { in ParsePunctuators()
1129 case lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS: { in ParsePunctuators()
1132 case lexer::TokenType::PUNCTUATOR_LEFT_BRACE: { in ParsePunctuators()
1135 case lexer::TokenType::PUNCTUATOR_BACK_TICK: { in ParsePunctuators()
1138 case lexer::TokenType::PUNCTUATOR_HASH_MARK: { in ParsePunctuators()
1141 case lexer::TokenType::PUNCTUATOR_LESS_THAN: { in ParsePunctuators()
1155 case lexer::TokenType::KEYW_IMPORT: { in ParsePrimaryExpression()
1158 case lexer::TokenType::PUNCTUATOR_DIVIDE: in ParsePrimaryExpression()
1159 case lexer::TokenType::PUNCTUATOR_DIVIDE_EQUAL: in ParsePrimaryExpression()
1160 case lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET: in ParsePrimaryExpression()
1161 case lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS: in ParsePrimaryExpression()
1162 case lexer::TokenType::PUNCTUATOR_LEFT_BRACE: in ParsePrimaryExpression()
1163 case lexer::TokenType::PUNCTUATOR_BACK_TICK: in ParsePrimaryExpression()
1164 case lexer::TokenType::PUNCTUATOR_HASH_MARK: in ParsePrimaryExpression()
1165 case lexer::TokenType::PUNCTUATOR_LESS_THAN: { in ParsePrimaryExpression()
1168 case lexer::TokenType::KEYW_FUNCTION: { in ParsePrimaryExpression()
1171 case lexer::TokenType::KEYW_CLASS: { in ParsePrimaryExpression()
1174 case lexer::TokenType::KEYW_THIS: { in ParsePrimaryExpression()
1177 case lexer::TokenType::KEYW_TYPEOF: { in ParsePrimaryExpression()
1180 case lexer::TokenType::KEYW_SUPER: { in ParsePrimaryExpression()
1183 case lexer::TokenType::KEYW_NEW: { in ParsePrimaryExpression()
1200 static constexpr size_t GetOperatorPrecedenceArithmeticAndComparison(const lexer::TokenType operato… in GetOperatorPrecedenceArithmeticAndComparison()
1203 case lexer::TokenType::PUNCTUATOR_EQUAL: in GetOperatorPrecedenceArithmeticAndComparison()
1204 case lexer::TokenType::PUNCTUATOR_NOT_EQUAL: in GetOperatorPrecedenceArithmeticAndComparison()
1205 case lexer::TokenType::PUNCTUATOR_STRICT_EQUAL: in GetOperatorPrecedenceArithmeticAndComparison()
1206 case lexer::TokenType::PUNCTUATOR_NOT_STRICT_EQUAL: { in GetOperatorPrecedenceArithmeticAndComparison()
1210 case lexer::TokenType::PUNCTUATOR_LESS_THAN: in GetOperatorPrecedenceArithmeticAndComparison()
1211 case lexer::TokenType::PUNCTUATOR_LESS_THAN_EQUAL: in GetOperatorPrecedenceArithmeticAndComparison()
1212 case lexer::TokenType::PUNCTUATOR_GREATER_THAN: in GetOperatorPrecedenceArithmeticAndComparison()
1213 case lexer::TokenType::PUNCTUATOR_GREATER_THAN_EQUAL: in GetOperatorPrecedenceArithmeticAndComparison()
1214 case lexer::TokenType::KEYW_INSTANCEOF: in GetOperatorPrecedenceArithmeticAndComparison()
1215 case lexer::TokenType::KEYW_IN: { in GetOperatorPrecedenceArithmeticAndComparison()
1219 case lexer::TokenType::PUNCTUATOR_PLUS: in GetOperatorPrecedenceArithmeticAndComparison()
1220 case lexer::TokenType::PUNCTUATOR_MINUS: { in GetOperatorPrecedenceArithmeticAndComparison()
1224 case lexer::TokenType::PUNCTUATOR_MULTIPLY: in GetOperatorPrecedenceArithmeticAndComparison()
1225 case lexer::TokenType::PUNCTUATOR_DIVIDE: in GetOperatorPrecedenceArithmeticAndComparison()
1226 case lexer::TokenType::PUNCTUATOR_MOD: { in GetOperatorPrecedenceArithmeticAndComparison()
1236 static constexpr size_t GetOperatorPrecedence(const lexer::TokenType operatorType) in GetOperatorPrecedence()
1238 ASSERT(operatorType == lexer::TokenType::KEYW_AS || lexer::Token::IsBinaryToken(operatorType)); in GetOperatorPrecedence()
1241 case lexer::TokenType::PUNCTUATOR_NULLISH_COALESCING: { in GetOperatorPrecedence()
1245 case lexer::TokenType::PUNCTUATOR_LOGICAL_OR: { in GetOperatorPrecedence()
1249 case lexer::TokenType::PUNCTUATOR_LOGICAL_AND: { in GetOperatorPrecedence()
1253 case lexer::TokenType::PUNCTUATOR_BITWISE_OR: { in GetOperatorPrecedence()
1257 case lexer::TokenType::PUNCTUATOR_BITWISE_XOR: { in GetOperatorPrecedence()
1261 case lexer::TokenType::PUNCTUATOR_BITWISE_AND: { in GetOperatorPrecedence()
1265 case lexer::TokenType::PUNCTUATOR_LEFT_SHIFT: in GetOperatorPrecedence()
1266 case lexer::TokenType::PUNCTUATOR_RIGHT_SHIFT: in GetOperatorPrecedence()
1267 case lexer::TokenType::PUNCTUATOR_UNSIGNED_RIGHT_SHIFT: { in GetOperatorPrecedence()
1271 case lexer::TokenType::KEYW_AS: { in GetOperatorPrecedence()
1275 case lexer::TokenType::PUNCTUATOR_EXPONENTIATION: { in GetOperatorPrecedence()
1286 const lexer::TokenType operatorType) in ShouldBinaryExpressionBeAmended()
1290 (operatorType != lexer::TokenType::PUNCTUATOR_EXPONENTIATION || in ShouldBinaryExpressionBeAmended()
1291 binaryExpression->OperatorType() != lexer::TokenType::PUNCTUATOR_EXPONENTIATION); in ShouldBinaryExpressionBeAmended()
1295 const lexer::TokenType operatorType) in ShouldAsExpressionBeAmended()
1297 … return GetOperatorPrecedence(lexer::TokenType::KEYW_AS) <= GetOperatorPrecedence(operatorType) && in ShouldAsExpressionBeAmended()
1298 … !asExpression->IsGrouped() && operatorType != lexer::TokenType::PUNCTUATOR_EXPONENTIATION; in ShouldAsExpressionBeAmended()
1302 const lexer::TokenType operatorType) in ShouldExpressionBeAmended()
1316 const lexer::TokenType operatorType) in AreLogicalAndNullishMixedIncorrectly()
1318 return ((operatorType == lexer::TokenType::PUNCTUATOR_LOGICAL_OR || in AreLogicalAndNullishMixedIncorrectly()
1319 operatorType == lexer::TokenType::PUNCTUATOR_LOGICAL_AND) && in AreLogicalAndNullishMixedIncorrectly()
1321 …expression->AsBinaryExpression()->OperatorType() == lexer::TokenType::PUNCTUATOR_NULLISH_COALESCIN… in AreLogicalAndNullishMixedIncorrectly()
1323 …(operatorType == lexer::TokenType::PUNCTUATOR_NULLISH_COALESCING && expression->IsBinaryExpression… in AreLogicalAndNullishMixedIncorrectly()
1324 … (expression->AsBinaryExpression()->OperatorType() == lexer::TokenType::PUNCTUATOR_LOGICAL_OR || in AreLogicalAndNullishMixedIncorrectly()
1325 … expression->AsBinaryExpression()->OperatorType() == lexer::TokenType::PUNCTUATOR_LOGICAL_AND) && in AreLogicalAndNullishMixedIncorrectly()
1358 const lexer::TokenType operatorType) in CreateAmendedBinaryExpression()
1369 ir::Expression *ParserImpl::ParseExpressionOrTypeAnnotation([[maybe_unused]] lexer::TokenType type, in ParseExpressionOrTypeAnnotation()
1376 lexer::TokenType operatorType) in FindAndAmendChildExpression()
1393 lexer::TokenType operatorType = lexer_->GetToken().Type(); in ParseBinaryExpression()
1394 ASSERT(lexer::Token::IsBinaryToken(operatorType)); in ParseBinaryExpression()
1396 if (operatorType == lexer::TokenType::PUNCTUATOR_EXPONENTIATION) { in ParseBinaryExpression()
1407 …if ((operatorType == lexer::TokenType::KEYW_INSTANCEOF) || ((flags & ExpressionParseFlags::INSTANC… in ParseBinaryExpression()
1433 const lexer::SourcePosition &endPos = rightExpr->End(); in ParseBinaryExpression()
1451 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_FORMAT && in ParseCallExpressionArguments()
1454 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS) { in ParseCallExpressionArguments()
1455 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS); in ParseCallExpressionArguments()
1459 while (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS && in ParseCallExpressionArguments()
1460 lexer_->GetToken().Type() != lexer::TokenType::EOS) { in ParseCallExpressionArguments()
1465 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD_PERIOD_PERIOD) { in ParseCallExpressionArguments()
1475 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA) { in ParseCallExpressionArguments()
1478 … } else if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS) { in ParseCallExpressionArguments()
1479 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS); in ParseCallExpressionArguments()
1489 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS); in ParseCallExpression()
1511 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS) { in ParseCallExpression()
1528 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_HASH_MARK) { in ParseOptionalChain()
1534 if (tokenType == lexer::TokenType::LITERAL_IDENT) { in ParseOptionalChain()
1545 if (tokenType == lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET) { in ParseOptionalChain()
1550 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET) { in ParseOptionalChain()
1552 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET); in ParseOptionalChain()
1561 if (tokenType == lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS) { in ParseOptionalChain()
1566 if (tokenType == lexer::TokenType::PUNCTUATOR_BACK_TICK || in ParseOptionalChain()
1567 lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_BACK_TICK) { in ParseOptionalChain()
1575 … const lexer::SourcePosition &startLoc) in ParsePotentialArrowExpression()
1578 case lexer::TokenType::KEYW_FUNCTION: { in ParsePotentialArrowExpression()
1583 case lexer::TokenType::LITERAL_IDENT: { in ParsePotentialArrowExpression()
1590 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_ARROW) { in ParsePotentialArrowExpression()
1592 LogExpectedToken(lexer::TokenType::PUNCTUATOR_ARROW); in ParsePotentialArrowExpression()
1600 case lexer::TokenType::PUNCTUATOR_ARROW: { in ParsePotentialArrowExpression()
1606 case lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS: { in ParsePotentialArrowExpression()
1609 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_ARROW) { in ParsePotentialArrowExpression()
1630 … [[maybe_unused]] const lexer::SourcePosition &startLoc, in ParsePotentialGenericFunctionCall()
1637 [[maybe_unused]] lexer::SourcePosition startLoc) in ParsePotentialNonNullExpression()
1655 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET) { in ParseElementAccess()
1656 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET); in ParseElementAccess()
1672 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_HASH_MARK); in ParsePrivatePropertyAccess()
1674 lexer::SourcePosition memberStart = lexer_->GetToken().Start(); in ParsePrivatePropertyAccess()
1702 ir::Expression *ParserImpl::ParsePostPrimaryExpression(ir::Expression *primaryExpr, lexer::SourcePo… in ParsePostPrimaryExpression()
1708 case lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET: { in ParsePostPrimaryExpression()
1712 case lexer::TokenType::LITERAL_IDENT: { in ParsePostPrimaryExpression()
1718 case lexer::TokenType::PUNCTUATOR_LEFT_SHIFT: in ParsePostPrimaryExpression()
1719 case lexer::TokenType::PUNCTUATOR_LESS_THAN: { in ParsePostPrimaryExpression()
1725 case lexer::TokenType::PUNCTUATOR_BACK_TICK: { in ParsePostPrimaryExpression()
1729 case lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS: { in ParsePostPrimaryExpression()
1736 case lexer::TokenType::PUNCTUATOR_EXCLAMATION_MARK: { in ParsePostPrimaryExpression()
1756 const lexer::SourcePosition startLoc) in ParsePostPrimaryExpressionBackTick()
1759 lexer::SourcePosition endLoc = propertyNode->End(); in ParsePostPrimaryExpressionBackTick()
1768 … const lexer::TokenType tokenType, bool *isChainExpression) in ParsePostPrimaryExpressionDot()
1771 case lexer::TokenType::PUNCTUATOR_QUESTION_DOT: { in ParsePostPrimaryExpressionDot()
1773 lexer_->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); // eat ?. in ParsePostPrimaryExpressionDot()
1776 case lexer::TokenType::PUNCTUATOR_PERIOD: { in ParsePostPrimaryExpressionDot()
1777 lexer_->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); // eat period in ParsePostPrimaryExpressionDot()
1779 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_HASH_MARK) { in ParsePostPrimaryExpressionDot()
1814 ir::Expression *ParserImpl::SetupChainExpr(ir::Expression *const top, lexer::SourcePosition startLo… in SetupChainExpr()
1822 lexer::SourcePosition endLoc = expr->End(); in SetupChainExpr()
1837 lexer::SourcePosition startLoc = lexer_->GetToken().Start(); in ParseMemberExpression()
1872 if (!lexer_->GetToken().NewLine() && lexer::Token::IsUpdateToken(lexer_->GetToken().Type())) { in ParseMemberExpression()
1873 lexer::SourcePosition start = returnExpression->Start(); in ParseMemberExpression()
1892 case lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET: { in ParsePatternElement()
1896 case lexer::TokenType::PUNCTUATOR_PERIOD_PERIOD_PERIOD: { in ParsePatternElement()
1903 case lexer::TokenType::PUNCTUATOR_LEFT_BRACE: { in ParsePatternElement()
1908 case lexer::TokenType::LITERAL_IDENT: { in ParsePatternElement()
1919 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_SUBSTITUTION) { in ParsePatternElement()
1931 …ir::AstNodeType::ASSIGNMENT_PATTERN, returnNode, rightNode, lexer::TokenType::PUNCTUATOR_SUBSTITUT… in ParsePatternElement()
1941 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS); in ParsePatternElementErrorCheck()
1950 if (context_.IsGenerator() && lexer_->GetToken().Type() == lexer::TokenType::KEYW_YIELD) { in ParsePatternElementErrorCheck()
1954 if (context_.IsAsync() && lexer_->GetToken().Type() == lexer::TokenType::KEYW_AWAIT) { in ParsePatternElementErrorCheck()
1964 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS && in CheckPropertyKeyAsyncModifier()
1965 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COLON && in CheckPropertyKeyAsyncModifier()
1966 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COMMA && in CheckPropertyKeyAsyncModifier()
1967 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_BRACE) { in CheckPropertyKeyAsyncModifier()
1983 case lexer::LEX_CHAR_LEFT_PAREN: in IsAccessorDelimiter()
1984 case lexer::LEX_CHAR_COLON: in IsAccessorDelimiter()
1985 case lexer::LEX_CHAR_COMMA: in IsAccessorDelimiter()
1986 case lexer::LEX_CHAR_RIGHT_BRACE: { in IsAccessorDelimiter()
1998 case lexer::LEX_CHAR_EQUALS: in IsShorthandDelimiter()
1999 case lexer::LEX_CHAR_COMMA: in IsShorthandDelimiter()
2000 case lexer::LEX_CHAR_RIGHT_BRACE: { in IsShorthandDelimiter()
2009 void ParserImpl::ValidateAccessor(ExpressionParseFlags flags, lexer::TokenFlags currentTokenFlags) in ValidateAccessor()
2015 if ((currentTokenFlags & lexer::TokenFlags::HAS_ESCAPE) != 0) { in ValidateAccessor()
2020 ir::Property *ParserImpl::ParseShorthandProperty(const lexer::LexerPosition *startPos) in ParseShorthandProperty()
2023 lexer::TokenType keywordType = lexer_->GetToken().KeywordType(); in ParseShorthandProperty()
2025 /* Rewind the lexer to the beginning of the ident to reparse as common in ParseShorthandProperty()
2029 lexer::SourcePosition start = lexer_->GetToken().Start(); in ParseShorthandProperty()
2031 if (lexer_->GetToken().Type() != lexer::TokenType::LITERAL_IDENT) { in ParseShorthandProperty()
2034 LogExpectedToken(lexer::TokenType::LITERAL_IDENT); in ParseShorthandProperty()
2045 lexer::SourcePosition end; in ParseShorthandProperty()
2047 if (nextCp == lexer::LEX_CHAR_EQUALS) { in ParseShorthandProperty()
2056 … ir::AstNodeType::ASSIGNMENT_PATTERN, value, rightNode, lexer::TokenType::PUNCTUATOR_SUBSTITUTION); in ParseShorthandProperty()
2078 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY) { in ParsePropertyModifiers()
2087 lexer::TokenFlags currentTokenFlags = lexer_->GetToken().Flags(); in ParsePropertyModifiers()
2089 lexer::TokenType keywordType = lexer_->GetToken().KeywordType(); in ParsePropertyModifiers()
2091 if (keywordType == lexer::TokenType::KEYW_GET && !IsAccessorDelimiter(nextCp)) { in ParsePropertyModifiers()
2095 lexer_->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); in ParsePropertyModifiers()
2101 if (keywordType == lexer::TokenType::KEYW_SET && !IsAccessorDelimiter(nextCp)) { in ParsePropertyModifiers()
2105 lexer_->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); in ParsePropertyModifiers()
2120 lexer_->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); in ParseGeneratorPropertyModifier()
2129 case lexer::TokenType::LITERAL_IDENT: { in ParsePropertyKey()
2135 case lexer::TokenType::LITERAL_STRING: { in ParsePropertyKey()
2141 case lexer::TokenType::LITERAL_NUMBER: { in ParsePropertyKey()
2142 if ((lexer_->GetToken().Flags() & lexer::TokenFlags::NUMBER_BIGINT) != 0) { in ParsePropertyKey()
2151 case lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET: { in ParsePropertyKey()
2156 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET) { in ParsePropertyKey()
2159 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_SQUARE_BRACKET); in ParsePropertyKey()
2182 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COLON) { in ParsePropertyValue()
2183 if (lexer::Token::IsPunctuatorToken(lexer_->GetToken().Type())) { in ParsePropertyValue()
2184 LogExpectedToken(lexer::TokenType::PUNCTUATOR_COLON); in ParsePropertyValue()
2237 lexer_->NextToken(lexer::NextTokenFlags::KEYWORD_TO_IDENT); in ParsePropertyDefinition()
2238 lexer::SourcePosition start = lexer_->GetToken().Start(); in ParsePropertyDefinition()
2240 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD_PERIOD_PERIOD) { in ParsePropertyDefinition()
2244 if (lexer_->GetToken().Type() == lexer::TokenType::LITERAL_IDENT) { in ParsePropertyDefinition()
2248 } else if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY) { in ParsePropertyDefinition()
2252 bool isComputed = lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_SQUARE_BRACKET; in ParsePropertyDefinition()
2256 if ((lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS || in ParsePropertyDefinition()
2257 lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LESS_THAN) && in ParsePropertyDefinition()
2270 lexer::SourcePosition end = value->End(); in ParsePropertyDefinition()
2282 if (lexer_->GetToken().Type() != lexer::TokenType::LITERAL_IDENT) { in ParsePropertyEndErrorHendler()
2284 if (lexer_->GetToken().Type() == lexer::TokenType::LITERAL_IDENT) { in ParsePropertyEndErrorHendler()
2287 lexer_->GetToken().SetTokenType(lexer::TokenType::PUNCTUATOR_COMMA); in ParsePropertyEndErrorHendler()
2290 if (lexer::Token::IsPunctuatorToken(lexer_->GetToken().Type())) { in ParsePropertyEndErrorHendler()
2292 lexer_->GetToken().SetTokenType(lexer::TokenType::PUNCTUATOR_RIGHT_BRACE); in ParsePropertyEndErrorHendler()
2297 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_BRACE) { in ParsePropertyEndErrorHendler()
2298 lexer_->GetToken().SetTokenType(lexer::TokenType::PUNCTUATOR_RIGHT_BRACE); in ParsePropertyEndErrorHendler()
2306 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_COMMA && in ParsePropertyEnd()
2307 lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_BRACE) { in ParsePropertyEnd()
2313 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA && in ParsePropertyEnd()
2314 lexer_->Lookahead() == lexer::LEX_CHAR_RIGHT_BRACE) { in ParsePropertyEnd()
2325 ASSERT(lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_LEFT_BRACE); in ParseObjectExpression()
2326 lexer::SourcePosition start = lexer_->GetToken().Start(); in ParseObjectExpression()
2331 if (lexer_->Lookahead() == lexer::LEX_CHAR_RIGHT_BRACE) { in ParseObjectExpression()
2335 while (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_BRACE && in ParseObjectExpression()
2336 lexer_->GetToken().Type() != lexer::TokenType::EOS) { in ParseObjectExpression()
2357 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_SUBSTITUTION && in ParseObjectExpression()
2360 … } else if (!inPattern && lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_SUBSTITUTION) { in ParseObjectExpression()
2373 lexer::SourcePosition start = startExpr->Start(); in ParseSequenceExpression()
2378 while (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_COMMA) { in ParseSequenceExpression()
2381 …if (acceptRest && lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD_PERIOD_PERIOD) { in ParseSequenceExpression()
2389 …if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS && lexer_->CheckAr… in ParseSequenceExpression()
2399 lexer::SourcePosition end = sequence.back()->End(); in ParseSequenceExpression()
2413 lexer::TokenType operatorType = lexer_->GetToken().Type(); in ParseUnaryOrPrefixUpdateExpression()
2414 lexer::SourcePosition start = lexer_->GetToken().Start(); in ParseUnaryOrPrefixUpdateExpression()
2423 if (lexer::Token::IsUpdateToken(operatorType)) { in ParseUnaryOrPrefixUpdateExpression()
2439 if (operatorType == lexer::TokenType::KEYW_DELETE) { in ParseUnaryOrPrefixUpdateExpression()
2450 lexer::SourcePosition end = argument->End(); in ParseUnaryOrPrefixUpdateExpression()
2454 if (lexer::Token::IsUpdateToken(operatorType)) { in ParseUnaryOrPrefixUpdateExpression()
2456 } else if (operatorType == lexer::TokenType::KEYW_AWAIT) { in ParseUnaryOrPrefixUpdateExpression()
2458 } else if (operatorType == lexer::TokenType::KEYW_TYPEOF) { in ParseUnaryOrPrefixUpdateExpression()
2471 lexer::SourcePosition startLoc = lexer_->GetToken().Start(); in ParseImportExpression()
2472 lexer::SourcePosition endLoc = lexer_->GetToken().End(); in ParseImportExpression()
2476 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_PERIOD) { in ParseImportExpression()
2485 if (lexer_->GetToken().Type() != lexer::TokenType::LITERAL_IDENT || in ParseImportExpression()
2486 lexer_->GetToken().KeywordType() != lexer::TokenType::KEYW_META) { in ParseImportExpression()
2490 lexer_->GetToken().SetTokenType(lexer::TokenType::KEYW_META); in ParseImportExpression()
2500 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS) { in ParseImportExpression()
2501 LogExpectedToken(lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS); in ParseImportExpression()
2508 if (lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS) { in ParseImportExpression()
2510 LogExpectedToken(lexer::TokenType::PUNCTUATOR_RIGHT_PARENTHESIS); in ParseImportExpression()
2513 lexer::SourcePosition endImportLoc = lexer_->GetToken().End(); in ParseImportExpression()
2528 return lexer_->GetToken().Type() != lexer::TokenType::PUNCTUATOR_LEFT_PARENTHESIS; in IsNamedFunctionExpression()
2533 lexer::SourcePosition startLoc = lexer_->GetToken().Start(); in ParseFunctionExpression()
2542 if (lexer_->GetToken().Type() == lexer::TokenType::PUNCTUATOR_MULTIPLY) { in ParseFunctionExpression()