• Home
  • Raw
  • Download

Lines Matching +full:parserprogram +full:-

7  * http://www.apache.org/licenses/LICENSE-2.0
68 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) in StrToToken()
69 for (auto *tp = table; tp->str != nullptr; tp++) { in StrToToken()
70 if (strcmp(str, tp->str) == 0) { in StrToToken()
71 return tp->token; in StrToToken()
79 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) in TokenToStr()
80 for (auto *tp = table; tp->str != nullptr; tp++) { in TokenToStr()
81 if (tp->token == token) { in TokenToStr()
82 return tp->str; in TokenToStr()
90 …// NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-exp… in StringViewToCString()
96 char *res = reinterpret_cast<char *>(allocator->Alloc(utf8.size() + 1)); in StringViewToCString()
101 … // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) in StringViewToCString()
106 …// NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-exp… in StringViewToCString()
111 char *res = reinterpret_cast<char *>(allocator->Alloc(utf8.size() + 1)); in StringViewToCString()
116 … // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) in StringViewToCString()
121 …// NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-exp… in StdStringToCString()
122 char *res = reinterpret_cast<char *>(allocator->Alloc(str.length() + 1)); in StdStringToCString()
126 … // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) in StdStringToCString()
137 // NOLINTBEGIN(cppcoreguidelines-pro-type-union-access) in EnumMemberResultToEs2pandaVariant()
138 …// NOLINTBEGIN(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-exp… in EnumMemberResultToEs2pandaVariant()
155 … // NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, readability-simplify-subscript-expr) in EnumMemberResultToEs2pandaVariant()
156 // NOLINTEND(cppcoreguidelines-pro-type-union-access) in EnumMemberResultToEs2pandaVariant()
162 auto import = reinterpret_cast<const es2panda_AstNode *>(dynamicImportData->import); in DynamicImportDataToE2p()
163 auto specifier = reinterpret_cast<const es2panda_AstNode *>(dynamicImportData->specifier); in DynamicImportDataToE2p()
164 auto variable = reinterpret_cast<es2panda_Variable *>(dynamicImportData->variable); in DynamicImportDataToE2p()
165 auto es2pandaDynamicImportData = allocator->New<es2panda_DynamicImportData>(); in DynamicImportDataToE2p()
166 es2pandaDynamicImportData->import = import; in DynamicImportDataToE2p()
167 es2pandaDynamicImportData->specifier = specifier; in DynamicImportDataToE2p()
168 es2pandaDynamicImportData->variable = variable; in DynamicImportDataToE2p()
188 char *res = reinterpret_cast<char *>(allocator->Alloc(len + 1)); in ArenaStrdup()
192 // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) in ArenaStrdup()
205 if (!options->Parse(args, argv)) { in CreateConfig()
207 std::cerr << options->ErrorMsg() << std::endl; in CreateConfig()
212 Logger::InitializeStdLogging(Logger::LevelFromString(options->LogLevel()), mask); in CreateConfig()
215 res->options = options; in CreateConfig()
229 delete cfg->options; in DestroyConfig()
249 res->input = source; in CreateContext()
250 res->sourceFileName = fileName; in CreateContext()
251 res->config = cfg; in CreateContext()
254 … res->sourceFile = new SourceFile(res->sourceFileName, res->input, cfg->options->ParseModule()); in CreateContext()
255 res->allocator = new ArenaAllocator(SpaceType::SPACE_TYPE_COMPILER, nullptr, true); in CreateContext()
256 res->queue = new compiler::CompileQueue(cfg->options->ThreadCount()); in CreateContext()
258 auto *varbinder = res->allocator->New<varbinder::ETSBinder>(res->allocator); in CreateContext()
259 res->parserProgram = new parser::Program(res->allocator, varbinder); in CreateContext()
260 res->parserProgram->MarkEntry(); in CreateContext()
261 res->parser = in CreateContext()
262 …new parser::ETSParser(res->parserProgram, cfg->options->CompilerOptions(), parser::ParserStatus::N… in CreateContext()
263 res->checker = new checker::ETSChecker(); in CreateContext()
264 res->checker->ErrorLogger()->SetOstream(nullptr); in CreateContext()
265 res->analyzer = new checker::ETSAnalyzer(res->checker); in CreateContext()
266 res->checker->SetAnalyzer(res->analyzer); in CreateContext()
268 varbinder->SetProgram(res->parserProgram); in CreateContext()
270 varbinder->SetContext(res); in CreateContext()
271 res->codeGenCb = CompileJob; in CreateContext()
272 res->phases = compiler::GetPhaseList(ScriptExtension::ETS); in CreateContext()
273 res->currentPhase = 0; in CreateContext()
274 res->emitter = new compiler::ETSEmitter(res); in CreateContext()
275 res->program = nullptr; in CreateContext()
276 res->state = ES2PANDA_STATE_NEW; in CreateContext()
280 res->errorMessage = ss.str(); in CreateContext()
281 res->state = ES2PANDA_STATE_ERROR; in CreateContext()
293 res->errorMessage = "Failed to open file: "; in CreateContextFromFile()
294 res->errorMessage.append(sourceFileName); in CreateContextFromFile()
301 res->errorMessage = "Failed to read file: "; in CreateContextFromFile()
302 res->errorMessage.append(sourceFileName); in CreateContextFromFile()
317 if (ctx->state != ES2PANDA_STATE_NEW) { in Parse()
318 ctx->state = ES2PANDA_STATE_ERROR; in Parse()
319 ctx->errorMessage = "Bad state at entry to Parse, needed NEW"; in Parse()
325 ctx->errorMessage = ss.str(); in Parse()
326 ctx->state = ES2PANDA_STATE_ERROR; in Parse()
330 …ctx->parser->ParseScript(*ctx->sourceFile, ctx->config->options->CompilerOptions().compilationMode… in Parse()
332 ctx->state = ES2PANDA_STATE_PARSED; in Parse()
333 if (ctx->parser->ErrorLogger()->IsAnyError()) { in Parse()
334 handleError(ctx->parser->ErrorLogger()->Log()[0]); in Parse()
339 ctx->errorMessage = ss.str(); in Parse()
340 ctx->state = ES2PANDA_STATE_ERROR; in Parse()
349 if (ctx->state < ES2PANDA_STATE_PARSED) { in InitScopes()
352 if (ctx->state == ES2PANDA_STATE_ERROR) { in InitScopes()
356 ASSERT(ctx->state == ES2PANDA_STATE_PARSED); in InitScopes()
360 if (ctx->currentPhase >= ctx->phases.size()) { in InitScopes()
363 ctx->phases[ctx->currentPhase]->Apply(ctx, ctx->parserProgram); in InitScopes()
364 } while (ctx->phases[ctx->currentPhase++]->Name() != compiler::ScopesInitPhase::NAME); in InitScopes()
365 ctx->state = ES2PANDA_STATE_SCOPE_INITED; in InitScopes()
369 ctx->errorMessage = ss.str(); in InitScopes()
370 ctx->state = ES2PANDA_STATE_ERROR; in InitScopes()
377 if (ctx->state < ES2PANDA_STATE_PARSED) { in Check()
381 if (ctx->state == ES2PANDA_STATE_ERROR) { in Check()
385 ASSERT(ctx->state >= ES2PANDA_STATE_PARSED && ctx->state < ES2PANDA_STATE_CHECKED); in Check()
390 ctx->errorMessage = ss.str(); in Check()
391 ctx->state = ES2PANDA_STATE_ERROR; in Check()
396 if (ctx->currentPhase >= ctx->phases.size()) { in Check()
400 ctx->phases[ctx->currentPhase]->Apply(ctx, ctx->parserProgram); in Check()
401 } while (ctx->phases[ctx->currentPhase++]->Name() != compiler::CheckerPhase::NAME); in Check()
402 if (ctx->checker->ErrorLogger()->IsAnyError()) { in Check()
403 handleError(ctx->checker->ErrorLogger()->Log()[0]); in Check()
404 } else if (ctx->parser->ErrorLogger()->IsAnyError()) { in Check()
405 handleError(ctx->parser->ErrorLogger()->Log()[0]); in Check()
407 ctx->state = ES2PANDA_STATE_CHECKED; in Check()
417 if (ctx->state < ES2PANDA_STATE_CHECKED) { in Lower()
421 if (ctx->state == ES2PANDA_STATE_ERROR) { in Lower()
425 ASSERT(ctx->state == ES2PANDA_STATE_CHECKED); in Lower()
428 while (ctx->currentPhase < ctx->phases.size()) { in Lower()
429 ctx->phases[ctx->currentPhase++]->Apply(ctx, ctx->parserProgram); in Lower()
432 ctx->state = ES2PANDA_STATE_LOWERED; in Lower()
436 ctx->errorMessage = ss.str(); in Lower()
437 ctx->state = ES2PANDA_STATE_ERROR; in Lower()
445 if (ctx->state < ES2PANDA_STATE_LOWERED) { in GenerateAsm()
449 if (ctx->state == ES2PANDA_STATE_ERROR) { in GenerateAsm()
453 ASSERT(ctx->state == ES2PANDA_STATE_LOWERED); in GenerateAsm()
455 auto *emitter = ctx->emitter; in GenerateAsm()
457 emitter->GenAnnotation(); in GenerateAsm()
461 for (const auto &buff : ctx->contextLiterals) { in GenerateAsm()
462 emitter->AddLiteralBuffer(buff, index++); in GenerateAsm()
465 emitter->LiteralBufferIndex() += ctx->contextLiterals.size(); in GenerateAsm()
468 ctx->queue->Schedule(ctx); in GenerateAsm()
469 ctx->queue->Consume(); in GenerateAsm()
470 ctx->queue->Wait( in GenerateAsm()
471 … [emitter](compiler::CompileJob *job) { emitter->AddProgramElement(job->GetProgramElement()); }); in GenerateAsm()
472 ASSERT(ctx->program == nullptr); in GenerateAsm()
473 ctx->program = in GenerateAsm()
474 …emitter->Finalize(ctx->config->options->CompilerOptions().dumpDebugInfo, compiler::Signatures::ETS… in GenerateAsm()
476 ctx->state = ES2PANDA_STATE_ASM_GENERATED; in GenerateAsm()
480 ctx->errorMessage = ss.str(); in GenerateAsm()
481 ctx->state = ES2PANDA_STATE_ERROR; in GenerateAsm()
488 if (ctx->state < ES2PANDA_STATE_ASM_GENERATED) { in GenerateBin()
492 if (ctx->state == ES2PANDA_STATE_ERROR) { in GenerateBin()
496 ASSERT(ctx->state == ES2PANDA_STATE_ASM_GENERATED); in GenerateBin()
499 ASSERT(ctx->program != nullptr); in GenerateBin()
500 util::GenerateProgram(ctx->program, ctx->config->options, in GenerateBin()
501 [ctx](const std::string &str) { ctx->errorMessage = str; }); in GenerateBin()
503 ctx->state = ES2PANDA_STATE_BIN_GENERATED; in GenerateBin()
507 ctx->errorMessage = ss.str(); in GenerateBin()
508 ctx->state = ES2PANDA_STATE_ERROR; in GenerateBin()
539 ctx->errorMessage = "It does not make sense to request stage"; in ProceedToState()
540 ctx->state = ES2PANDA_STATE_ERROR; in ProceedToState()
549 delete ctx->program; in DestroyContext()
550 delete ctx->emitter; in DestroyContext()
551 delete ctx->analyzer; in DestroyContext()
552 delete ctx->checker; in DestroyContext()
553 delete ctx->parser; in DestroyContext()
554 delete ctx->parserProgram; in DestroyContext()
555 delete ctx->queue; in DestroyContext()
556 delete ctx->allocator; in DestroyContext()
557 delete ctx->sourceFile; in DestroyContext()
564 return s->state; in ContextState()
570 return s->errorMessage.c_str(); in ContextErrorMessage()
576 return reinterpret_cast<es2panda_Program *>(ctx->parserProgram); in ContextProgram()
582 return reinterpret_cast<es2panda_AstNode *>(pgm->Ast()); in ProgramAst()
591 auto *allocator = pgm->VarBinder()->Allocator(); in ProgramExternalSources()
592 auto *vec = allocator->New<ArenaVector<ExternalSourceEntry *>>(allocator->Adapter()); in ProgramExternalSources()
594 for (auto &[e_name, e_programs] : pgm->ExternalSources()) { in ProgramExternalSources()
595 …vec->push_back(allocator->New<ExternalSourceEntry>(StringViewToCString(allocator, e_name), &e_prog… in ProgramExternalSources()
598 *lenP = vec->size(); in ProgramExternalSources()
599 return reinterpret_cast<es2panda_ExternalSource **>(vec->data()); in ProgramExternalSources()
605 return entry->first; in ExternalSourceName()
612 *lenP = entry->second->size(); in ExternalSourcePrograms()
613 return reinterpret_cast<es2panda_Program **>(entry->second->data()); in ExternalSourcePrograms()
620 …node->IterateRecursively([=](ir::AstNode *child) { func(reinterpret_cast<es2panda_AstNode *>(child… in AstNodeForEach()
626 auto &n = reinterpret_cast<ir::NumberLiteral *>(node)->Number(); \
628 /* CC-OFFNXT(G.PRE.05) function gen */ \
632 /* CC-OFFNXT(G.PRE.05) The macro is used to generate a function. */ \
645 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in SET_NUMBER_LITERAL_IMPL()
646 void *ptr = allocator->Alloc(numberOfElements * sizeOfElement); in SET_NUMBER_LITERAL_IMPL()
652 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in CreateSourcePosition()
653 …return reinterpret_cast<es2panda_SourcePosition *>(allocator->New<lexer::SourcePosition>(index, li… in CreateSourcePosition()
659 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in CreateSourceRange()
662 …return reinterpret_cast<es2panda_SourceRange *>(allocator->New<lexer::SourceRange>(startE2p, endE2… in CreateSourceRange()
667 return reinterpret_cast<lexer::SourcePosition *>(position)->index; in SourcePositionIndex()
672 return reinterpret_cast<lexer::SourcePosition *>(position)->line; in SourcePositionLine()
678 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in SourceRangeStart()
680 …urn reinterpret_cast<es2panda_SourcePosition *>(allocator->New<lexer::SourcePosition>(E2pRange->st… in SourceRangeStart()
686 auto *allocator = reinterpret_cast<Context *>(context)->allocator; in SourceRangeEnd()
688 …urn reinterpret_cast<es2panda_SourcePosition *>(allocator->New<lexer::SourcePosition>(E2pRange->en… in SourceRangeEnd()