- while(!indentations.isEmpty() && indentations.removeAt(indentations.size()-1) >= 0) {
- int loc = Locations.endOf(prevToken.location);
- push(new Token(SCLTerminals.RBRACE, loc, loc, "implicit }"));
- }
- if(indentations.isEmpty())
- throw error(symbolStart, symbolEnd, "No corresponding opening parenthesis for '" + symbol.text + "'.");
- push(symbol);
- return;
- case SCLTerminals.THEN: // 'then' both closes and opens a block
- while(!indentations.isEmpty() && indentations.removeAt(indentations.size()-1) >= 0) {
- int loc = Locations.endOf(prevToken.location);
- push(new Token(SCLTerminals.RBRACE, loc, loc, "implicit }"));
+ int removedToken = SCLTerminals.EOF;
+ while(!indentations.isEmpty()) {
+ removedToken = indentationTokens.removeAt(indentations.size()-1);
+ //System.out.println(" removed " + SCLParser.TERMINAL_NAMES[removedToken]);
+ if(indentations.removeAt(indentations.size()-1) < 0)
+ break;
+ long loc = prevToken != null ? Locations.location(Locations.endOf(prevToken.location), Locations.endOf(prevToken.location)) : symbol.location;
+ push(new Token(SCLTerminals.RBRACE, loc, "implicit }"));