P4C
The P4 Compiler
Loading...
Searching...
No Matches
P4::AbstractParserDriver Class Referenceabstract

#include <parserDriver.h>

Inheritance diagram for P4::AbstractParserDriver:
[legend]

Protected Member Functions

void onParseError (const Util::SourceInfo &location, const std::string &message)
 
void onReadComment (const char *text, bool lineComment)
 
void onReadFileName (const char *text)
 Notify that the lexer read a filename from a line directive.
 
void onReadIdentifier (cstring id)
 Notify that the lexer read an identifier, @id.
 
void onReadLineNumber (const char *text)
 Notify that the lexer read a line number from a line directive.
 
void onReadToken (const char *text)
 Notify that the lexer read a token. @text is the matched source text.
 

Protected Attributes

int saveState = -1
 Scratch storage for the lexer to remember its previous state.
 
Util::InputSourcessources
 The input sources that comprise the P4 program we're parsing.
 
Util::SourceInfo yylloc
 The location of the most recent token.
 

Detailed Description

The base class of ParserDrivers, which provide a high level interface to parsers and lexers and manage their state.

Member Function Documentation

◆ onParseError()

void P4::AbstractParserDriver::onParseError ( const Util::SourceInfo & location,
const std::string & message )
protected

Notify that an error was encountered during parsing at @location. @message is a Bison-provided human-readable explanation of the error.

◆ onReadComment()

void P4::AbstractParserDriver::onReadComment ( const char * text,
bool lineComment )
protected

Notify that the lexer has read a comment.

Parameters
textThe body of the comment, without the comment termination
lineCommentIf true this is a line comment starting with //