raesl.compile.diagnostics#

ESL compiler Diagnostics.

Diagnostic code scheme:

Severity:

E###: ERROR W###: WARNING I###: INFO H###: HINT

Origin:

#000: General #100: Scanning/Parsing #200: Typechecking #300: AST Builder #400: Instance/output builder

Module Contents#

Classes#

EslDiagnostic

An unscoped diagnostic as ESL works with multiple text documents at once.

DiagnosticStore

Storage of found diagnostics.

Functions#

E100() → EslDiagnostic)

Unexpected end of the specification.

E101() → EslDiagnostic)

Best line match is ambiguous. Found multiple acceptors: {ambi_acceptors}. This

E102() → EslDiagnostic)

Syntax error.

E200(, dupes)

Multiple {kind} named '{name}'.

E201() → EslDiagnostic)

This '{section}' section is not allowed in the '{context}' context.

E202() → EslDiagnostic)

Missing {kind} for '{name}'.

E203() → EslDiagnostic)

Unknown {kind} named '{name}'.

E204(name, kind[, location, cycle])

Cyclically dependent {kind} named '{name}'.

E205() → EslDiagnostic)

Cannot find {name} in {context}.

E206(, blocks)

Found {kind} block(s), but the relation definition {name} has no such

E207(, definition)

Relation instance '{name}' is missing a '{kind}' parameters section.

E208(, definition)

Relation instance '{name}' is missing at least {num} '{kind}' parameters.

E209(, others)

'{name}' is both a {kind} and a {other_kind}.

E210(→ EslDiagnostic)

Values cannot be compared, they {reason}.

E211() → EslDiagnostic)

Unsupported verb-preposition combination '{verb} {preposition}'.

E212() → EslDiagnostic)

{kind.capitalize()} '{name}' uses '{value}', but should use {allowed}.

E213(, occurrences)

Found {num} {kind}(s), but there should be {allowed}.

E214(, def_location)

Definition of type '{name}' failed with an error.

E215() → EslDiagnostic)

Type name '{name}' must be the name of an elementary type.

E216() → EslDiagnostic)

Unit '{name}' should not have square brackets around it's name.

E217() → EslDiagnostic)

The dimensionless unit '-' is not allowed to be specified explicitly.

E218() → EslDiagnostic)

Standard type '{name}' cannot be overridden.

E219() → EslDiagnostic)

Unit '{name}' is not allowed here.

E220() → EslDiagnostic)

Element '{name}' does not match with a {kind}.

E221(, references)

Number of {kind}s does not match. Found {num}, expected {expected}.

E222(, other_loc)

Value '{name}' has additional value restrictions relative to '{other}'.

E223(, other_loc)

'{name}' is not a {kind} of {other}.

E224() → EslDiagnostic)

{kind.capitalize()}s do not support {unsupported}.

E225() → EslDiagnostic)

Cannot resolve '.{part}' part of the '{first_part}' {kind}.

E226() → EslDiagnostic)

Need '{name}' is not allowed to reference a bundle.

E227(, dupes)

Multiple identifier '{name}' within '{cdef_name}'.

E228(→ EslDiagnostic)

Values cannot be compared, design rule {reason}.

E400(, owners)

Elementary variable value '{name}' has more than one property owner.

W200(, dupes)

{kind.capitalize()} '{name}' has been specified multiple times.

W300(, comments)

Documentation comment(s) could not be assigned to '{element}'.

Attributes#

ERROR

WARN

INFO

HINT

_NON_SEVERE

EslRelated

raesl.compile.diagnostics.ERROR#
raesl.compile.diagnostics.WARN#
raesl.compile.diagnostics.INFO#
raesl.compile.diagnostics.HINT#
raesl.compile.diagnostics._NON_SEVERE#
raesl.compile.diagnostics.EslRelated#
class raesl.compile.diagnostics.EslDiagnostic(message: str, location: raesl.types.Location = utils.get_location(), severity: raesl.types.DiagnosticSeverity = ERROR, code: str = 'E100', source: str = 'RaESL compiler', related_information: List[raesl.types.DiagnosticRelatedInformation] = None)#

