lingua-franca 0.10.1
Lingua Franca code generator
Loading...
Searching...
No Matches
org.lflang.generator.MainContext Class Reference

An LFGeneratorContext that is not nested in any other generator context. More...

Inherits org.lflang.generator.LFGeneratorContext.

Public Member Functions

default void finish (GeneratorResult.Status status, Map< Path, CodeMap > codeMaps)
 Conclude this build and record the result if necessary.
void finish (GeneratorResult result)
 Mark the code generation process performed in this context as finished with the result result.
GeneratorArguments getArgs ()
 Return any arguments that will override target properties.
CancelIndicator getCancelIndicator ()
MessageReporter getErrorReporter ()
 Get the error reporter for this context; construct one if it hasn't been constructed yet.
FileConfig getFileConfig ()
Mode getMode ()
 Return the mode of operation, which indicates how the compiler has been invoked (e.g., from within Epoch, from the command line, or via a Language Server).
GeneratorResult getResult ()
 Return the result of the code generation process that was performed in this context.
TargetConfig getTargetConfig ()
default boolean isCleanRequested ()
 Return true if the user requested a clean build in this context.
void loadTargetConfig ()
 Load the target configuration based on the contents of the resource.
 MainContext (Mode mode, CancelIndicator cancelIndicator, ReportProgress reportProgress, GeneratorArguments args, Resource resource, IFileSystemAccess2 fsa, Function< FileConfig, MessageReporter > constructErrorReporter)
 Initialize the context of a build process whose cancellation is indicated by cancelIndicator.
 MainContext (Mode mode, Resource resource, IFileSystemAccess2 fsa, CancelIndicator cancelIndicator)
 Initialize the context of a build process whose cancellation is indicated by cancelIndicator.
void reportProgress (String message, int percentage)
 Report the progress of a build.
default void unsuccessfulFinish ()
 Conclude this build and record that it was unsuccessful.

Static Public Member Functions

static LFGeneratorContext lfGeneratorContextOf (Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context)
 Return the LFGeneratorContext that best describes the given context when building Resource.

Static Public Attributes

static Function< FileConfig, MessageReporterEPOCH_ERROR_REPORTER_CONSTRUCTOR = null
 This constructor will be set by the LF plugin, if the generator is running in Epoch.

Detailed Description

An LFGeneratorContext that is not nested in any other generator context.

There is one MainContext for every build process.

Author
Peter Donovan

Constructor & Destructor Documentation

◆ MainContext() [1/2]

org.lflang.generator.MainContext.MainContext ( Mode mode,
Resource resource,
IFileSystemAccess2 fsa,
CancelIndicator cancelIndicator )

Initialize the context of a build process whose cancellation is indicated by cancelIndicator.

Parameters
modeThe mode of this build process.
resourceThe resource being processed.
fsaThe file system access.
cancelIndicatorThe cancel indicator of the code generation process to which this corresponds.

◆ MainContext() [2/2]

org.lflang.generator.MainContext.MainContext ( Mode mode,
CancelIndicator cancelIndicator,
ReportProgress reportProgress,
GeneratorArguments args,
Resource resource,
IFileSystemAccess2 fsa,
Function< FileConfig, MessageReporter > constructErrorReporter )

Initialize the context of a build process whose cancellation is indicated by cancelIndicator.

Parameters
modeThe mode of this build process.
cancelIndicatorThe cancel indicator of the code generation process to which this corresponds.
reportProgressThe ReportProgress function of this.
argsAny arguments that may be used to affect the product of the build.
resource...
fsa...
constructErrorReporterA function that constructs the appropriate error reporter for the given FileConfig.

Member Function Documentation

◆ finish() [1/2]

default void org.lflang.generator.LFGeneratorContext.finish ( GeneratorResult.Status status,
Map< Path, CodeMap > codeMaps )
inherited

Conclude this build and record the result if necessary.

Parameters
statusThe status of the result.
codeMapsThe generated files and their corresponding code maps.

◆ finish() [2/2]

void org.lflang.generator.MainContext.finish ( GeneratorResult result)

Mark the code generation process performed in this context as finished with the result result.

Parameters
resultThe result of the code generation process that was performed in this context.

Implements org.lflang.generator.LFGeneratorContext.

◆ getArgs()

GeneratorArguments org.lflang.generator.MainContext.getArgs ( )

Return any arguments that will override target properties.

Implements org.lflang.generator.LFGeneratorContext.

◆ getCancelIndicator()

CancelIndicator org.lflang.generator.MainContext.getCancelIndicator ( )

◆ getErrorReporter()

MessageReporter org.lflang.generator.MainContext.getErrorReporter ( )

Get the error reporter for this context; construct one if it hasn't been constructed yet.

Implements org.lflang.generator.LFGeneratorContext.

◆ getFileConfig()

FileConfig org.lflang.generator.MainContext.getFileConfig ( )

◆ getMode()

Mode org.lflang.generator.MainContext.getMode ( )

Return the mode of operation, which indicates how the compiler has been invoked (e.g., from within Epoch, from the command line, or via a Language Server).

Implements org.lflang.generator.LFGeneratorContext.

◆ getResult()

GeneratorResult org.lflang.generator.MainContext.getResult ( )

Return the result of the code generation process that was performed in this context.

Returns
the result of the code generation process that was performed in this context

Implements org.lflang.generator.LFGeneratorContext.

◆ getTargetConfig()

TargetConfig org.lflang.generator.MainContext.getTargetConfig ( )

◆ isCleanRequested()

default boolean org.lflang.generator.LFGeneratorContext.isCleanRequested ( )
inherited

Return true if the user requested a clean build in this context.

Implemented in org.lflang.generator.SubContext.

◆ lfGeneratorContextOf()

LFGeneratorContext org.lflang.generator.LFGeneratorContext.lfGeneratorContextOf ( Resource resource,
IFileSystemAccess2 fsa,
IGeneratorContext context )
staticinherited

Return the LFGeneratorContext that best describes the given context when building Resource.

Parameters
resource
fsa
contextThe context of a Lingua Franca build process.
Returns
The LFGeneratorContext that best describes the given context when building Resource.

◆ loadTargetConfig()

void org.lflang.generator.MainContext.loadTargetConfig ( )

Load the target configuration based on the contents of the resource.

This is done automatically upon instantiation of the context, but in case the resource changes (e.g., due to an AST transformation), this method can be called to reload to ensure that the changes are reflected in the target configuration.

◆ reportProgress()

void org.lflang.generator.MainContext.reportProgress ( String message,
int percentage )

Report the progress of a build.

Parameters
messageA message for the LF programmer to read.
percentageThe approximate percent completion of the build.

Implements org.lflang.generator.LFGeneratorContext.

◆ unsuccessfulFinish()

default void org.lflang.generator.LFGeneratorContext.unsuccessfulFinish ( )
inherited

Conclude this build and record that it was unsuccessful.

Member Data Documentation

◆ EPOCH_ERROR_REPORTER_CONSTRUCTOR

Function<FileConfig, MessageReporter> org.lflang.generator.MainContext.EPOCH_ERROR_REPORTER_CONSTRUCTOR = null
static

This constructor will be set by the LF plugin, if the generator is running in Epoch.


The documentation for this class was generated from the following file:
  • /Users/runner/work/lingua-franca/lingua-franca/core/src/main/java/org/lflang/generator/MainContext.java