From 5253071132e48fbc347390abc487397583d00fe5 Mon Sep 17 00:00:00 2001 From: Gerwin Klein Date: Wed, 4 Dec 2019 19:51:26 +1030 Subject: [PATCH] decouple CharClasses from AbstractLexScan (#652) * decouple CharClasses from AbstractLexScan use UnicodeProperties directly --- jflex/src/main/java/jflex/core/CharClasses.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jflex/src/main/java/jflex/core/CharClasses.java b/jflex/src/main/java/jflex/core/CharClasses.java index 68090701e..f9a798d4c 100644 --- a/jflex/src/main/java/jflex/core/CharClasses.java +++ b/jflex/src/main/java/jflex/core/CharClasses.java @@ -13,6 +13,7 @@ import java.util.List; import java.util.Objects; import jflex.chars.Interval; +import jflex.core.unicode.UnicodeProperties; /** * Character Classes. @@ -34,7 +35,8 @@ public class CharClasses { /** the largest character actually used in a specification */ private int maxCharUsed; - public AbstractLexScan scanner; // nocommit - should be private + /** the @{link UnicodeProperties} the scanner used */ + private UnicodeProperties unicodeProps; /** * Constructs a new CharClasses object. @@ -65,7 +67,7 @@ public void init(int maxCharCode, AbstractLexScan scanner) { } maxCharUsed = maxCharCode; - this.scanner = scanner; + this.unicodeProps = scanner.getUnicodeProperties(); classes = new ArrayList<>(); classes.add(new IntCharSet(new Interval(0, maxCharCode))); } @@ -119,7 +121,7 @@ public int getNumClasses() { * @param caseless if true upper/lower/title case are considered equivalent */ public void makeClass(IntCharSet set, boolean caseless) { - if (caseless) set = set.getCaseless(scanner.getUnicodeProperties()); + if (caseless) set = set.getCaseless(unicodeProps); if (DEBUG) { Out.dump("makeClass(" + set + ")");