diff options
| author | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2018-06-04 00:01:38 -0300 |
|---|---|---|
| committer | Benjamin J. Culkin <bjculkin@mix.wvu.edu> | 2018-06-04 00:01:38 -0300 |
| commit | 2c842ce759095879036bb93321a528f83b77d1ee (patch) | |
| tree | 00b99aa54fb4066ee93a243a083080d970137503 /src/main/java/bjc/rgens/parser/RGrammarBuilder.java | |
| parent | 5c416488ef63b5004ca424de56894eb17712f116 (diff) | |
Add syntax features
This adds a few new syntax features, as well as allowing certain ones to
be used in pragmas.
The next syntax feature to be added will be some sort of quote feature,
to allow the inclusion of spaces where they would otherwise not be
permitted
Diffstat (limited to 'src/main/java/bjc/rgens/parser/RGrammarBuilder.java')
| -rwxr-xr-x | src/main/java/bjc/rgens/parser/RGrammarBuilder.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/bjc/rgens/parser/RGrammarBuilder.java b/src/main/java/bjc/rgens/parser/RGrammarBuilder.java index bc93fa6..20cba93 100755 --- a/src/main/java/bjc/rgens/parser/RGrammarBuilder.java +++ b/src/main/java/bjc/rgens/parser/RGrammarBuilder.java @@ -144,7 +144,7 @@ public class RGrammarBuilder { * If the rule name is either invalid or not defined by this * grammar, or if the suffix is invalid. */ - public void suffixWith(String ruleName, String... suffixes) { + public void suffixWith(String ruleName, IList<CaseElement> suffixes) { if (ruleName == null) { throw new NullPointerException("Rule name must not be null"); } else if (ruleName.equals("")) { @@ -155,9 +155,9 @@ public class RGrammarBuilder { throw new IllegalArgumentException(msg); } - Set<CaseElement> elements = new HashSet<>(suffixes.length); - for(String suffix : suffixes) { - elements.add(CaseElement.createElement(suffix)); + Set<CaseElement> elements = new HashSet<>(suffixes.getSize()); + for(CaseElement suffix : suffixes) { + elements.add(suffix); } List<List<CaseElement>> suffixLists = powerList(elements); @@ -206,7 +206,7 @@ public class RGrammarBuilder { * If the rule name is either invalid or not defined by this * grammar, or if the prefix is invalid. */ - public void prefixWith(String ruleName, String... prefixes) { + public void prefixWith(String ruleName, IList<CaseElement> prefixes) { if (ruleName == null) { throw new NullPointerException("Rule name must not be null"); } else if (ruleName.equals("")) { @@ -217,9 +217,9 @@ public class RGrammarBuilder { throw new IllegalArgumentException(msg); } - Set<CaseElement> elements = new HashSet<>(prefixes.length); - for(String prefix : prefixes) { - elements.add(CaseElement.createElement(prefix)); + Set<CaseElement> elements = new HashSet<>(prefixes.getSize()); + for(CaseElement prefix : prefixes) { + elements.add(prefix); } List<List<CaseElement>> prefixLists = powerList(elements); |
