| Modifier and Type | Field and Description |
|---|---|
org.junit.rules.ExpectedException |
thrown |
| Constructor and Description |
|---|
ParserTest() |
| Modifier and Type | Method and Description |
|---|---|
static AST |
parse(String input)
Convenience method to tokenize and parse the given input
|
AST |
parseExpectFailure(String input) |
static AST |
parseNoException(String input)
Like
parse, but it does not throw any annotated
exceptions. |
void |
testInvalidDoubleNumber() |
void |
testMissingSecondOperand() |
void |
testMissingSecondOperandInParens() |
void |
testParseAdd() |
void |
testParseNum() |
void |
testParseParensBinop() |
void |
testParseParensLiteral() |
void |
testPrecedenceHigherFirst() |
void |
testPrecedenceParensApplyRight() |
void |
testUnaryMinusLiteral() |
void |
testUnaryMinusNonMinusBinop() |
public static AST parse(String input) throws TokenizerException, ParserException
input - The expression to be evaluated, as a stringTokenizerException - if there is a token errorParserException - if there is a parsing errorpublic static AST parseNoException(String input)
parse, but it does not throw any annotated
exceptions. This is to avoid repeatedly annotating tests to
throw exceptions. Internally, if tokenizing or parsing
input throws either a TokenizerException
or a ParserException, this will trigger test failure.input - The expression to be evaluated, as a stringpublic void testParseNum()
public void testParseAdd()
public void testParseParensLiteral()
public void testParseParensBinop()
public void testPrecedenceHigherFirst()
public void testPrecedenceParensApplyRight()
public void testUnaryMinusLiteral()
public void testUnaryMinusNonMinusBinop()
public AST parseExpectFailure(String input) throws TokenizerException, ParserException
TokenizerExceptionParserExceptionpublic void testInvalidDoubleNumber()
throws TokenizerException,
ParserException
TokenizerExceptionParserExceptionpublic void testMissingSecondOperand()
throws TokenizerException,
ParserException
TokenizerExceptionParserExceptionpublic void testMissingSecondOperandInParens()
throws TokenizerException,
ParserException
TokenizerExceptionParserException