- java.lang.Object
-
- org.logicng.io.parsers.FormulaParser
-
- Direct Known Subclasses:
PropositionalParser,PseudoBooleanParser
public abstract class FormulaParser extends Object
Super class for a formula parser.- Since:
- 1.2
- Version:
- 1.2
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedFormulaParser(org.logicng.formulas.FormulaFactory f)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.logicng.formulas.FormulaFactoryfactory()Returns the factory of this parser.org.logicng.formulas.Formulaparse(InputStream inputStream)Parses and returns a given input stream.org.logicng.formulas.Formulaparse(String in)Parses and returns a given string.protected voidsetLexerAndParser(org.antlr.v4.runtime.Lexer lexer, ParserWithFormula parser)Sets the internal lexer and the parser.StringtoString()
-
-
-
Method Detail
-
setLexerAndParser
protected void setLexerAndParser(org.antlr.v4.runtime.Lexer lexer, ParserWithFormula parser)Sets the internal lexer and the parser.- Parameters:
lexer- the lexerparser- the parser
-
parse
public org.logicng.formulas.Formula parse(InputStream inputStream) throws ParserException
Parses and returns a given input stream.- Parameters:
inputStream- an input stream- Returns:
- the
Formularepresentation of this stream - Throws:
ParserException- if there was a problem with the input stream
-
parse
public org.logicng.formulas.Formula parse(String in) throws ParserException
Parses and returns a given string.- Parameters:
in- a string- Returns:
- the
Formularepresentation of this string - Throws:
ParserException- if the string was not a valid formula
-
factory
public org.logicng.formulas.FormulaFactory factory()
Returns the factory of this parser.- Returns:
- the factory of this parser
-
-