cvc4-1.4
CVC4::parser::Input Class Referenceabstract

An input to be parsed. More...

#include <input.h>

Public Member Functions

virtual ~Input ()
 Destructor.
 
virtual std::string getUnparsedText ()=0
 Retrieve the remaining text in this input.
 
virtual InputLanguage getLanguage () const throw () =0
 Get the language that this Input is reading.
 
const std::string getInputStreamName ()
 Retrieve the name of the input stream.
 

Static Public Member Functions

static InputnewFileInput (InputLanguage lang, const std::string &filename, bool useMmap=false) throw (InputStreamException)
 Create an input for the given file.
 
static InputnewStreamInput (InputLanguage lang, std::istream &input, const std::string &name, bool lineBuffered=false) throw (InputStreamException)
 Create an input for the given stream.
 
static InputnewStringInput (InputLanguage lang, const std::string &input, const std::string &name) throw (InputStreamException)
 Create an input for the given string.
 

Protected Member Functions

 Input (InputStream &inputStream)
 Create an input.
 
InputStreamgetInputStream ()
 Retrieve the input stream for this parser.
 
virtual CommandparseCommand ()=0
 Parse a command from the input by invoking the implementation-specific parsing method.
 
virtual void warning (const std::string &msg)=0
 Issue a warning to the user, with source file, line, and column info.
 
virtual void parseError (const std::string &msg, bool eofException=false) throw (ParserException) =0
 Throws a ParserException with the given message.
 
virtual Expr parseExpr ()=0
 Parse an expression from the input by invoking the implementation-specific parsing method.
 
virtual void setParser (Parser &parser)=0
 Set the Parser object for this input.
 

Friends

class Parser
 
class ParserBuilder
 

Detailed Description

An input to be parsed.

The static factory methods in this class (e.g., newFileInput, newStringInput) create a parser for the given input language and attach it to an input source of the appropriate type.

Definition at line 86 of file input.h.

Constructor & Destructor Documentation

◆ ~Input()

virtual CVC4::parser::Input::~Input ( )
virtual

Destructor.

Frees the input stream and closes the input.

◆ Input()

CVC4::parser::Input::Input ( InputStream & inputStream)
protected

Create an input.

Parameters
inputStreamthe input stream

Member Function Documentation

◆ getInputStream()

InputStream * CVC4::parser::Input::getInputStream ( )
protected

Retrieve the input stream for this parser.

◆ getInputStreamName()

const std::string CVC4::parser::Input::getInputStreamName ( )
inline

Retrieve the name of the input stream.

Definition at line 150 of file input.h.

◆ getLanguage()

virtual InputLanguage CVC4::parser::Input::getLanguage ( ) const
throw ( )
pure virtual

Get the language that this Input is reading.

◆ getUnparsedText()

virtual std::string CVC4::parser::Input::getUnparsedText ( )
pure virtual

Retrieve the remaining text in this input.

◆ newFileInput()

static Input * CVC4::parser::Input::newFileInput ( InputLanguage lang,
const std::string & filename,
bool useMmap = false )
throw (InputStreamException )
static

Create an input for the given file.

Parameters
langthe input language
filenamethe input filename
useMmaptrue if the parser should use memory-mapped I/O (default: false)

◆ newStreamInput()

static Input * CVC4::parser::Input::newStreamInput ( InputLanguage lang,
std::istream & input,
const std::string & name,
bool lineBuffered = false )
throw (InputStreamException )
static

Create an input for the given stream.

Parameters
langthe input language
inputthe input stream
namethe name of the stream, for use in error messages
lineBufferedwhether this Input should be line-buffered (false, the default, means that the entire Input might be read before being lexed and parsed)

◆ newStringInput()

static Input * CVC4::parser::Input::newStringInput ( InputLanguage lang,
const std::string & input,
const std::string & name )
throw (InputStreamException )
static

Create an input for the given string.

Parameters
langthe input language
inputthe input string
namethe name of the stream, for use in error messages

◆ parseCommand()

virtual Command * CVC4::parser::Input::parseCommand ( )
protectedpure virtual

Parse a command from the input by invoking the implementation-specific parsing method.

Returns NULL if there is no command there to parse.

Exceptions
ParserExceptionif an error is encountered during parsing.

◆ parseError()

virtual void CVC4::parser::Input::parseError ( const std::string & msg,
bool eofException = false )
throw (ParserException )
protectedpure virtual

◆ parseExpr()

virtual Expr CVC4::parser::Input::parseExpr ( )
protectedpure virtual

Parse an expression from the input by invoking the implementation-specific parsing method.

Returns a null Expr if there is no expression there to parse.

Exceptions
ParserExceptionif an error is encountered during parsing.

◆ setParser()

virtual void CVC4::parser::Input::setParser ( Parser & parser)
protectedpure virtual

Set the Parser object for this input.

Referenced by CVC4::parser::Parser::setInput().

◆ warning()

virtual void CVC4::parser::Input::warning ( const std::string & msg)
protectedpure virtual

Issue a warning to the user, with source file, line, and column info.

Referenced by CVC4::parser::Parser::warning().

Friends And Related Symbol Documentation

◆ Parser

friend class Parser
friend

Definition at line 87 of file input.h.

◆ ParserBuilder

friend class ParserBuilder
friend

Definition at line 88 of file input.h.


The documentation for this class was generated from the following file: