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

A validator for generated Python code. More...

Inherits org.lflang.generator.Validator.

Public Member Functions

final void doValidate (LFGeneratorContext context) throws ExecutionException, InterruptedException
 Validate this Validator's group of generated files.
 PythonValidator (FileConfig fileConfig, MessageReporter messageReporter, Map< Path, CodeMap > codeMaps, Set< String > protoNames)
 Initialize a PythonValidator for a build process using fileConfig and report errors to errorReporter.
final int run (LFCommand command, CancelIndicator cancelIndicator)
 Run the given command, report any messages produced using the reporting strategies given by getBuildReportingStrategies, and return its return code.

Protected Member Functions

Pair< Strategy, StrategygetBuildReportingStrategies ()
 Return the appropriate output and error reporting strategies for the main build process.
Collection< ValidationStrategygetPossibleStrategies ()
 List all validation strategies that exist for the Python validator.
boolean validationEnabledByDefault (LFGeneratorContext context)
 Return whether validation of generated code is enabled by default.

Detailed Description

A validator for generated Python code.

Author
Peter Donovan

Constructor & Destructor Documentation

◆ PythonValidator()

org.lflang.generator.python.PythonValidator.PythonValidator ( FileConfig fileConfig,
MessageReporter messageReporter,
Map< Path, CodeMap > codeMaps,
Set< String > protoNames )

Initialize a PythonValidator for a build process using fileConfig and report errors to errorReporter.

Parameters
fileConfigThe file configuration of this build.
messageReporterThe reporter to which diagnostics should be sent.
codeMapsA mapping from generated file paths to code maps that map them back to LF sources.
protoNamesThe names of any protocol buffer message types that are used in the LF program being built.

Member Function Documentation

◆ doValidate()

final void org.lflang.generator.Validator.doValidate ( LFGeneratorContext context) throws ExecutionException, InterruptedException
inherited

Validate this Validator's group of generated files.

Parameters
contextThe context of the current build.

◆ getBuildReportingStrategies()

Pair< Strategy, Strategy > org.lflang.generator.python.PythonValidator.getBuildReportingStrategies ( )
protected

Return the appropriate output and error reporting strategies for the main build process.

Reimplemented from org.lflang.generator.Validator.

◆ getPossibleStrategies()

Collection< ValidationStrategy > org.lflang.generator.python.PythonValidator.getPossibleStrategies ( )
protected

List all validation strategies that exist for the Python validator.

Returns
A collection of validation strategies.

Try to report a typical error message from the Python compiler.

Parameters
linesThe lines of output from the compiler.
iThe current index at which a message may start. Guaranteed to be less than lines.length - 3.
Returns
Whether an error message was reported.

Try to report an alternative error message from the Python compiler.

Parameters
linesThe lines of output from the compiler.
iThe current index at which a message may start.

Return whether the given message should be ignored.

Parameters
messageA Pylint message that is a candidate to be reported.
Returns
whether message should be reported.

Make a best-effort attempt to place the diagnostic on the correct line.

Reimplemented from org.lflang.generator.Validator.

◆ run()

final int org.lflang.generator.Validator.run ( LFCommand command,
CancelIndicator cancelIndicator )
inherited

Run the given command, report any messages produced using the reporting strategies given by getBuildReportingStrategies, and return its return code.

◆ validationEnabledByDefault()

boolean org.lflang.generator.Validator.validationEnabledByDefault ( LFGeneratorContext context)
protectedinherited

Return whether validation of generated code is enabled by default.

Parameters
contextThe context of the current build.
Returns
Whether validation of generated code is enabled by default.

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/python/PythonValidator.java