From cdac320532e278508e18afcbf3c68727b98d8466 Mon Sep 17 00:00:00 2001 From: Dave Parker Date: Fri, 29 Jun 2012 17:31:00 +0000 Subject: [PATCH] Fix in parser: make keyword list be created statically. git-svn-id: https://www.prismmodelchecker.org/svn/prism/prism/trunk@5404 bbc10eb1-c90d-0410-af57-cb519fbb1720 --- prism/src/parser/PrismParser.java | 11 ++++++----- prism/src/parser/PrismParser.jj | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/prism/src/parser/PrismParser.java b/prism/src/parser/PrismParser.java index b6753290..60182b44 100644 --- a/prism/src/parser/PrismParser.java +++ b/prism/src/parser/PrismParser.java @@ -16,6 +16,12 @@ public class PrismParser implements PrismParserConstants { // List of keyword strings private static ArrayList keywordList = new ArrayList(); + { + keywordList.clear(); + for (int i = PrismParserConstants.COMMENT+1; i < PrismParserConstants.NOT; i++) { + keywordList.add(PrismParserConstants.tokenImage[i].replaceAll("\u005c"", "")); + } + } //----------------------------------------------------------------------------------- // Main method for testing purposes @@ -85,11 +91,6 @@ public class PrismParser implements PrismParserConstants { { // Call default constructor this(System.in); - // Build a list of strings for keywords - keywordList.clear(); - for (int i = PrismParserConstants.COMMENT+1; i < PrismParserConstants.NOT; i++) { - keywordList.add(PrismParserConstants.tokenImage[i].replaceAll("\u005c"", "")); - } } // Parse modules file diff --git a/prism/src/parser/PrismParser.jj b/prism/src/parser/PrismParser.jj index 692df6cd..7a7de295 100644 --- a/prism/src/parser/PrismParser.jj +++ b/prism/src/parser/PrismParser.jj @@ -49,6 +49,12 @@ public class PrismParser // List of keyword strings private static ArrayList keywordList = new ArrayList(); + { + keywordList.clear(); + for (int i = PrismParserConstants.COMMENT+1; i < PrismParserConstants.NOT; i++) { + keywordList.add(PrismParserConstants.tokenImage[i].replaceAll("\"", "")); + } + } //----------------------------------------------------------------------------------- // Main method for testing purposes @@ -118,11 +124,6 @@ public class PrismParser { // Call default constructor this(System.in); - // Build a list of strings for keywords - keywordList.clear(); - for (int i = PrismParserConstants.COMMENT+1; i < PrismParserConstants.NOT; i++) { - keywordList.add(PrismParserConstants.tokenImage[i].replaceAll("\"", "")); - } } // Parse modules file