• Home
  • Raw
  • Download

Lines Matching full:lexer

23 #include "lexer/TSLexer.h"
124 ir::TSImportEqualsDeclaration *TSParser::ParseTsImportEqualsDeclaration(const lexer::SourcePosition… in ParseTsImportEqualsDeclaration()
127 ES2PANDA_ASSERT(Lexer()->GetToken().Type() == lexer::TokenType::KEYW_IMPORT); in ParseTsImportEqualsDeclaration()
128 Lexer()->NextToken(); in ParseTsImportEqualsDeclaration()
129 if (Lexer()->GetToken().Type() != lexer::TokenType::LITERAL_IDENT) { in ParseTsImportEqualsDeclaration()
133 auto *id = AllocNode<ir::Identifier>(Lexer()->GetToken().Ident(), Allocator()); in ParseTsImportEqualsDeclaration()
135 id->SetRange(Lexer()->GetToken().Loc()); in ParseTsImportEqualsDeclaration()
136 Lexer()->NextToken(); // eat id name in ParseTsImportEqualsDeclaration()
138 if (Lexer()->GetToken().Type() != lexer::TokenType::PUNCTUATOR_SUBSTITUTION) { in ParseTsImportEqualsDeclaration()
141 Lexer()->NextToken(); // eat substitution in ParseTsImportEqualsDeclaration()
143 if (Lexer()->GetToken().Type() != lexer::TokenType::LITERAL_IDENT) { in ParseTsImportEqualsDeclaration()
148 importEqualsDecl->SetRange({startLoc, Lexer()->GetToken().End()}); in ParseTsImportEqualsDeclaration()
156 ir::ExportDefaultDeclaration *TSParser::ParseExportDefaultDeclaration(const lexer::SourcePosition &… in ParseExportDefaultDeclaration()
159 Lexer()->NextToken(); // eat `default` keyword or `=` in ParseExportDefaultDeclaration()
164 switch (Lexer()->GetToken().KeywordType()) { in ParseExportDefaultDeclaration()
165 case lexer::TokenType::KEYW_FUNCTION: { in ParseExportDefaultDeclaration()
169 case lexer::TokenType::KEYW_CLASS: { in ParseExportDefaultDeclaration()
173 case lexer::TokenType::KEYW_INTERFACE: { in ParseExportDefaultDeclaration()
177 case lexer::TokenType::KEYW_ASYNC: { in ParseExportDefaultDeclaration()
178 if ((Lexer()->GetToken().Flags() & lexer::TokenFlags::HAS_ESCAPE) == 0) { in ParseExportDefaultDeclaration()
179 Lexer()->NextToken(); // eat `async` in ParseExportDefaultDeclaration()
192 lexer::SourcePosition endLoc = declNode->End(); in ParseExportDefaultDeclaration()
207 switch (Lexer()->GetToken().KeywordType()) { in GetDeclarationForNamedExport()
208 case lexer::TokenType::KEYW_VAR: { in GetDeclarationForNamedExport()
211 case lexer::TokenType::KEYW_CONST: { in GetDeclarationForNamedExport()
214 case lexer::TokenType::KEYW_LET: { in GetDeclarationForNamedExport()
217 case lexer::TokenType::KEYW_FUNCTION: { in GetDeclarationForNamedExport()
220 case lexer::TokenType::KEYW_CLASS: { in GetDeclarationForNamedExport()
223 case lexer::TokenType::KEYW_ENUM: { in GetDeclarationForNamedExport()
226 case lexer::TokenType::KEYW_INTERFACE: { in GetDeclarationForNamedExport()
229 case lexer::TokenType::KEYW_TYPE: { in GetDeclarationForNamedExport()
232 case lexer::TokenType::KEYW_GLOBAL: in GetDeclarationForNamedExport()
233 case lexer::TokenType::KEYW_MODULE: in GetDeclarationForNamedExport()
234 case lexer::TokenType::KEYW_NAMESPACE: { in GetDeclarationForNamedExport()
238 if (!Lexer()->GetToken().IsAsyncModifier()) { in GetDeclarationForNamedExport()
242 Lexer()->NextToken(); // eat `async` keyword in GetDeclarationForNamedExport()
247 ir::Statement *TSParser::ParseNamedExportDeclaration(const lexer::SourcePosition &startLoc) in ParseNamedExportDeclaration()
252 if (Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_DECLARE) { in ParseNamedExportDeclaration()
256 if (Lexer()->GetToken().KeywordType() == lexer::TokenType::KEYW_ABSTRACT) { in ParseNamedExportDeclaration()
257 Lexer()->NextToken(); // eat 'abstract' in ParseNamedExportDeclaration()
267 lexer::SourcePosition endLoc = decl->End(); in ParseNamedExportDeclaration()
278 lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); in ParseExportDeclaration()
279 Lexer()->NextToken(); // eat `export` keyword in ParseExportDeclaration()
281 switch (Lexer()->GetToken().Type()) { in ParseExportDeclaration()
282 case lexer::TokenType::KEYW_DEFAULT: { in ParseExportDeclaration()
285 case lexer::TokenType::PUNCTUATOR_MULTIPLY: { in ParseExportDeclaration()
288 case lexer::TokenType::PUNCTUATOR_LEFT_BRACE: { in ParseExportDeclaration()
291 case lexer::TokenType::KEYW_IMPORT: { in ParseExportDeclaration()
294 case lexer::TokenType::PUNCTUATOR_SUBSTITUTION: { in ParseExportDeclaration()
317 lexer::SourcePosition constVarStar = Lexer()->GetToken().Start(); in ParseConstStatement()
318 Lexer()->NextToken(); in ParseConstStatement()
320 if (Lexer()->GetToken().Type() == lexer::TokenType::KEYW_ENUM) { in ParseConstStatement()
347 char32_t nextChar = Lexer()->Lookahead(); in ParseImportDeclaration()
348 if (nextChar == lexer::LEX_CHAR_LEFT_PAREN || nextChar == lexer::LEX_CHAR_DOT) { in ParseImportDeclaration()
352 lexer::SourcePosition startLoc = Lexer()->GetToken().Start(); in ParseImportDeclaration()
353 Lexer()->NextToken(); // eat import in ParseImportDeclaration()
359 if (Lexer()->GetToken().Type() != lexer::TokenType::LITERAL_STRING) { in ParseImportDeclaration()
363 astNode->SetRange({startLoc, Lexer()->GetToken().End()}); in ParseImportDeclaration()
373 lexer::SourcePosition endLoc = source->End(); in ParseImportDeclaration()