Parser¶
Internal documentation for the amalgam.parser module.
-
amalgam.parser.parse(text: str, source: str = '<unknown>') → amalgam.amalgams.Amalgam[source]¶ Facilitates regular parsing that can fail.
-
class
amalgam.parser.Expression(visit_tokens=True)[source]¶ Transforms expressions in text into their respective
amalgams.Amalgamrepresentations.
-
class
amalgam.parser.ParsingError(line: int, column: int, text: str, source: str)[source]¶ Base exception for errors during parsing.
-
line¶ the line number nearest to the error
- Type
int
-
column¶ the column number nearest to the error
- Type
int
-
text¶ the original text being parsed
- Type
str
-
source¶ the source of the original text
- Type
str
-
-
class
amalgam.parser.ExpectedEOF(line: int, column: int, text: str, source: str)[source]¶ Raised when multiple expressions are found.
-
class
amalgam.parser.ExpectedExpression(line: int, column: int, text: str, source: str)[source]¶ Raised when no expressions are found.