Skip to main content

Crate scarf_parser

Crate scarf_parser 

Source
Expand description

A SystemVerilog preprocessor and parser

scarf-parser provides capabilities for transformting a SystemVerilog source file into a CST compliant with IEEE 1800-2023, with an emphasis on informative error messages. It can be used as the front-end for other tools looking to interpret SystemVerilog designs.

§Features

  • lossless: Equivalent to the lossless feature for scarf_syntax. Produces a CST with room for non-trivia nodes, but does not actually parse any from provided sources
  • parse_lossless: Extends lossless to parse non-trivia tokens. Due to their arbitrary position in source files, this adds a measurable performance decrease, and should only be used if newlines/comments are needed.

Re-exports§

pub use lexer::LexedSource;
pub use lexer::Token;
pub use lexer::lex;
pub use parser::parse;
pub use preprocessor::*;

Modules§

lexer
Lexing a source file into semantic tokens
parser
preprocessor
Preprocessing a token stream, elaborating compiler directives

Structs§

Report
A type representing a diagnostic that is ready to be written to output.
Source
A type representing a single source that may be referred to by Spans.
Span
A representation of a unique location in a source file
SpannedString
A string and its associated Span in the source files
SpannedToken
A token and its location in the source code
VerboseError
A verbose error message describing the error location, what was found, and what was expected instead

Enums§

Expectation
Something the parser expected to find instead of what was found, in the case of an error

Functions§

sources
Create a Cache from a collection of ID/strings, where each corresponds to a Source.