slang::parsing::Parser class

Implements a full syntax parser for SystemVerilog.

Public functions

auto parseCompilationUnit() -> syntax::CompilationUnitSyntax&
Parse a whole compilation unit.
auto parseExpression() -> syntax::ExpressionSyntax&
auto parseGuess() -> syntax::SyntaxNode&
auto isDone() -> bool
Check whether the parser has consumed the entire input stream.
auto getMetadata() -> ParserMetadata&&
Gets the current set of metadata collected during parsing.

Function documentation

syntax::ExpressionSyntax& slang::parsing::Parser::parseExpression()

Parse an expression / statement / module / class / name. These are mostly for testing; only use if you know that the source stream is currently looking at one of these.

syntax::SyntaxNode& slang::parsing::Parser::parseGuess()

Generalized node parse function that tries to figure out what we're looking at and parse that specifically. A normal batch compile won't call this, since in a well formed program every file is a compilation unit, but for snippets of code this can be convenient.