case '}':
type = TokenType.CLOSE_BRACE;
current++;
- state_stack.length--;
+ if (state_stack.length > 0) {
+ state_stack.length--;
+ }
break;
case '(':
type = TokenType.OPEN_PARENS;
case ')':
type = TokenType.CLOSE_PARENS;
current++;
- state_stack.length--;
+ if (state_stack.length > 0) {
+ state_stack.length--;
+ }
if (in_template ()) {
type = TokenType.COMMA;
}
case ']':
type = TokenType.CLOSE_BRACKET;
current++;
- state_stack.length--;
+ if (state_stack.length > 0) {
+ state_stack.length--;
+ }
break;
case '.':
type = TokenType.DOT;