}
private SelectorNode parseBaseExpression() throws InvalidSelectorException
{
if (isEndOfExpression())
throw new InvalidSelectorException("Unexpected end of expression");
if (currentToken.equals("("))
return parseGroupExpression();
if (isLiteral(currentToken))
{
if (currentToken.startsWith("'"))
return parseStringConstant();
else
return parseNumericConstant();
}
// TRUE,FALSE and NULL keywords
if (currentToken.equalsIgnoreCase("true"))
{
readNextToken(); // skip 'true'
return new BooleanLiteral(Boolean.TRUE);
}
if (currentToken.equalsIgnoreCase("false"))
{
readNextToken(); // skip 'false'
return new BooleanLiteral(Boolean.FALSE);
}
if (currentToken.equalsIgnoreCase("null"))
{
readNextToken(); // skip 'null'
return new NullLiteral();
}
if (currentToken.equalsIgnoreCase("not true"))
{
readNextToken(); // skip 'not true'
return new BooleanLiteral(Boolean.FALSE);
}
if (currentToken.equalsIgnoreCase("not false"))
{
readNextToken(); // skip 'not false'
return new BooleanLiteral(Boolean.TRUE);
}
if (isIdentifier(currentToken))
return parseIdentifier();
throw new InvalidSelectorException("Unexpected token : "+currentToken);
}