Crate parser

Crate parser 

Source
Expand description

The Rust parser.

NOTE: The crate is undergoing refactors, don’t believe everything the docs say :-)

The parser doesn’t know about concrete representation of tokens and syntax trees. Abstract Input and Output traits are used to provide tokens instead. As a consequence, this crate does not contain a lexer.

The Parser struct from the parser module is a cursor into the sequence of tokens. Parsing routines use Parser to inspect current state and advance the parsing.

The actual parsing happens in the grammar module.

Tests for this crate live in the syntax crate.

ModulesΒ§

event πŸ”’
This module provides a way to construct a File. It is intended to be completely decoupled from the parser, so as to allow to evolve the tree representation and the parser algorithm independently.
frontmatter πŸ”’
grammar πŸ”’
This is the actual β€œgrammar” of the Rust language.
input πŸ”’
See Input.
lexed_str πŸ”’
Lexing &str into a sequence of Rust tokens.
output πŸ”’
See Output
parser πŸ”’
See Parser.
shortcuts πŸ”’
Shortcuts that span lexer/parser abstraction.
syntax_kind πŸ”’
Defines SyntaxKind – a fieldless enum of all possible syntactic constructs of the Rust language.
token_set πŸ”’
A bit-set of SyntaxKinds.

MacrosΒ§

T
T![]
T_
T![]

StructsΒ§

Input
Input for the parser – a sequence of tokens.
LexedStr
Output
Output of the parser – a DFS traversal of a concrete syntax tree.
Reparser
A parsing function for a specific braced-block.

EnumsΒ§

Edition
PrefixEntryPoint
Parse a prefix of the input as a given syntactic construct.
Step
StrStep
SyntaxKind
The kind of syntax node, e.g. IDENT, USE_KW, or STRUCT.
TopEntryPoint
Parse the whole of the input as a given syntactic construct.