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.Amalgam
representations.
- 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.