Bases: raesl.types.Diagnostic

An unscoped diagnostic as ESL works with multiple text documents at once.

Parameters:
  • message – The diagnostic’s message.

  • location – The location at which the message applies.

  • severity – The diagnostic’s severity. Can be omitted. If omitted it is up to the client to interpret diagnostics as error, warning, info or hint.

  • code – The diagnostic’s code, which might appear in the user interface.

  • source – A human-readable string describing the source of this diagnostic, e.g. ‘esl’, or ‘esl compiler’.

  • related_information – A list of related diagnostic information, e.g. when symbol-names within a scope collide you can mark all definitions via this property.

range#

The range at which the message applies.

__repr__()#

Return repr(self).

__str__()#

Return str(self).

_print(style=repr)#
class raesl.compile.diagnostics.DiagnosticStore(severity: raesl.types.DiagnosticSeverity = ERROR, exit: bool = False)#

Storage of found diagnostics.

diagnostics#

Stored diagnostics.

severity#

What diagnostics to log.

exit#

Exit on error.

add(diagnostic: EslDiagnostic)#

Add a diagnostic. Report directly if below severity threshold.

report(diagnostic: EslDiagnostic)#

Report a single diagnostic.

dump(test: bool = False, stream: IO[str] | None = None)#

Dump all stored diagnostics to the given stream.

Parameters:
  • test – Whether to output in test mode (otherwise: user-friendly).

  • stream – Output stream to use. Defaults to stdout.

has_severe() bool#

Whether there are severe diagnostics stored.

