public class InputParser
extends java.lang.Object
setFileInput(InputLanguage, String)
,
setStringInput(InputLanguage, String, String)
,
or setIncrementalStringInput(InputLanguage, String)
and
appendIncrementalStringInput(String)
. Then, the methods
nextCommand()
and nextTerm()
can be
invoked to parse the input.
The input parser interacts with a symbol manager, which determines which
symbols are defined in the current context, based on the background logic
and user-defined symbols. If no symbol manager is provided, then the
input parser will construct (an initially empty) one.
If provided, the symbol manager must have a logic that is compatible
with the provided solver. That is, if both the solver and symbol
manager have their logics set (SymbolManager.isLogicSet()
and
Solver.isLogicSet()
, then their logics must be the same.
Upon setting an input source, if either the solver (resp. symbol
manager) has its logic set, then the symbol manager (resp. solver) is set to
use that logic, if its logic is not already set.Modifier and Type | Field and Description |
---|---|
protected long |
pointer |
Constructor and Description |
---|
InputParser(Solver solver)
Construct an input parser with an initially empty symbol manager.
|
InputParser(Solver solver,
SymbolManager sm)
Construct an input parser
|
Modifier and Type | Method and Description |
---|---|
void |
appendIncrementalStringInput(java.lang.String input)
Append string to the input being parsed by this parser.
|
void |
deletePointer() |
protected void |
deletePointer(long pointer) |
boolean |
done() |
long |
getPointer() |
Solver |
getSolver() |
SymbolManager |
getSymbolManager() |
Command |
nextCommand()
Parse and return the next command.
|
Term |
nextTerm()
Parse and return the next term.
|
void |
setFileInput(InputLanguage lang,
java.lang.String fileName)
Set the input for the given file.
|
void |
setIncrementalStringInput(InputLanguage lang,
java.lang.String name)
Set that we will be feeding strings to this parser via
appendIncrementalStringInput below.
|
void |
setStringInput(InputLanguage lang,
java.lang.String input,
java.lang.String name)
Set the input to the given concrete input string.
|
java.lang.String |
toString() |
protected java.lang.String |
toString(long pointer) |
public InputParser(Solver solver, SymbolManager sm)
solver
- The solver (e.g. for constructing terms and sorts)sm
- The symbol manager, which contains a symbol table that maps
symbols to terms and sorts. Must have a logic that is compatible
with the solver.public InputParser(Solver solver)
solver
- The solver (e.g. for constructing terms and sorts).protected void deletePointer(long pointer)
protected java.lang.String toString(long pointer)
public Solver getSolver()
public SymbolManager getSymbolManager()
public void setFileInput(InputLanguage lang, java.lang.String fileName)
lang
- the input language (e.g. InputLanguage.SMT_LIB_2_6).fileName
- the input file name.public void setStringInput(InputLanguage lang, java.lang.String input, java.lang.String name)
lang
- The input language.input
- The input string.name
- The name of the stream, for use in error messages.public void setIncrementalStringInput(InputLanguage lang, java.lang.String name)
lang
- The input language.name
- The name of the stream, for use in error messages.public void appendIncrementalStringInput(java.lang.String input)
input
- The input string.public Command nextCommand()
public Term nextTerm()
public boolean done()
public long getPointer()
public void deletePointer()
public java.lang.String toString()
toString
in class java.lang.Object