diff --git a/src/main/java/org/sablecc/sablecc/parser/Parser.java b/src/main/java/org/sablecc/sablecc/parser/Parser.java index edc50fa39be5b66f252cca7824f27c791dae25d0..9cf150b4f6de129dce4c195beeb35152b15275a1 100644 --- a/src/main/java/org/sablecc/sablecc/parser/Parser.java +++ b/src/main/java/org/sablecc/sablecc/parser/Parser.java @@ -71,16 +71,9 @@ public class Parser implements IParser } } - if (!(elementToCheck instanceof PositionedNode)) { - throw new Error( - "Unexpected elementToCheck (not instanceof PositionedNode): " - + elementToCheck.getClass().getSimpleName() + "/" - + elementToCheck); - } - - if (!this.getMapping().containsKey(elementToCheck) || slurp ) { - final PositionedNode node = (PositionedNode) elementToCheck; + final PositionedNode node = (PositionedNode) elementToCheck; + if (!this.getMapping().containsKey(node) || slurp ) { // dealing with a one-token element if (this.lastPopped == null) { this.lastPopped = this.firstPopped; diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt index e5596f940f82fdbd981c5d61424a8935c7587330..65db0e6ed3c3f113ab3da6522e475571b649c1c2 100644 --- a/src/main/resources/org/sablecc/sablecc/parser.txt +++ b/src/main/resources/org/sablecc/sablecc/parser.txt @@ -79,16 +79,9 @@ public class Parser implements IParser } } - if (!(elementToCheck instanceof PositionedNode)) { - throw new Error( - "Unexpected elementToCheck (not instanceof PositionedNode): " - + elementToCheck.getClass().getSimpleName() + "/" - + elementToCheck); - } - - if (!this.getMapping().containsKey(elementToCheck) || slurp ) { - final PositionedNode node = (PositionedNode) elementToCheck; + final PositionedNode node = (PositionedNode) elementToCheck; + if (!this.getMapping().containsKey(node) || slurp ) { // dealing with a one-token element if (this.lastPopped == null) { this.lastPopped = this.firstPopped;