198,6 → 198,10 |
pos = stateLogicalCondition(tokens, pos); |
break; |
|
case Token.TOKEN_INDEX: |
pos = stateIndex(tokens, pos); |
break; |
|
default: |
throw new PathCreateException("Element condition expected", token); |
} |
226,6 → 230,39 |
return pos; |
} |
|
private int stateIndex(List tokens, int pos) |
throws PathCreateException |
{ |
Token token = (Token)tokens.get(pos); |
|
try { |
element.setIndex(Integer.parseInt(token.getValue())); |
} |
catch(NumberFormatException ex) { |
throw new PathCreateException( |
"Cannot parse '" + token.getValue() + "' as integer", token); |
} |
|
token = (Token)tokens.get(++pos); |
|
switch(token.getType()) { |
case Token.TOKEN_CLOSE_BRACKET: |
pos = stateConditionEnd(tokens, pos); |
break; |
|
case Token.TOKEN_AND: |
pos++; // go to next token for stateLogicalCondition |
pos = stateLogicalCondition(tokens, pos); |
break; |
|
default: |
throw new PathCreateException( |
"End of conditions or next condition expected", token); |
} |
|
return pos; |
} |
|
private int stateConditionText(List tokens, int pos) |
throws PathCreateException |
{ |