:py:mod:`raesl.compile.diagnostics` =================================== .. py:module:: raesl.compile.diagnostics .. autoapi-nested-parse:: 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 ~~~~~~~ .. autoapisummary:: raesl.compile.diagnostics.EslDiagnostic raesl.compile.diagnostics.DiagnosticStore Functions ~~~~~~~~~ .. autoapisummary:: raesl.compile.diagnostics.E100 raesl.compile.diagnostics.E101 raesl.compile.diagnostics.E102 raesl.compile.diagnostics.E200 raesl.compile.diagnostics.E201 raesl.compile.diagnostics.E202 raesl.compile.diagnostics.E203 raesl.compile.diagnostics.E204 raesl.compile.diagnostics.E205 raesl.compile.diagnostics.E206 raesl.compile.diagnostics.E207 raesl.compile.diagnostics.E208 raesl.compile.diagnostics.E209 raesl.compile.diagnostics.E210 raesl.compile.diagnostics.E211 raesl.compile.diagnostics.E212 raesl.compile.diagnostics.E213 raesl.compile.diagnostics.E214 raesl.compile.diagnostics.E215 raesl.compile.diagnostics.E216 raesl.compile.diagnostics.E217 raesl.compile.diagnostics.E218 raesl.compile.diagnostics.E219 raesl.compile.diagnostics.E220 raesl.compile.diagnostics.E221 raesl.compile.diagnostics.E222 raesl.compile.diagnostics.E223 raesl.compile.diagnostics.E224 raesl.compile.diagnostics.E225 raesl.compile.diagnostics.E226 raesl.compile.diagnostics.E227 raesl.compile.diagnostics.E228 raesl.compile.diagnostics.E400 raesl.compile.diagnostics.W200 raesl.compile.diagnostics.W300 Attributes ~~~~~~~~~~ .. autoapisummary:: 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 .. py:data:: ERROR .. py:data:: WARN .. py:data:: INFO .. py:data:: HINT .. py:data:: _NON_SEVERE .. py:data:: EslRelated .. py:class:: 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: :py:obj:`raesl.types.Diagnostic` An unscoped diagnostic as ESL works with multiple text documents at once. :param message: The diagnostic's message. :param location: The location at which the message applies. :param 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. :param code: The diagnostic's code, which might appear in the user interface. :param source: A human-readable string describing the source of this diagnostic, e.g. 'esl', or 'esl compiler'. :param 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. .. attribute:: range The range at which the message applies. .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:method:: _print(style=repr) .. py:class:: DiagnosticStore(severity: raesl.types.DiagnosticSeverity = ERROR, exit: bool = False) Storage of found diagnostics. .. attribute:: diagnostics Stored diagnostics. .. attribute:: severity What diagnostics to log. .. attribute:: exit Exit on error. .. py:method:: add(diagnostic: EslDiagnostic) Add a diagnostic. Report directly if below severity threshold. .. py:method:: report(diagnostic: EslDiagnostic) Report a single diagnostic. .. py:method:: dump(test: bool = False, stream: Optional[IO[str]] = None) Dump all stored diagnostics to the given stream. :param test: Whether to output in test mode (otherwise: user-friendly). :param stream: Output stream to use. Defaults to stdout. .. py:method:: has_severe() -> bool Whether there are severe diagnostics stored. .. py:function:: E100(location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Unexpected end of the specification. .. py:function:: 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. .. py:function:: E102(location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Syntax error. .. py:function:: E200(name: str, kind: str, location: raesl.types.Location = utils.get_location(), dupes: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic Multiple {kind} named '{name}'. .. py:function:: E201(section: str, context: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic This '{section}' section is not allowed in the '{context}' context. .. py:function:: E202(kind: str, name: Optional[str] = None, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Missing {kind} for '{name}'. .. py:function:: E203(kind: str, name: Optional[str] = None, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Unknown {kind} named '{name}'. .. py:function:: E204(name: str, kind: str, location: raesl.types.Location = utils.get_location(), cycle: Optional[List[raesl.types.Location]] = None) Cyclically dependent {kind} named '{name}'. .. py:function:: E205(name: str, context: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Cannot find {name} in {context}. .. py:function:: E206(name: str, kind: str, location: raesl.types.Location = utils.get_location(), blocks: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic Found {kind} block(s), but the relation definition {name} has no such parameters. .. py:function:: 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. .. py:function:: 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. .. py:function:: E209(name: str, kind: str, other_kind: str, location: raesl.types.Location = utils.get_location(), others: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic '{name}' is both a {kind} and a {other_kind}. .. py:function:: E210(lhs: raesl.types.Location, rhs: raesl.types.Location, reason: str = 'are not compatible') -> EslDiagnostic Values cannot be compared, they {reason}. .. py:function:: E211(verb: str, preposition: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Unsupported verb-preposition combination '{verb} {preposition}'. .. py:function:: E212(kind: str, value: str, allowed: str, name: Optional[str] = None, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic {kind.capitalize()} '{name}' uses '{value}', but should use {allowed}. .. py:function:: E213(kind: str, num: int, allowed: str, location: raesl.types.Location = utils.get_location(), occurrences: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic Found {num} {kind}(s), but there should be {allowed}. .. py:function:: E214(name: str, location: raesl.types.Location = utils.get_location(), def_location: Optional[raesl.types.Location] = None) -> EslDiagnostic Definition of type '{name}' failed with an error. .. py:function:: E215(name: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Type name '{name}' must be the name of an elementary type. .. py:function:: E216(name: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Unit '{name}' should not have square brackets around it's name. .. py:function:: E217(location: raesl.types.Location = utils.get_location()) -> EslDiagnostic The dimensionless unit '-' is not allowed to be specified explicitly. .. py:function:: E218(name: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Standard type '{name}' cannot be overridden. .. py:function:: E219(name: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Unit '{name}' is not allowed here. .. py:function:: E220(name: str, kind: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Element '{name}' does not match with a {kind}. .. py:function:: E221(kind: str, num: int, expected: int, location: raesl.types.Location = utils.get_location(), references: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic Number of {kind}s does not match. Found {num}, expected {expected}. .. py:function:: 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}'. .. py:function:: E223(name: str, other: str, kind: str, location: raesl.types.Location = utils.get_location(), other_loc: Optional[raesl.types.Location] = None) -> EslDiagnostic '{name}' is not a {kind} of {other}. .. py:function:: E224(kind: str, unsupported: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic {kind.capitalize()}s do not support {unsupported}. .. py:function:: 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}. .. py:function:: E226(name: str, location: raesl.types.Location = utils.get_location()) -> EslDiagnostic Need '{name}' is not allowed to reference a bundle. .. py:function:: E227(name: str, scope: str, location: raesl.types.Location = utils.get_location(), dupes: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic Multiple identifier '{name}' within '{cdef_name}'. .. py:function:: E228(lhs: raesl.types.Location, rhs: raesl.types.Location, reason: str = 'are not compatible') -> EslDiagnostic Values cannot be compared, design rule {reason}. .. py:function:: E400(name: str, location: raesl.types.Location = utils.get_location(), owners: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic Elementary variable value '{name}' has more than one property owner. .. py:function:: W200(name: str, kind: str, location: raesl.types.Location = utils.get_location(), dupes: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic {kind.capitalize()} '{name}' has been specified multiple times. .. py:function:: W300(element: Optional[str] = None, location: raesl.types.Location = utils.get_location(), comments: Optional[List[raesl.types.Location]] = None) -> EslDiagnostic Documentation comment(s) could not be assigned to '{element}'.