diff --git a/src/main/java/org/sablecc/sablecc/parser/Parser.java b/src/main/java/org/sablecc/sablecc/parser/Parser.java index 82bfea29231289410cbd57997a7a61ac8fbebdc4..c23684d97bc6ad40fc6a2548c44ef60dfbdf7a48 100644 --- a/src/main/java/org/sablecc/sablecc/parser/Parser.java +++ b/src/main/java/org/sablecc/sablecc/parser/Parser.java @@ -50,13 +50,11 @@ public class Parser implements IParser * added to it */ final List<?> nodeList = (List<?>) elementToCheck; - - if (nodeList.size() > 0) { - elementToCheck = nodeList.get(nodeList.size() - 1); - } else { + if (nodeList.isEmpty()) { // no positions for empty lists... return; } + elementToCheck = nodeList.get(nodeList.size() - 1); } final PositionedNode node = (PositionedNode) elementToCheck; diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt index 21a877da31f81c5b93cc40529c12aea455919d48..e5a46dc88e2a8f439c4512b47838348d6414f1db 100644 --- a/src/main/resources/org/sablecc/sablecc/parser.txt +++ b/src/main/resources/org/sablecc/sablecc/parser.txt @@ -58,13 +58,11 @@ public class Parser implements IParser * added to it */ final List<?> nodeList = (List<?>) elementToCheck; - - if (nodeList.size() > 0) { - elementToCheck = nodeList.get(nodeList.size() - 1); - } else { + if (nodeList.isEmpty()) { // no positions for empty lists... return; } + elementToCheck = nodeList.get(nodeList.size() - 1); } final PositionedNode node = (PositionedNode) elementToCheck;