From 2eaf513cee3ea5b92e73680afd9bf29c1f345ed0 Mon Sep 17 00:00:00 2001 From: dgelessus <dgelessus@users.noreply.github.com> Date: Mon, 28 Mar 2022 16:19:51 +0200 Subject: [PATCH] Remove apparently unused ignoredTokens field from parser.txt template This field seems to store all ignored tokens encountered during parsing. It's not clear what this field is meant to do - we don't use it for anything, and neither does SableCC itself apparently. Removing it doesn't seem to break anything and should improve memory usage during parsing a bit. --- .../resources/org/sablecc/sablecc/parser.txt | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt index 7c9c931..bc4f661 100644 --- a/src/main/resources/org/sablecc/sablecc/parser.txt +++ b/src/main/resources/org/sablecc/sablecc/parser.txt @@ -24,8 +24,6 @@ import java.io.IOException; @SuppressWarnings({"rawtypes","unchecked","unused"}) public class Parser implements IParser { - public final Analysis ignoredTokens = new AnalysisAdapter(); - protected ArrayList nodeList; private final Lexer lexer; @@ -289,23 +287,11 @@ Macro:ParserCommon this.getMapping().clear(); push(0, null$0$); - List<Node> ign = null; while(true) { while(index(this.lexer.peek()) == -1) { - if(ign == null) - { - ign = new LinkedList<Node>(); - } - - ign.add(this.lexer.next()); - } - - if(ign != null) - { - this.ignoredTokens.setIn(this.lexer.peek(), ign); - ign = null; + this.lexer.next(); } this.last_pos = this.lexer.peek().getPos(); -- GitLab