Crate panfix

Source

Modules§

implementation
In case you want to peek under the hood and use the components that make up the parser separately.

Macros§

pattern
Describes the syntax of an operator.

Structs§

Grammar
A grammar for a language. Add operators until the grammar is complete, then call .finish() to construct a Parser you can use to parse.
Lexeme
One “word” in the stream returned by the lexer.
ParseError
An error while parsing. When Displayed, shows the message and the portion of the source it occurred in.
ParseTree
The result of parsing a source string. Call .visitor() to walk it.
Parser
A Panfix grammar, that’s ready to parse.
Pattern
Describe the syntax of an operator. You typically want to construct this with the pattern! macro.
Position
A position in the source text. Positions are between characters.
Source
Source text, and a “filename” for it (though it need not have been read from a file). Newline positions within the source are indexed, which allows all methods to run in constant time.
Span
A start and end position in the source text.
Visitor
One node in a parse tree. Allows you to inspect the node and its children, but not its parent.

Enums§

Fixity
Whether an operator takes an argument on the left and/or on the right. For example:
GrammarError
An error while constructing a grammar.

Constants§

TOKEN_BLANK
Represents a missing argument.
TOKEN_ERROR
Represents a lexing error.
TOKEN_JUXTAPOSE
Represents a missing operator.

Traits§

Token
A category of lexeme, such as INTEGER or VARIABLE or OPEN_PAREN.

Type Aliases§

Col
A column number of a source file. Zero indexed.
Line
A line number of a source file. Zero indexed.
Offset
A byte offset into the source file.
Prec
Precedence level. Smaller is tighter / wins.
TokenId
Densely packed short ids for tokens and op tokens. Exposed only if you use the lexer directly.