raesl.compile.diagnostics.E100(location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Unexpected end of the specification.

raesl.compile.diagnostics.E101(acceptors: Iterable[str], location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Best line match is ambiguous. Found multiple acceptors: {ambi_acceptors}. This is an internal error.

raesl.compile.diagnostics.E102(location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Syntax error.

raesl.compile.diagnostics.E200(name: str, kind: str, location: raesl.types.Location = utils.get_location(), dupes: List[raesl.types.Location] | None = None) EslDiagnostic#

Multiple {kind} named ‘{name}’.

raesl.compile.diagnostics.E201(section: str, context: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

This ‘{section}’ section is not allowed in the ‘{context}’ context.

raesl.compile.diagnostics.E202(kind: str, name: str | None = None, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Missing {kind} for ‘{name}’.

raesl.compile.diagnostics.E203(kind: str, name: str | None = None, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Unknown {kind} named ‘{name}’.

raesl.compile.diagnostics.E204(name: str, kind: str, location: raesl.types.Location = utils.get_location(), cycle: List[raesl.types.Location] | None = None)#

Cyclically dependent {kind} named ‘{name}’.

raesl.compile.diagnostics.E205(name: str, context: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Cannot find {name} in {context}.

raesl.compile.diagnostics.E206(name: str, kind: str, location: raesl.types.Location = utils.get_location(), blocks: List[raesl.types.Location] | None = None) EslDiagnostic#

Found {kind} block(s), but the relation definition {name} has no such parameters.

raesl.compile.diagnostics.E207(name: str, kind: str, location: raesl.types.Location = utils.get_location(), definition: raesl.types.Location = utils.get_location()) EslDiagnostic#

Relation instance ‘{name}’ is missing a ‘{kind}’ parameters section.

raesl.compile.diagnostics.E208(name: str, kind: str, num: int, location: raesl.types.Location = utils.get_location(), definition: raesl.types.Location = utils.get_location()) EslDiagnostic#

Relation instance ‘{name}’ is missing at least {num} ‘{kind}’ parameters.

raesl.compile.diagnostics.E209(name: str, kind: str, other_kind: str, location: raesl.types.Location = utils.get_location(), others: List[raesl.types.Location] | None = None) EslDiagnostic#

‘{name}’ is both a {kind} and a {other_kind}.

raesl.compile.diagnostics.E210(lhs: raesl.types.Location, rhs: raesl.types.Location, reason: str = 'are not compatible') EslDiagnostic#

Values cannot be compared, they {reason}.

raesl.compile.diagnostics.E211(verb: str, preposition: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Unsupported verb-preposition combination ‘{verb} {preposition}’.

raesl.compile.diagnostics.E212(kind: str, value: str, allowed: str, name: str | None = None, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

{kind.capitalize()} ‘{name}’ uses ‘{value}’, but should use {allowed}.

raesl.compile.diagnostics.E213(kind: str, num: int, allowed: str, location: raesl.types.Location = utils.get_location(), occurrences: List[raesl.types.Location] | None = None) EslDiagnostic#

Found {num} {kind}(s), but there should be {allowed}.

raesl.compile.diagnostics.E214(name: str, location: raesl.types.Location = utils.get_location(), def_location: raesl.types.Location | None = None) EslDiagnostic#

Definition of type ‘{name}’ failed with an error.

raesl.compile.diagnostics.E215(name: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Type name ‘{name}’ must be the name of an elementary type.

raesl.compile.diagnostics.E216(name: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Unit ‘{name}’ should not have square brackets around it’s name.

raesl.compile.diagnostics.E217(location: raesl.types.Location = utils.get_location()) EslDiagnostic#

The dimensionless unit ‘-’ is not allowed to be specified explicitly.

raesl.compile.diagnostics.E218(name: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Standard type ‘{name}’ cannot be overridden.

raesl.compile.diagnostics.E219(name: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Unit ‘{name}’ is not allowed here.

raesl.compile.diagnostics.E220(name: str, kind: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Element ‘{name}’ does not match with a {kind}.

raesl.compile.diagnostics.E221(kind: str, num: int, expected: int, location: raesl.types.Location = utils.get_location(), references: List[raesl.types.Location] | None = None) EslDiagnostic#

Number of {kind}s does not match. Found {num}, expected {expected}.

raesl.compile.diagnostics.E222(name: str, other: str, location: raesl.types.Location = utils.get_location(), other_loc: raesl.types.Location = utils.get_location()) EslDiagnostic#

Value ‘{name}’ has additional value restrictions relative to ‘{other}’.

raesl.compile.diagnostics.E223(name: str, other: str, kind: str, location: raesl.types.Location = utils.get_location(), other_loc: raesl.types.Location | None = None) EslDiagnostic#

‘{name}’ is not a {kind} of {other}.

raesl.compile.diagnostics.E224(kind: str, unsupported: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

{kind.capitalize()}s do not support {unsupported}.

raesl.compile.diagnostics.E225(part: str, first_part: str, kind: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Cannot resolve ‘.{part}’ part of the ‘{first_part}’ {kind}.

raesl.compile.diagnostics.E226(name: str, location: raesl.types.Location = utils.get_location()) EslDiagnostic#

Need ‘{name}’ is not allowed to reference a bundle.

raesl.compile.diagnostics.E227(name: str, scope: str, location: raesl.types.Location = utils.get_location(), dupes: List[raesl.types.Location] | None = None) EslDiagnostic#

Multiple identifier ‘{name}’ within ‘{cdef_name}’.

raesl.compile.diagnostics.E228(lhs: raesl.types.Location, rhs: raesl.types.Location, reason: str = 'are not compatible') EslDiagnostic#

Values cannot be compared, design rule {reason}.

raesl.compile.diagnostics.E400(name: str, location: raesl.types.Location = utils.get_location(), owners: List[raesl.types.Location] | None = None) EslDiagnostic#

Elementary variable value ‘{name}’ has more than one property owner.

raesl.compile.diagnostics.W200(name: str, kind: str, location: raesl.types.Location = utils.get_location(), dupes: List[raesl.types.Location] | None = None) EslDiagnostic#

{kind.capitalize()} ‘{name}’ has been specified multiple times.

raesl.compile.diagnostics.W300(element: str | None = None, location: raesl.types.Location = utils.get_location(), comments: List[raesl.types.Location] | None = None) EslDiagnostic#

Documentation comment(s) could not be assigned to ‘{element}’.