:py:mod:`raesl.types` ===================== .. py:module:: raesl.types .. autoapi-nested-parse:: Some general types, inspired by the Language Server Protocol. Reference: https://microsoft.github.io/language-server-protocol/ Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: raesl.types.Position raesl.types.Range raesl.types.Location raesl.types.DiagnosticSeverity raesl.types.DiagnosticRelatedInformation raesl.types.Diagnostic .. py:class:: Position(line: int = 0, character: int = 0) Position in a text document expressed as zero-based line and character offset. A position is between two characters like an 'insert' cursor in an editor. Special values like for example -1 to denote the end of a line are not supported. :param line: Line position in a document (zero-based). :param character: Character offset on a line in a document (zero-based). Assuming that the line is represented as a string, the 'character' value represents the gap between 'character' and 'character + 1'. .. py:method:: __eq__(other) Return self==value. .. py:method:: __ge__(other) Return self>=value. .. py:method:: __gt__(other) Return self>value. .. py:method:: __le__(other) Return self<=value. .. py:method:: __lt__(other) Return self Tuple[str, int, int] Get a tuple with identification for this position. .. py:method:: __eq__(other) Return self==value. .. py:method:: __lt__(other: Location) Return selfvalue. .. py:method:: __ge__(other: Location) Return self>=value. .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:class:: DiagnosticSeverity Bases: :py:obj:`enum.IntEnum` Enum where members are also (and must be) ints .. py:attribute:: Error :value: 1 .. py:attribute:: Warning :value: 2 .. py:attribute:: Information :value: 3 .. py:attribute:: Hint :value: 4 .. py:class:: DiagnosticRelatedInformation(location: Location, message: str) Represents a related message and source code location for a diagnostic. This should be used to point to code locations that cause or are related to a diagnostic, e.g when duplicating a symbol in a scope. :param location: The location of this related diagnostic information. :param message: The message of this related diagnostic information. .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:class:: Diagnostic(message: str, range: Range, severity: DiagnosticSeverity = DiagnosticSeverity.Error, code: str = None, source: str = None, related_information: List[DiagnosticRelatedInformation] = None) Represents a diagnostic, such as a compiler error or warning. Diagnostic objects are only valid in the scope of a resource. :param message: The diagnostic's message. :param range: The range 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. .. py:method:: __repr__() Return repr(self). .. py:method:: __str__() Return str(self). .. py:method:: _print(style=repr)