private void doConditionalBlock(String firstWord, String theRest) {
if (firstWord.equals("if")) {
//Checking that it is not already doing a conditional block
if (state instanceof StateDoingConditionalBlocks) {
throw new SyntaxException(UNKNOWN_LINE, "Cannot use conditional block inside another condition");
}
previousState = state;
boolean inverted = theRest.equals("not");
state = new StateDoingConditionalBlocks(properties, inverted, contextPath, pageSpecReader);
}
else {
if (!(state instanceof StateDoingConditionalBlocks)) {
throw new SyntaxException(UNKNOWN_LINE, "Cannot use '" + firstWord + "' statement outside conditional block.");
}
StateDoingConditionalBlocks stateConditionalBlock = (StateDoingConditionalBlocks) state;
if (firstWord.equals("or")) {
boolean inverted = theRest.equals("not");
stateConditionalBlock.startNewStatement(inverted);
}
else {
if (!theRest.isEmpty()) {
throw new SyntaxException(UNKNOWN_LINE, "'" + firstWord + "' statement should not take any arguments");
}
if (firstWord.equals("do")) {
stateConditionalBlock.startBody();
}
else if (firstWord.equals("otherwise")) {