private Sentence parseBracketedSentence()
{
if (detectMultiOperator())
{
return parseMultiSentence();
}
else
{
match("(");
Sentence one = parseSentence();
if (lookAhead(1).getType() == (int)LogicTokenTypes.RPAREN)
{
match(")");
return one;
}
else if ((lookAhead(1).getType() == (int)LogicTokenTypes.CONNECTOR)
&& (!(lookAhead(1).getText().Equals("Not"))))
{
String connector = lookAhead(1).getText();
consume(); // connector
Sentence two = parseSentence();
match(")");
return new BinarySentence(connector, one, two);
}
}
throw new ApplicationException(
" Runtime Exception at Bracketed Expression with token "
+ lookAhead(1));
}