From d20dbed75d3bf4173e5bdcfd864f1f69fb4da733 Mon Sep 17 00:00:00 2001
From: dgelessus <dgelessus@users.noreply.github.com>
Date: Thu, 16 May 2024 16:47:45 +0200
Subject: [PATCH] Make generated Parser.computePositions and helper methods
 static

---
 src/main/java/org/sablecc/sablecc/parser/Parser.java | 6 +++---
 src/main/resources/org/sablecc/sablecc/parser.txt    | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/sablecc/sablecc/parser/Parser.java b/src/main/java/org/sablecc/sablecc/parser/Parser.java
index 9399991..6f04f9d 100644
--- a/src/main/java/org/sablecc/sablecc/parser/Parser.java
+++ b/src/main/java/org/sablecc/sablecc/parser/Parser.java
@@ -36,7 +36,7 @@ public class Parser implements IParser
         this.lexer = lexer;
     }
 
-    private void computePositions(PositionedNode node, List<?> beginNodeList, List<?> endNodeList) {
+    private static void computePositions(PositionedNode node, List<?> beginNodeList, List<?> endNodeList) {
         // This method should only ever be called for newly created AST nodes (that are not tokens).
         assert !(node instanceof Token);
         assert node.getStartPos() == null;
@@ -49,7 +49,7 @@ public class Parser implements IParser
         node.setEndPos(endNode.getEndPos());
     }
 
-    private PositionedNode findBeginNode(final List<?> list) {
+    private static PositionedNode findBeginNode(final List<?> list) {
         Object first = list.get(0);
         if (first instanceof List<?>) {
             List<?> list2 = (List<?>) first;
@@ -59,7 +59,7 @@ public class Parser implements IParser
         return (PositionedNode)first;
     }
 
-    private PositionedNode findEndNode(final List<?> list) {
+    private static PositionedNode findEndNode(final List<?> list) {
         Object last = list.get(list.size() - 1);
         if (last instanceof List<?>) {
             final List<?> list2 = (List<?>) last;
diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt
index 1c23fcf..72b1419 100644
--- a/src/main/resources/org/sablecc/sablecc/parser.txt
+++ b/src/main/resources/org/sablecc/sablecc/parser.txt
@@ -44,7 +44,7 @@ public class Parser implements IParser
         this.lexer = lexer;
     }
 
-    private void computePositions(PositionedNode node, List<?> beginNodeList, List<?> endNodeList) {
+    private static void computePositions(PositionedNode node, List<?> beginNodeList, List<?> endNodeList) {
         // This method should only ever be called for newly created AST nodes (that are not tokens).
         assert !(node instanceof Token);
         assert node.getStartPos() == null;
@@ -57,7 +57,7 @@ public class Parser implements IParser
         node.setEndPos(endNode.getEndPos());
     }
 
-    private PositionedNode findBeginNode(final List<?> list) {
+    private static PositionedNode findBeginNode(final List<?> list) {
         Object first = list.get(0);
         if (first instanceof List<?>) {
             List<?> list2 = (List<?>) first;
@@ -67,7 +67,7 @@ public class Parser implements IParser
         return (PositionedNode)first;
     }
 
-    private PositionedNode findEndNode(final List<?> list) {
+    private static PositionedNode findEndNode(final List<?> list) {
         Object last = list.get(list.size() - 1);
         if (last instanceof List<?>) {
             final List<?> list2 = (List<?>) last;
-- 
GitLab