Expand description
Low-level OpenQASM3 lexer.
This is largely copied from rustc_lexer, the lexer for the rust compiler.
rustc_lexer is avaiable as a crate, and rust-analyzer uses this crate for lexing.
The main entity of this crate is the TokenKind enum which represents common
lexeme types.
Modules§
- unescape
- Utilities for validating string and char literals and turning them into values they represent.
Structs§
- Cursor
- Peekable iterator over a char sequence.
- Token
- Parsed token. It doesn’t contain information about data that has been parsed, only the type of the token and its size.
Enums§
- Base
- Base of numeric literal encoding according to its prefix.
- Literal
Kind - Enum representing the literal types supported by the lexer.
- Token
Kind - Enum representing common lexeme types.
Functions§
- is_
id_ continue - For OQ3 we take Rust’s rules on valid identifiers as a starting point.
True if
cis valid as a non-first character of an identifier. See Rust language reference for a formal definition of valid identifier name. - is_
id_ start - For OQ3 we take Rust’s rules on valid identifiers as a starting point.
True if
cis valid as a first character of an identifier. See Rust language reference for a formal definition of valid identifier name. - is_
ident - The passed string is lexically an identifier.
- is_
whitespace - True if
cis considered a whitespace according to Rust language definition. See Rust language reference for definitions of these classes. - tokenize
- Creates an iterator that produces tokens from the input string.