diff --git a/src/main/java/org/sablecc/sablecc/parser/Parser.java b/src/main/java/org/sablecc/sablecc/parser/Parser.java index 25f75335662a220534fa87cdf95ee96e381f0a48..fd96806607c8e5da458f60ca4f747b544b4d964e 100644 --- a/src/main/java/org/sablecc/sablecc/parser/Parser.java +++ b/src/main/java/org/sablecc/sablecc/parser/Parser.java @@ -26,9 +26,6 @@ public class Parser implements IParser private final Lexer lexer; private final ListIterator<State> stack = new LinkedList<State>().listIterator(); - private int last_pos; - private int last_line; - private Token last_token; private final TokenIndex converter = new TokenIndex(); private final static int SHIFT = 0; @@ -182,9 +179,7 @@ public class Parser implements IParser this.lexer.next(); } - this.last_pos = this.lexer.peek().getPos(); - this.last_line = this.lexer.peek().getLine(); - this.last_token = this.lexer.peek(); + Token lastToken = this.lexer.peek(); int index = index(this.lexer.peek()); int state = state(); @@ -1850,8 +1845,8 @@ public class Parser implements IParser return node; } case ERROR: - throw new ParserException(this.last_token, - "[" + this.last_line + "," + this.last_pos + "] " , + throw new ParserException(lastToken, + "[" + lastToken.getLine() + "," + lastToken.getPos() + "] " , Parser.errorMessages[Parser.errors[destination]]); } } diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt index b90e4a60759b854a2130b93a6ebbb17ccb2a4d2f..cd56e7b115fd386477648cdce010d92923097901 100644 --- a/src/main/resources/org/sablecc/sablecc/parser.txt +++ b/src/main/resources/org/sablecc/sablecc/parser.txt @@ -34,9 +34,6 @@ public class Parser implements IParser private final Lexer lexer; private final ListIterator<State> stack = new LinkedList<State>().listIterator(); - private int last_pos; - private int last_line; - private Token last_token; private final TokenIndex converter = new TokenIndex(); private final static int SHIFT = 0; @@ -216,9 +213,7 @@ Macro:ParserCommon this.lexer.next(); } - this.last_pos = this.lexer.peek().getPos(); - this.last_line = this.lexer.peek().getLine(); - this.last_token = this.lexer.peek(); + Token lastToken = this.lexer.peek(); int index = index(this.lexer.peek()); int state = state(); @@ -294,8 +289,8 @@ Macro:ParserParseTail return node; } case ERROR: - throw new ParserException(this.last_token, - "[" + this.last_line + "," + this.last_pos + "] " , + throw new ParserException(lastToken, + "[" + lastToken.getLine() + "," + lastToken.getPos() + "] " , Parser.errorMessages[Parser.errors[destination]]); } }