• Home
  • Raw
  • Download

Lines Matching +full:parserprogram +full:-

7  * http://www.apache.org/licenses/LICENSE-2.0
49 cfg_ = impl_->CreateConfig(argv.size(), argv.data()); in Initializer()
56 impl_->DestroyConfig(cfg_); in ~Initializer()
65 if (ctx->parserProgram == nullptr || ctx->parserProgram->Ast() == nullptr) { in GetTouchingToken()
68 auto ast = reinterpret_cast<ir::AstNode *>(ctx->parserProgram->Ast()); in GetTouchingToken()
69 …auto checkFunc = [&pos](ir::AstNode *node) { return pos >= node->Start().index && pos < node->End(… in GetTouchingToken()
70 auto found = ast->FindChild(checkFunc); in GetTouchingToken()
72 auto *nestedFound = found->FindChild(checkFunc); in GetTouchingToken()
93 ss << textStr.substr(start, pos - start); in FormatStringFromArgs()
99 std::string placeholder = textStr.substr(pos, end - pos + 1); in FormatStringFromArgs()
100 std::string indexStr = placeholder.substr(1, placeholder.length() - 2); in FormatStringFromArgs()
134 return lexer::SourceRange(node->Start(), node->End()); in GetErrorRangeForNode()
150 auto statements = ctx->parserProgram->Ast()->Statements(); in GetFileReferencesImpl()
152 if (!statement->IsETSImportDeclaration()) { in GetFileReferencesImpl()
155 auto import = statement->AsETSImportDeclaration(); in GetFileReferencesImpl()
156 std::string importFileName {import->ResolvedSource()}; in GetFileReferencesImpl()
157 if (!import->Source()->IsStringLiteral()) { in GetFileReferencesImpl()
160 auto start = import->Source()->Start().index; in GetFileReferencesImpl()
161 auto end = import->Source()->End().index; in GetFileReferencesImpl()
166 auto fileName = ctx->sourceFileName; in GetFileReferencesImpl()
167 result.referenceInfos.emplace_back(fileName, start, end - start); in GetFileReferencesImpl()
181 …return node->Type() == ir::AstNodeType::BIGINT_LITERAL || node->Type() == ir::AstNodeType::BOOLEAN… in IsToken()
182 … node->Type() == ir::AstNodeType::CHAR_LITERAL || node->Type() == ir::AstNodeType::IDENTIFIER || in IsToken()
183 …node->Type() == ir::AstNodeType::NULL_LITERAL || node->Type() == ir::AstNodeType::UNDEFINED_LITERA… in IsToken()
184 …node->Type() == ir::AstNodeType::NUMBER_LITERAL || node->Type() == ir::AstNodeType::REGEXP_LITERAL… in IsToken()
185 …node->Type() == ir::AstNodeType::STRING_LITERAL || node->Type() == ir::AstNodeType::TS_NUMBER_KEYW… in IsToken()
186 …node->Type() == ir::AstNodeType::TS_ANY_KEYWORD || node->Type() == ir::AstNodeType::TS_BOOLEAN_KEY… in IsToken()
187 …node->Type() == ir::AstNodeType::TS_VOID_KEYWORD || node->Type() == ir::AstNodeType::TS_UNDEFINED_… in IsToken()
188 …node->Type() == ir::AstNodeType::TS_UNKNOWN_KEYWORD || node->Type() == ir::AstNodeType::TS_OBJECT_… in IsToken()
189 …node->Type() == ir::AstNodeType::TS_BIGINT_KEYWORD || node->Type() == ir::AstNodeType::TS_NEVER_KE… in IsToken()
190 …node->Type() == ir::AstNodeType::TS_NULL_KEYWORD || node->Type() == ir::AstNodeType::TEMPLATE_ELEM… in IsToken()
200 return node->Start().index != node->End().index; in NodeHasTokens()
205 for (int i = exclusiveStartPosition - 1; i >= 0; --i) { in FindRightmostChildNodeWithTokens()
215 ArenaVector<ir::AstNode *> children(allocator->Adapter()); in GetChildren()
216 if (node->Type() == ir::AstNodeType::ETS_MODULE) { in GetChildren()
219 …node->FindChild([](ir::AstNode *child) { return child->IsClassDeclaration(); })->AsClassDeclaratio… in GetChildren()
220 node = globalClass->Definition(); in GetChildren()
222 node->Iterate([&children](ir::AstNode *child) { children.push_back(child); }); in GetChildren()
248 size_t right = children.size() - 1; in FindNodeBeforePosition()
251 mid = left + ((right - left) >> 1U); in FindNodeBeforePosition()
252 if (pos < children[mid]->End().index) { in FindNodeBeforePosition()
253 if (mid == 0 || pos >= children[mid - 1]->End().index) { in FindNodeBeforePosition()
256 right = mid - 1; in FindNodeBeforePosition()
266 …auto checkFunc = [&pos](ir::AstNode *node) { return node->Start().index <= pos && pos <= node->End… in FindPrecedingToken()
267 auto found = startNode->FindChild(checkFunc); in FindPrecedingToken()
269 auto nestedFound = found->FindChild(checkFunc); in FindPrecedingToken()
273 nestedFound = found->FindChild(checkFunc); in FindPrecedingToken()
300 while (astNode != nullptr && astNode->OriginalNode() != nullptr) { in GetOriginalNode()
301 astNode = astNode->OriginalNode(); in GetOriginalNode()
310 return originalNode->Check(checker); in GetTypeOfSymbolAtLocation()
324 auto program = ctx->parserProgram; in GetCurrentTokenValueImpl()
325 auto ast = program->Ast(); in GetCurrentTokenValueImpl()
326 ir::AstNode *node = FindPrecedingToken(position, ast, ctx->allocator); in GetCurrentTokenValueImpl()
327 …return node != nullptr ? ReplaceQuotation(program->SourceCode().Substr(node->Start().index, positi… in GetCurrentTokenValueImpl()
333 int right = nodes.size() - 1; in FindLeftToken()
336 int mid = left + (right - left) / 2; in FindLeftToken()
337 if (nodes[mid]->End().index <= pos) { in FindLeftToken()
341 right = mid - 1; in FindLeftToken()
350 int right = nodes.size() - 1; in FindRightToken()
353 int mid = left + (right - left) / 2; in FindRightToken()
354 if (nodes[mid]->Start().index > pos) { in FindRightToken()
356 right = mid - 1; in FindRightToken()
401 result->pos_ = range.pos_; in GetRangeOfCommentFromContext()
402 result->kind_ = range.kind_; in GetRangeOfCommentFromContext()
403 result->end_ = range.end_; in GetRangeOfCommentFromContext()
416 auto ast = reinterpret_cast<ir::AstNode *>(ctx->parserProgram->Ast()); in GetRangeOfEnclosingComment()
418 auto children = GetChildren(parent, ctx->allocator); in GetRangeOfEnclosingComment()
420 if (a->Start().index < b->Start().index) { in GetRangeOfEnclosingComment()
423 if (a->Start().index == b->Start().index) { in GetRangeOfEnclosingComment()
424 return a->End().index < b->End().index; in GetRangeOfEnclosingComment()
430 size_t leftPos = leftToken != nullptr ? leftToken->End().index : parent->Start().index; in GetRangeOfEnclosingComment()
431 size_t rightPos = rightToken != nullptr ? rightToken->Start().index : parent->End().index; in GetRangeOfEnclosingComment()
432 std::string sourceCode(ctx->parserProgram->SourceCode()); in GetRangeOfEnclosingComment()
451 auto uri = ctx->sourceFileName; in SaveNode()
452 auto start = node->Range().start.index; in SaveNode()
453 auto end = node->Range().end.index; in SaveNode()
454 auto accessKind = node->IsReadonly() ? AccessKind::READ : AccessKind::WRITE; in SaveNode()
455 auto isDefinition = node->IsClassDefinition() && node->IsMethodDefinition(); in SaveNode()
456 auto isImport = node->IsImportDeclaration(); in SaveNode()
459 std::find_if(result->referenceLocation.begin(), result->referenceLocation.end(), in SaveNode()
461 if (it == result->referenceLocation.end()) { in SaveNode()
462 result->referenceLocation.push_back(ref); in SaveNode()
468 if (!node->IsIdentifier()) { in GetIdentifier()
469 return node->FindChild([](ir::AstNode *node1) { return node1->IsIdentifier(); }); in GetIdentifier()
480 return std::string {id->AsIdentifier()->Name()}; in GetIdentifierName()
489 auto var = id->AsIdentifier()->Variable(); in GetOwner()
493 auto decl = id->AsIdentifier()->Variable()->Declaration(); in GetOwner()
497 return decl->Node(); in GetOwner()
506 return owner->DumpJSON(); in GetOwnerId()
528 …if (error->Type() == util::DiagnosticType::PLUGIN_ERROR || error->Type() == util::DiagnosticType::… in CreateCodeForDiagnostic()
537 auto index = lexer::LineIndex(ctx->parserProgram->SourceCode()); in CreateDiagnosticForError()
538 … offset = index.GetOffset(lexer::SourceLocation(error.Line(), error.Offset(), ctx->parserProgram)); in CreateDiagnosticForError()
545 … sourceStartLocation = lexer::SourceLocation(error.Line(), error.Offset(), ctx->parserProgram); in CreateDiagnosticForError()
546 sourceEndLocation = lexer::SourceLocation(error.Line(), error.Offset(), ctx->parserProgram); in CreateDiagnosticForError()
549 sourceRange = touchingToken->Range(); in CreateDiagnosticForError()
552 source = touchingToken->DumpEtsSrc(); in CreateDiagnosticForError()
580 …const auto &diagnostics = ctx->diagnosticEngine->GetDiagnosticStorage(util::DiagnosticType::FATAL); in GetGlobalDiagnostics()
582 if (diagnostic->File().empty()) { in GetGlobalDiagnostics()
593 …const auto &diagnostics = ctx->diagnosticEngine->GetDiagnosticStorage(util::DiagnosticType::ARKTS_… in GetOptionDiagnostics()
603 return astNode->Start().index; in GetTokenPosOfNode()
613 if (node->IsCallExpression()) { in GetDefinitionAtPositionImpl()
614 node = node->AsCallExpression()->Callee()->AsIdentifier(); in GetDefinitionAtPositionImpl()
616 if (!node->IsIdentifier()) { in GetDefinitionAtPositionImpl()
619 res = {compiler::DeclarationFromIdentifier(node->AsIdentifier()), node->AsIdentifier()->Name()}; in GetDefinitionAtPositionImpl()
626 return std::hash<int>()(node->Start().index) ^ std::hash<int>()(node->End().index); in RemoveRefDuplicates()
629 return lhs->Start().index == rhs->Start().index && lhs->End().index == rhs->End().index; in RemoveRefDuplicates()
633 nodes.size(), hashFunc, equalFunc, allocator->Adapter()); in RemoveRefDuplicates()
638 return ArenaVector<ir::AstNode *>(uniqueNodes.begin(), uniqueNodes.end(), allocator->Adapter()); in RemoveRefDuplicates()
647 ast->Iterate([&results, cb](ir::AstNode *child) { FindAllChildHelper(child, cb, results); }); in FindAllChildHelper()
652 ast->Iterate([&results, cb](ir::AstNode *child) { FindAllChildHelper(child, cb, results); }); in FindAllChild()
661 node = node->Parent(); in FindAncestor()
669 ASSERT(node->IsIdentifier()); in FindReferencesByName()
670 auto name = node->AsIdentifier()->Name(); in FindReferencesByName()
672 …return child->IsIdentifier() && compiler::DeclarationFromIdentifier(child->AsIdentifier()) == decl… in FindReferencesByName()
673 child->AsIdentifier()->Name() == name; in FindReferencesByName()
675 auto references = ArenaVector<ir::AstNode *>(allocator->Adapter()); in FindReferencesByName()
680 return (a->Start().index != b->Start().index) ? a->Start().index < b->Start().index in FindReferencesByName()
681 : a->End().index < b->End().index; in FindReferencesByName()
688 if (identifierDeclaration->Start().index == node->Start().index && in GetHightlightSpanKind()
689 identifierDeclaration->End().index == node->End().index) { in GetHightlightSpanKind()
698 std::string fileName(ctx->sourceFile->filePath); in GetSemanticDocumentHighlights()
700 if (!touchingToken->IsIdentifier()) { in GetSemanticDocumentHighlights()
703 auto decl = compiler::DeclarationFromIdentifier(touchingToken->AsIdentifier()); in GetSemanticDocumentHighlights()
707 …auto references = FindReferencesByName(ctx->parserProgram->Ast(), decl, touchingToken, ctx->alloca… in GetSemanticDocumentHighlights()
711 ir::AstNode *identifierDeclaration = decl->FindChild([&touchingToken](ir::AstNode *child) { in GetSemanticDocumentHighlights()
712 …return child->IsIdentifier() && child->AsIdentifier()->Name() == touchingToken->AsIdentifier()->Na… in GetSemanticDocumentHighlights()
715 auto start = reference->Start().index; in GetSemanticDocumentHighlights()
716 auto length = reference->AsIdentifier()->Name().Length(); in GetSemanticDocumentHighlights()
719 auto kind = GetHightlightSpanKind(identifierDeclaration, reference->AsIdentifier()); in GetSemanticDocumentHighlights()