summaryrefslogtreecommitdiff
path: root/tool/src/org/antlr/v4/codegen/model
diff options
context:
space:
mode:
Diffstat (limited to 'tool/src/org/antlr/v4/codegen/model')
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Action.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/AddToLabelList.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/AltBlock.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ArgAction.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/BaseListenerFile.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/BaseVisitorFile.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/CaptureNextToken.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/CaptureNextTokenType.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Choice.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/CodeBlockForAlt.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/CodeBlockForOuterMostAlt.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/DispatchMethod.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ElementFrequenciesVisitor.java92
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ExceptionClause.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/InvokeRule.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LL1AltBlock.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LL1Choice.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LL1Loop.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LL1OptionalBlock.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LL1OptionalBlockSingleAlt.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LL1PlusBlockSingleAlt.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LabeledOp.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LeftRecursiveRuleFunction.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Lexer.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/LexerFile.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ListenerDispatchMethod.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ListenerFile.java8
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Loop.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/MatchNotSet.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/MatchSet.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/MatchToken.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ModelElement.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/OptionalBlock.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/OutputFile.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/OutputModelObject.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Parser.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ParserFile.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/PlusBlock.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Recognizer.java4
-rw-r--r--tool/src/org/antlr/v4/codegen/model/RuleActionFunction.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/RuleElement.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/RuleFunction.java37
-rw-r--r--tool/src/org/antlr/v4/codegen/model/RuleSempredFunction.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/SemPred.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/SerializedATN.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/SrcOp.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/StarBlock.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Sync.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/TestSetInline.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ThrowEarlyExitException.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ThrowNoViableAlt.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/ThrowRecognitionException.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/VisitorDispatchMethod.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/VisitorFile.java8
-rw-r--r--tool/src/org/antlr/v4/codegen/model/Wildcard.java16
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ActionChunk.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ActionTemplate.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ActionText.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ArgRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/LabelRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ListLabelRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/LocalRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/NonLocalAttrRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/QRetValueRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/RetValueRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_ctx.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_parser.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_start.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_stop.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_text.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/SetAttr.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/SetNonLocalAttr.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_ctx.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_parser.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_start.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_stop.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_text.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_channel.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_index.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_int.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_line.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_pos.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_text.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_type.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/chunk/TokenRef.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/dbg.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/AltLabelStructDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/AttributeDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/CodeBlock.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ContextGetterDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ContextRuleGetterDecl.java7
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListGetterDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListIndexedGetterDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ContextTokenGetterDecl.java7
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListGetterDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListIndexedGetterDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/Decl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/ElementListDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/RuleContextDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/RuleContextListDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/StructDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/TokenDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/TokenListDecl.java2
-rw-r--r--tool/src/org/antlr/v4/codegen/model/decl/TokenTypeDecl.java2
107 files changed, 256 insertions, 121 deletions
diff --git a/tool/src/org/antlr/v4/codegen/model/Action.java b/tool/src/org/antlr/v4/codegen/model/Action.java
index 5e1e0ef..ada06ae 100644
--- a/tool/src/org/antlr/v4/codegen/model/Action.java
+++ b/tool/src/org/antlr/v4/codegen/model/Action.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/AddToLabelList.java b/tool/src/org/antlr/v4/codegen/model/AddToLabelList.java
index a492ee9..27a169a 100644
--- a/tool/src/org/antlr/v4/codegen/model/AddToLabelList.java
+++ b/tool/src/org/antlr/v4/codegen/model/AddToLabelList.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/AltBlock.java b/tool/src/org/antlr/v4/codegen/model/AltBlock.java
index a632921..db0654f 100644
--- a/tool/src/org/antlr/v4/codegen/model/AltBlock.java
+++ b/tool/src/org/antlr/v4/codegen/model/AltBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ArgAction.java b/tool/src/org/antlr/v4/codegen/model/ArgAction.java
index c52c72c..29dc530 100644
--- a/tool/src/org/antlr/v4/codegen/model/ArgAction.java
+++ b/tool/src/org/antlr/v4/codegen/model/ArgAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/BaseListenerFile.java b/tool/src/org/antlr/v4/codegen/model/BaseListenerFile.java
index 206fcee..6dc6546 100644
--- a/tool/src/org/antlr/v4/codegen/model/BaseListenerFile.java
+++ b/tool/src/org/antlr/v4/codegen/model/BaseListenerFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/BaseVisitorFile.java b/tool/src/org/antlr/v4/codegen/model/BaseVisitorFile.java
index 9fff357..6c41307 100644
--- a/tool/src/org/antlr/v4/codegen/model/BaseVisitorFile.java
+++ b/tool/src/org/antlr/v4/codegen/model/BaseVisitorFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/CaptureNextToken.java b/tool/src/org/antlr/v4/codegen/model/CaptureNextToken.java
index de49cdc..cbc0f28 100644
--- a/tool/src/org/antlr/v4/codegen/model/CaptureNextToken.java
+++ b/tool/src/org/antlr/v4/codegen/model/CaptureNextToken.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/CaptureNextTokenType.java b/tool/src/org/antlr/v4/codegen/model/CaptureNextTokenType.java
index 094d941..41f08ec 100644
--- a/tool/src/org/antlr/v4/codegen/model/CaptureNextTokenType.java
+++ b/tool/src/org/antlr/v4/codegen/model/CaptureNextTokenType.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/Choice.java b/tool/src/org/antlr/v4/codegen/model/Choice.java
index 9fb8a46..6b0d279 100644
--- a/tool/src/org/antlr/v4/codegen/model/Choice.java
+++ b/tool/src/org/antlr/v4/codegen/model/Choice.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/CodeBlockForAlt.java b/tool/src/org/antlr/v4/codegen/model/CodeBlockForAlt.java
index 12023a7..638f035 100644
--- a/tool/src/org/antlr/v4/codegen/model/CodeBlockForAlt.java
+++ b/tool/src/org/antlr/v4/codegen/model/CodeBlockForAlt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/CodeBlockForOuterMostAlt.java b/tool/src/org/antlr/v4/codegen/model/CodeBlockForOuterMostAlt.java
index ef3e9d6..236b1fe 100644
--- a/tool/src/org/antlr/v4/codegen/model/CodeBlockForOuterMostAlt.java
+++ b/tool/src/org/antlr/v4/codegen/model/CodeBlockForOuterMostAlt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/DispatchMethod.java b/tool/src/org/antlr/v4/codegen/model/DispatchMethod.java
index f7b3290..c68b936 100644
--- a/tool/src/org/antlr/v4/codegen/model/DispatchMethod.java
+++ b/tool/src/org/antlr/v4/codegen/model/DispatchMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ElementFrequenciesVisitor.java b/tool/src/org/antlr/v4/codegen/model/ElementFrequenciesVisitor.java
index ab5b86d..ccd5c80 100644
--- a/tool/src/org/antlr/v4/codegen/model/ElementFrequenciesVisitor.java
+++ b/tool/src/org/antlr/v4/codegen/model/ElementFrequenciesVisitor.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@@ -21,12 +21,30 @@ import java.util.Deque;
import java.util.Map;
public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
+ /**
+ * This special value means "no set", and is used by {@link #minFrequencies}
+ * to ensure that {@link #combineMin} doesn't merge an empty set (all zeros)
+ * with the results of the first alternative.
+ */
+ private static final FrequencySet<String> SENTINEL = new FrequencySet<String>();
+
final Deque<FrequencySet<String>> frequencies;
+ private final Deque<FrequencySet<String>> minFrequencies;
public ElementFrequenciesVisitor(TreeNodeStream input) {
super(input);
frequencies = new ArrayDeque<FrequencySet<String>>();
frequencies.push(new FrequencySet<String>());
+ minFrequencies = new ArrayDeque<FrequencySet<String>>();
+ minFrequencies.push(SENTINEL);
+ }
+
+ FrequencySet<String> getMinFrequencies() {
+ assert minFrequencies.size() == 1;
+ assert minFrequencies.peek() != SENTINEL;
+ assert SENTINEL.isEmpty();
+
+ return minFrequencies.peek();
}
/** During code gen, we can assume tree is in good shape */
@@ -62,6 +80,31 @@ public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
}
/**
+ * Generate a frequency set as the union of two input sets. If an
+ * element is contained in both sets, the value for the output will be
+ * the minimum of the two input values.
+ *
+ * @param a The first set.
+ * @param b The second set. If this set is {@link #SENTINEL}, it is treated
+ * as though no second set were provided.
+ * @return The union of the two sets, with the minimum value chosen
+ * whenever both sets contain the same key.
+ */
+ protected static FrequencySet<String> combineMin(FrequencySet<String> a, FrequencySet<String> b) {
+ if (b == SENTINEL) {
+ return a;
+ }
+
+ assert a != SENTINEL;
+ FrequencySet<String> result = combineAndClip(a, b, Integer.MAX_VALUE);
+ for (Map.Entry<String, MutableInt> entry : result.entrySet()) {
+ entry.getValue().v = Math.min(a.count(entry.getKey()), b.count(entry.getKey()));
+ }
+
+ return result;
+ }
+
+ /**
* Generate a frequency set as the union of two input sets, with the
* values clipped to a specified maximum value. If an element is
* contained in both sets, the value for the output, prior to clipping,
@@ -97,11 +140,13 @@ public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
@Override
public void tokenRef(TerminalAST ref) {
frequencies.peek().add(ref.getText());
+ minFrequencies.peek().add(ref.getText());
}
@Override
public void ruleRef(GrammarAST ref, ActionAST arg) {
frequencies.peek().add(ref.getText());
+ minFrequencies.peek().add(ref.getText());
}
/*
@@ -111,21 +156,50 @@ public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
@Override
protected void enterAlternative(AltAST tree) {
frequencies.push(new FrequencySet<String>());
+ minFrequencies.push(new FrequencySet<String>());
}
@Override
protected void exitAlternative(AltAST tree) {
frequencies.push(combineMax(frequencies.pop(), frequencies.pop()));
+ minFrequencies.push(combineMin(minFrequencies.pop(), minFrequencies.pop()));
}
@Override
protected void enterElement(GrammarAST tree) {
frequencies.push(new FrequencySet<String>());
+ minFrequencies.push(new FrequencySet<String>());
}
@Override
protected void exitElement(GrammarAST tree) {
frequencies.push(combineAndClip(frequencies.pop(), frequencies.pop(), 2));
+ minFrequencies.push(combineAndClip(minFrequencies.pop(), minFrequencies.pop(), 2));
+ }
+
+ @Override
+ protected void enterBlockSet(GrammarAST tree) {
+ frequencies.push(new FrequencySet<String>());
+ minFrequencies.push(new FrequencySet<String>());
+ }
+
+ @Override
+ protected void exitBlockSet(GrammarAST tree) {
+ for (Map.Entry<String, MutableInt> entry : frequencies.peek().entrySet()) {
+ // This visitor counts a block set as a sequence of elements, not a
+ // sequence of alternatives of elements. Reset the count back to 1
+ // for all items when leaving the set to ensure duplicate entries in
+ // the set are treated as a maximum of one item.
+ entry.getValue().v = 1;
+ }
+
+ if (minFrequencies.peek().size() > 1) {
+ // Everything is optional
+ minFrequencies.peek().clear();
+ }
+
+ frequencies.push(combineAndClip(frequencies.pop(), frequencies.pop(), 2));
+ minFrequencies.push(combineAndClip(minFrequencies.pop(), minFrequencies.pop(), 2));
}
@Override
@@ -135,6 +209,12 @@ public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
entry.getValue().v = 2;
}
}
+
+ if (tree.getType() == CLOSURE || tree.getType() == OPTIONAL) {
+ // Everything inside a closure is optional, so the minimum
+ // number of occurrences for all elements is 0.
+ minFrequencies.peek().clear();
+ }
}
/*
@@ -144,21 +224,25 @@ public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
@Override
protected void enterLexerAlternative(GrammarAST tree) {
frequencies.push(new FrequencySet<String>());
+ minFrequencies.push(new FrequencySet<String>());
}
@Override
protected void exitLexerAlternative(GrammarAST tree) {
frequencies.push(combineMax(frequencies.pop(), frequencies.pop()));
+ minFrequencies.push(combineMin(minFrequencies.pop(), minFrequencies.pop()));
}
@Override
protected void enterLexerElement(GrammarAST tree) {
frequencies.push(new FrequencySet<String>());
+ minFrequencies.push(new FrequencySet<String>());
}
@Override
protected void exitLexerElement(GrammarAST tree) {
frequencies.push(combineAndClip(frequencies.pop(), frequencies.pop(), 2));
+ minFrequencies.push(combineAndClip(minFrequencies.pop(), minFrequencies.pop(), 2));
}
@Override
@@ -168,5 +252,11 @@ public class ElementFrequenciesVisitor extends GrammarTreeVisitor {
entry.getValue().v = 2;
}
}
+
+ if (tree.getType() == CLOSURE) {
+ // Everything inside a closure is optional, so the minimum
+ // number of occurrences for all elements is 0.
+ minFrequencies.peek().clear();
+ }
}
}
diff --git a/tool/src/org/antlr/v4/codegen/model/ExceptionClause.java b/tool/src/org/antlr/v4/codegen/model/ExceptionClause.java
index 0eb7ddc..18aac15 100644
--- a/tool/src/org/antlr/v4/codegen/model/ExceptionClause.java
+++ b/tool/src/org/antlr/v4/codegen/model/ExceptionClause.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/InvokeRule.java b/tool/src/org/antlr/v4/codegen/model/InvokeRule.java
index bf83499..fb580cc 100644
--- a/tool/src/org/antlr/v4/codegen/model/InvokeRule.java
+++ b/tool/src/org/antlr/v4/codegen/model/InvokeRule.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LL1AltBlock.java b/tool/src/org/antlr/v4/codegen/model/LL1AltBlock.java
index 3437388..d1b6d3a 100644
--- a/tool/src/org/antlr/v4/codegen/model/LL1AltBlock.java
+++ b/tool/src/org/antlr/v4/codegen/model/LL1AltBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LL1Choice.java b/tool/src/org/antlr/v4/codegen/model/LL1Choice.java
index 9ef47d2..745ae4e 100644
--- a/tool/src/org/antlr/v4/codegen/model/LL1Choice.java
+++ b/tool/src/org/antlr/v4/codegen/model/LL1Choice.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LL1Loop.java b/tool/src/org/antlr/v4/codegen/model/LL1Loop.java
index 839a14d..78cfabd 100644
--- a/tool/src/org/antlr/v4/codegen/model/LL1Loop.java
+++ b/tool/src/org/antlr/v4/codegen/model/LL1Loop.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlock.java b/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlock.java
index 80f8d0b..652967e 100644
--- a/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlock.java
+++ b/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlockSingleAlt.java b/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlockSingleAlt.java
index 50579ca..6d4fbd2 100644
--- a/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlockSingleAlt.java
+++ b/tool/src/org/antlr/v4/codegen/model/LL1OptionalBlockSingleAlt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LL1PlusBlockSingleAlt.java b/tool/src/org/antlr/v4/codegen/model/LL1PlusBlockSingleAlt.java
index 227753f..dcfaf11 100644
--- a/tool/src/org/antlr/v4/codegen/model/LL1PlusBlockSingleAlt.java
+++ b/tool/src/org/antlr/v4/codegen/model/LL1PlusBlockSingleAlt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java b/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java
index fb787c1..27d46ee 100644
--- a/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java
+++ b/tool/src/org/antlr/v4/codegen/model/LL1StarBlockSingleAlt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LabeledOp.java b/tool/src/org/antlr/v4/codegen/model/LabeledOp.java
index b8d5441..73d24d7 100644
--- a/tool/src/org/antlr/v4/codegen/model/LabeledOp.java
+++ b/tool/src/org/antlr/v4/codegen/model/LabeledOp.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LeftRecursiveRuleFunction.java b/tool/src/org/antlr/v4/codegen/model/LeftRecursiveRuleFunction.java
index abe3f7f..cf6420e 100644
--- a/tool/src/org/antlr/v4/codegen/model/LeftRecursiveRuleFunction.java
+++ b/tool/src/org/antlr/v4/codegen/model/LeftRecursiveRuleFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/Lexer.java b/tool/src/org/antlr/v4/codegen/model/Lexer.java
index 2bc103e..35170e2 100644
--- a/tool/src/org/antlr/v4/codegen/model/Lexer.java
+++ b/tool/src/org/antlr/v4/codegen/model/Lexer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/LexerFile.java b/tool/src/org/antlr/v4/codegen/model/LexerFile.java
index 3fae78b..9e02c60 100644
--- a/tool/src/org/antlr/v4/codegen/model/LexerFile.java
+++ b/tool/src/org/antlr/v4/codegen/model/LexerFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ListenerDispatchMethod.java b/tool/src/org/antlr/v4/codegen/model/ListenerDispatchMethod.java
index cc861f0..2a8a39f 100644
--- a/tool/src/org/antlr/v4/codegen/model/ListenerDispatchMethod.java
+++ b/tool/src/org/antlr/v4/codegen/model/ListenerDispatchMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ListenerFile.java b/tool/src/org/antlr/v4/codegen/model/ListenerFile.java
index 24efd74..2066c16 100644
--- a/tool/src/org/antlr/v4/codegen/model/ListenerFile.java
+++ b/tool/src/org/antlr/v4/codegen/model/ListenerFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@@ -23,6 +23,7 @@ import java.util.Set;
*/
public class ListenerFile extends OutputFile {
public String genPackage; // from -package cmd-line
+ public String accessLevel; // from -DaccessLevel cmd-line
public String exportMacro; // from -DexportMacro cmd-line
public String grammarName;
public String parserName;
@@ -61,7 +62,8 @@ public class ListenerFile extends OutputFile {
}
ActionAST ast = g.namedActions.get("header");
if ( ast!=null ) header = new Action(factory, ast);
- genPackage = factory.getGrammar().tool.genPackage;
- exportMacro = factory.getGrammar().getOptionString("exportMacro");
+ genPackage = g.tool.genPackage;
+ accessLevel = g.getOptionString("accessLevel");
+ exportMacro = g.getOptionString("exportMacro");
}
}
diff --git a/tool/src/org/antlr/v4/codegen/model/Loop.java b/tool/src/org/antlr/v4/codegen/model/Loop.java
index 695685e..38d29d6 100644
--- a/tool/src/org/antlr/v4/codegen/model/Loop.java
+++ b/tool/src/org/antlr/v4/codegen/model/Loop.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/MatchNotSet.java b/tool/src/org/antlr/v4/codegen/model/MatchNotSet.java
index 4b86f5e..68687ee 100644
--- a/tool/src/org/antlr/v4/codegen/model/MatchNotSet.java
+++ b/tool/src/org/antlr/v4/codegen/model/MatchNotSet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/MatchSet.java b/tool/src/org/antlr/v4/codegen/model/MatchSet.java
index ab1f798..48e710c 100644
--- a/tool/src/org/antlr/v4/codegen/model/MatchSet.java
+++ b/tool/src/org/antlr/v4/codegen/model/MatchSet.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/MatchToken.java b/tool/src/org/antlr/v4/codegen/model/MatchToken.java
index 5399113..6756f82 100644
--- a/tool/src/org/antlr/v4/codegen/model/MatchToken.java
+++ b/tool/src/org/antlr/v4/codegen/model/MatchToken.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ModelElement.java b/tool/src/org/antlr/v4/codegen/model/ModelElement.java
index a0401de..cff1d61 100644
--- a/tool/src/org/antlr/v4/codegen/model/ModelElement.java
+++ b/tool/src/org/antlr/v4/codegen/model/ModelElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/OptionalBlock.java b/tool/src/org/antlr/v4/codegen/model/OptionalBlock.java
index 50b8fe3..ade58a1 100644
--- a/tool/src/org/antlr/v4/codegen/model/OptionalBlock.java
+++ b/tool/src/org/antlr/v4/codegen/model/OptionalBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/OutputFile.java b/tool/src/org/antlr/v4/codegen/model/OutputFile.java
index e238dae..cd23324 100644
--- a/tool/src/org/antlr/v4/codegen/model/OutputFile.java
+++ b/tool/src/org/antlr/v4/codegen/model/OutputFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/OutputModelObject.java b/tool/src/org/antlr/v4/codegen/model/OutputModelObject.java
index 5cfb1ee..96e44e4 100644
--- a/tool/src/org/antlr/v4/codegen/model/OutputModelObject.java
+++ b/tool/src/org/antlr/v4/codegen/model/OutputModelObject.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/Parser.java b/tool/src/org/antlr/v4/codegen/model/Parser.java
index 298bcff..4e5e135 100644
--- a/tool/src/org/antlr/v4/codegen/model/Parser.java
+++ b/tool/src/org/antlr/v4/codegen/model/Parser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ParserFile.java b/tool/src/org/antlr/v4/codegen/model/ParserFile.java
index 49181dd..4cd6b26 100644
--- a/tool/src/org/antlr/v4/codegen/model/ParserFile.java
+++ b/tool/src/org/antlr/v4/codegen/model/ParserFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/PlusBlock.java b/tool/src/org/antlr/v4/codegen/model/PlusBlock.java
index 088089c..424ae03 100644
--- a/tool/src/org/antlr/v4/codegen/model/PlusBlock.java
+++ b/tool/src/org/antlr/v4/codegen/model/PlusBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/Recognizer.java b/tool/src/org/antlr/v4/codegen/model/Recognizer.java
index 723dd08..5d79390 100644
--- a/tool/src/org/antlr/v4/codegen/model/Recognizer.java
+++ b/tool/src/org/antlr/v4/codegen/model/Recognizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@@ -24,6 +24,7 @@ public abstract class Recognizer extends OutputModelObject {
public String name;
public String grammarName;
public String grammarFileName;
+ public String accessLevel;
public Map<String,Integer> tokens;
/**
@@ -51,6 +52,7 @@ public abstract class Recognizer extends OutputModelObject {
grammarFileName = new File(g.fileName).getName();
grammarName = g.name;
name = g.getRecognizerName();
+ accessLevel = g.getOptionString("accessLevel");
tokens = new LinkedHashMap<String,Integer>();
for (Map.Entry<String, Integer> entry : g.tokenNameToTypeMap.entrySet()) {
Integer ttype = entry.getValue();
diff --git a/tool/src/org/antlr/v4/codegen/model/RuleActionFunction.java b/tool/src/org/antlr/v4/codegen/model/RuleActionFunction.java
index 624ffd4..fffd5d2 100644
--- a/tool/src/org/antlr/v4/codegen/model/RuleActionFunction.java
+++ b/tool/src/org/antlr/v4/codegen/model/RuleActionFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/RuleElement.java b/tool/src/org/antlr/v4/codegen/model/RuleElement.java
index ba0c0c0..8643bb9 100644
--- a/tool/src/org/antlr/v4/codegen/model/RuleElement.java
+++ b/tool/src/org/antlr/v4/codegen/model/RuleElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/RuleFunction.java b/tool/src/org/antlr/v4/codegen/model/RuleFunction.java
index d6e165e..d8b69b5 100644
--- a/tool/src/org/antlr/v4/codegen/model/RuleFunction.java
+++ b/tool/src/org/antlr/v4/codegen/model/RuleFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@@ -171,49 +171,66 @@ public class RuleFunction extends OutputModelObject {
*/
public Set<Decl> getDeclsForAllElements(List<AltAST> altASTs) {
Set<String> needsList = new HashSet<String>();
+ Set<String> nonOptional = new HashSet<String>();
List<GrammarAST> allRefs = new ArrayList<GrammarAST>();
+ boolean firstAlt = true;
for (AltAST ast : altASTs) {
IntervalSet reftypes = new IntervalSet(RULE_REF, TOKEN_REF);
List<GrammarAST> refs = ast.getNodesWithType(reftypes);
allRefs.addAll(refs);
- FrequencySet<String> altFreq = getElementFrequenciesForAlt(ast);
+ Pair<FrequencySet<String>, FrequencySet<String>> minAndAltFreq = getElementFrequenciesForAlt(ast);
+ FrequencySet<String> minFreq = minAndAltFreq.a;
+ FrequencySet<String> altFreq = minAndAltFreq.b;
for (GrammarAST t : refs) {
String refLabelName = t.getText();
if ( altFreq.count(refLabelName)>1 ) {
needsList.add(refLabelName);
}
+
+ if (firstAlt && minFreq.count(refLabelName) != 0) {
+ nonOptional.add(refLabelName);
+ }
+ }
+
+ for (String ref : nonOptional.toArray(new String[nonOptional.size()])) {
+ if (minFreq.count(ref) == 0) {
+ nonOptional.remove(ref);
+ }
}
+
+ firstAlt = false;
}
Set<Decl> decls = new LinkedHashSet<Decl>();
for (GrammarAST t : allRefs) {
String refLabelName = t.getText();
List<Decl> d = getDeclForAltElement(t,
refLabelName,
- needsList.contains(refLabelName));
+ needsList.contains(refLabelName),
+ !nonOptional.contains(refLabelName));
decls.addAll(d);
}
return decls;
}
/** Given list of X and r refs in alt, compute how many of each there are */
- protected FrequencySet<String> getElementFrequenciesForAlt(AltAST ast) {
+ protected Pair<FrequencySet<String>, FrequencySet<String>> getElementFrequenciesForAlt(AltAST ast) {
try {
ElementFrequenciesVisitor visitor = new ElementFrequenciesVisitor(new CommonTreeNodeStream(new GrammarASTAdaptor(), ast));
visitor.outerAlternative();
if (visitor.frequencies.size() != 1) {
factory.getGrammar().tool.errMgr.toolError(ErrorType.INTERNAL_ERROR);
- return new FrequencySet<String>();
+ return new Pair<>(new FrequencySet<String>(), new FrequencySet<String>());
}
- return visitor.frequencies.peek();
+ return new Pair<>(visitor.getMinFrequencies(), visitor.frequencies.peek());
}
catch (RecognitionException ex) {
factory.getGrammar().tool.errMgr.toolError(ErrorType.INTERNAL_ERROR, ex);
- return new FrequencySet<String>();
+ return new Pair<>(new FrequencySet<String>(), new FrequencySet<String>());
}
}
- public List<Decl> getDeclForAltElement(GrammarAST t, String refLabelName, boolean needList) {
+ public List<Decl> getDeclForAltElement(GrammarAST t, String refLabelName, boolean needList, boolean optional) {
List<Decl> decls = new ArrayList<Decl>();
if ( t.getType()==RULE_REF ) {
Rule rref = factory.getGrammar().getRule(t.getText());
@@ -225,7 +242,7 @@ public class RuleFunction extends OutputModelObject {
decls.add( new ContextRuleListIndexedGetterDecl(factory, refLabelName, ctxName) );
}
else {
- decls.add( new ContextRuleGetterDecl(factory, refLabelName, ctxName) );
+ decls.add( new ContextRuleGetterDecl(factory, refLabelName, ctxName, optional) );
}
}
else {
@@ -235,7 +252,7 @@ public class RuleFunction extends OutputModelObject {
decls.add( new ContextTokenListIndexedGetterDecl(factory, refLabelName) );
}
else {
- decls.add( new ContextTokenGetterDecl(factory, refLabelName) );
+ decls.add( new ContextTokenGetterDecl(factory, refLabelName, optional) );
}
}
return decls;
diff --git a/tool/src/org/antlr/v4/codegen/model/RuleSempredFunction.java b/tool/src/org/antlr/v4/codegen/model/RuleSempredFunction.java
index aba9d7e..75d10cb 100644
--- a/tool/src/org/antlr/v4/codegen/model/RuleSempredFunction.java
+++ b/tool/src/org/antlr/v4/codegen/model/RuleSempredFunction.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/SemPred.java b/tool/src/org/antlr/v4/codegen/model/SemPred.java
index e42649b..3496b44 100644
--- a/tool/src/org/antlr/v4/codegen/model/SemPred.java
+++ b/tool/src/org/antlr/v4/codegen/model/SemPred.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/SerializedATN.java b/tool/src/org/antlr/v4/codegen/model/SerializedATN.java
index 6a1094e..1ace766 100644
--- a/tool/src/org/antlr/v4/codegen/model/SerializedATN.java
+++ b/tool/src/org/antlr/v4/codegen/model/SerializedATN.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/SrcOp.java b/tool/src/org/antlr/v4/codegen/model/SrcOp.java
index ff9bd9d..ab51f88 100644
--- a/tool/src/org/antlr/v4/codegen/model/SrcOp.java
+++ b/tool/src/org/antlr/v4/codegen/model/SrcOp.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/StarBlock.java b/tool/src/org/antlr/v4/codegen/model/StarBlock.java
index 41b49f2..6c32293 100644
--- a/tool/src/org/antlr/v4/codegen/model/StarBlock.java
+++ b/tool/src/org/antlr/v4/codegen/model/StarBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/Sync.java b/tool/src/org/antlr/v4/codegen/model/Sync.java
index db5287e..3c4f23a 100644
--- a/tool/src/org/antlr/v4/codegen/model/Sync.java
+++ b/tool/src/org/antlr/v4/codegen/model/Sync.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/TestSetInline.java b/tool/src/org/antlr/v4/codegen/model/TestSetInline.java
index d4c9381..dfbfd03 100644
--- a/tool/src/org/antlr/v4/codegen/model/TestSetInline.java
+++ b/tool/src/org/antlr/v4/codegen/model/TestSetInline.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ThrowEarlyExitException.java b/tool/src/org/antlr/v4/codegen/model/ThrowEarlyExitException.java
index efadf44..870271f 100644
--- a/tool/src/org/antlr/v4/codegen/model/ThrowEarlyExitException.java
+++ b/tool/src/org/antlr/v4/codegen/model/ThrowEarlyExitException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ThrowNoViableAlt.java b/tool/src/org/antlr/v4/codegen/model/ThrowNoViableAlt.java
index 7bb6bbd..bc33dc8 100644
--- a/tool/src/org/antlr/v4/codegen/model/ThrowNoViableAlt.java
+++ b/tool/src/org/antlr/v4/codegen/model/ThrowNoViableAlt.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/ThrowRecognitionException.java b/tool/src/org/antlr/v4/codegen/model/ThrowRecognitionException.java
index 6653038..4f1d630 100644
--- a/tool/src/org/antlr/v4/codegen/model/ThrowRecognitionException.java
+++ b/tool/src/org/antlr/v4/codegen/model/ThrowRecognitionException.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/VisitorDispatchMethod.java b/tool/src/org/antlr/v4/codegen/model/VisitorDispatchMethod.java
index 90c6e82..3c62be8 100644
--- a/tool/src/org/antlr/v4/codegen/model/VisitorDispatchMethod.java
+++ b/tool/src/org/antlr/v4/codegen/model/VisitorDispatchMethod.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/VisitorFile.java b/tool/src/org/antlr/v4/codegen/model/VisitorFile.java
index 4abcdb1..3c746d6 100644
--- a/tool/src/org/antlr/v4/codegen/model/VisitorFile.java
+++ b/tool/src/org/antlr/v4/codegen/model/VisitorFile.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@@ -20,6 +20,7 @@ import java.util.Set;
public class VisitorFile extends OutputFile {
public String genPackage; // from -package cmd-line
+ public String accessLevel; // from -DaccessLevel cmd-line
public String exportMacro; // from -DexportMacro cmd-line
public String grammarName;
public String parserName;
@@ -58,7 +59,8 @@ public class VisitorFile extends OutputFile {
}
ActionAST ast = g.namedActions.get("header");
if ( ast!=null ) header = new Action(factory, ast);
- genPackage = factory.getGrammar().tool.genPackage;
- exportMacro = factory.getGrammar().getOptionString("exportMacro");
+ genPackage = g.tool.genPackage;
+ accessLevel = g.getOptionString("accessLevel");
+ exportMacro = g.getOptionString("exportMacro");
}
}
diff --git a/tool/src/org/antlr/v4/codegen/model/Wildcard.java b/tool/src/org/antlr/v4/codegen/model/Wildcard.java
new file mode 100644
index 0000000..977d22c
--- /dev/null
+++ b/tool/src/org/antlr/v4/codegen/model/Wildcard.java
@@ -0,0 +1,16 @@
+/*
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
+ * Use of this file is governed by the BSD 3-clause license that
+ * can be found in the LICENSE.txt file in the project root.
+ */
+
+package org.antlr.v4.codegen.model;
+
+import org.antlr.v4.codegen.OutputModelFactory;
+import org.antlr.v4.tool.ast.GrammarAST;
+
+public class Wildcard extends MatchToken {
+ public Wildcard(OutputModelFactory factory, GrammarAST ast) {
+ super(factory, ast);
+ }
+}
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ActionChunk.java b/tool/src/org/antlr/v4/codegen/model/chunk/ActionChunk.java
index 36775b5..53d046a 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ActionChunk.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ActionChunk.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ActionTemplate.java b/tool/src/org/antlr/v4/codegen/model/chunk/ActionTemplate.java
index 861fd8f..28dd97a 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ActionTemplate.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ActionTemplate.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ActionText.java b/tool/src/org/antlr/v4/codegen/model/chunk/ActionText.java
index b1c64c2..4ed87a1 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ActionText.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ActionText.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ArgRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/ArgRef.java
index 8544692..4c10fb1 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ArgRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ArgRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/LabelRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/LabelRef.java
index 5e5418b..3f703a8 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/LabelRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/LabelRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ListLabelRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/ListLabelRef.java
index 07dc911..dc941ba 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ListLabelRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ListLabelRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/LocalRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/LocalRef.java
index 6cf25ab..6a797cf 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/LocalRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/LocalRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/NonLocalAttrRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/NonLocalAttrRef.java
index db6763f..37698f7 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/NonLocalAttrRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/NonLocalAttrRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/QRetValueRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/QRetValueRef.java
index 245e77a..c31618a 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/QRetValueRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/QRetValueRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/RetValueRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/RetValueRef.java
index 07dfe64..ee67a15 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/RetValueRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/RetValueRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef.java
index ded613f..430917a 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_ctx.java b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_ctx.java
index 26301a0..aaec94f 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_ctx.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_ctx.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_parser.java b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_parser.java
index 16646b9..39b6690 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_parser.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_parser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_start.java b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_start.java
index ef485e5..8a0977b 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_start.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_start.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_stop.java b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_stop.java
index d649967..f213ab2 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_stop.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_stop.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_text.java b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_text.java
index f3d0a08..6ef2313 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_text.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/RulePropertyRef_text.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/SetAttr.java b/tool/src/org/antlr/v4/codegen/model/chunk/SetAttr.java
index 6c5755c..dac369b 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/SetAttr.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/SetAttr.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/SetNonLocalAttr.java b/tool/src/org/antlr/v4/codegen/model/chunk/SetNonLocalAttr.java
index c2e7924..0345c29 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/SetNonLocalAttr.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/SetNonLocalAttr.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_ctx.java b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_ctx.java
index 0293664..b14b452 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_ctx.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_ctx.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_parser.java b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_parser.java
index 22fc377..f1d6541 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_parser.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_parser.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_start.java b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_start.java
index c4cafec..bfb483c 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_start.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_start.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_stop.java b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_stop.java
index ea51694..fa1f7c6 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_stop.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_stop.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_text.java b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_text.java
index 696066a..504b1d4 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_text.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/ThisRulePropertyRef_text.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef.java
index 82c2f69..4a6433d 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_channel.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_channel.java
index 1404bf9..b69e096 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_channel.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_channel.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_index.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_index.java
index bb92a20..b92ea9f 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_index.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_index.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_int.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_int.java
index b02053f..24b6e22 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_int.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_int.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_line.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_line.java
index 0229204..f8dd162 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_line.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_line.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_pos.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_pos.java
index 7badb92..f7e964f 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_pos.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_pos.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_text.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_text.java
index d049c6e..05bfbab 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_text.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_text.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_type.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_type.java
index a8b4222..747b676 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_type.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenPropertyRef_type.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/chunk/TokenRef.java b/tool/src/org/antlr/v4/codegen/model/chunk/TokenRef.java
index d39115d..b2b6200 100644
--- a/tool/src/org/antlr/v4/codegen/model/chunk/TokenRef.java
+++ b/tool/src/org/antlr/v4/codegen/model/chunk/TokenRef.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/dbg.java b/tool/src/org/antlr/v4/codegen/model/dbg.java
index 0aaeebf..2f6aa07 100644
--- a/tool/src/org/antlr/v4/codegen/model/dbg.java
+++ b/tool/src/org/antlr/v4/codegen/model/dbg.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/AltLabelStructDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/AltLabelStructDecl.java
index b855b28..a0a8cc8 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/AltLabelStructDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/AltLabelStructDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/AttributeDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/AttributeDecl.java
index 80af232..0436752 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/AttributeDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/AttributeDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/CodeBlock.java b/tool/src/org/antlr/v4/codegen/model/decl/CodeBlock.java
index 89e1f20..2e608a1 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/CodeBlock.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/CodeBlock.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ContextGetterDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ContextGetterDecl.java
index fc4b262..b708f8a 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ContextGetterDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ContextGetterDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleGetterDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleGetterDecl.java
index b763965..322054d 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleGetterDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleGetterDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@@ -11,8 +11,11 @@ import org.antlr.v4.codegen.OutputModelFactory;
/** {@code public XContext X() { }} */
public class ContextRuleGetterDecl extends ContextGetterDecl {
public String ctxName;
- public ContextRuleGetterDecl(OutputModelFactory factory, String name, String ctxName) {
+ public boolean optional;
+
+ public ContextRuleGetterDecl(OutputModelFactory factory, String name, String ctxName, boolean optional) {
super(factory, name);
this.ctxName = ctxName;
+ this.optional = optional;
}
}
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListGetterDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListGetterDecl.java
index 4daf182..43e5d3c 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListGetterDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListGetterDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListIndexedGetterDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListIndexedGetterDecl.java
index 175394f..4399c4c 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListIndexedGetterDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ContextRuleListIndexedGetterDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenGetterDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenGetterDecl.java
index d663181..2ca6478 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenGetterDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenGetterDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
@@ -10,7 +10,10 @@ import org.antlr.v4.codegen.OutputModelFactory;
/** {@code public Token X() { }} */
public class ContextTokenGetterDecl extends ContextGetterDecl {
- public ContextTokenGetterDecl(OutputModelFactory factory, String name) {
+ public boolean optional;
+
+ public ContextTokenGetterDecl(OutputModelFactory factory, String name, boolean optional) {
super(factory, name);
+ this.optional = optional;
}
}
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListGetterDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListGetterDecl.java
index 7c8e2ff..0005d4b 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListGetterDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListGetterDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListIndexedGetterDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListIndexedGetterDecl.java
index bc722c9..4db542a 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListIndexedGetterDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ContextTokenListIndexedGetterDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/Decl.java b/tool/src/org/antlr/v4/codegen/model/decl/Decl.java
index 2cbcf9c..b2b9742 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/Decl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/Decl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/ElementListDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/ElementListDecl.java
index f5fa1bb..e89db11 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/ElementListDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/ElementListDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/RuleContextDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/RuleContextDecl.java
index a6c7eff..2169618 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/RuleContextDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/RuleContextDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/RuleContextListDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/RuleContextListDecl.java
index 8418dbf..decf0f6 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/RuleContextListDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/RuleContextListDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/StructDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/StructDecl.java
index 14a764c..f7a48ee 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/StructDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/StructDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/TokenDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/TokenDecl.java
index 6545125..b42e9c7 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/TokenDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/TokenDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/TokenListDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/TokenListDecl.java
index ecbfac7..beb334d 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/TokenListDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/TokenListDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/
diff --git a/tool/src/org/antlr/v4/codegen/model/decl/TokenTypeDecl.java b/tool/src/org/antlr/v4/codegen/model/decl/TokenTypeDecl.java
index c13ce63..da9e037 100644
--- a/tool/src/org/antlr/v4/codegen/model/decl/TokenTypeDecl.java
+++ b/tool/src/org/antlr/v4/codegen/model/decl/TokenTypeDecl.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012-2016 The ANTLR Project. All rights reserved.
+ * Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
* Use of this file is governed by the BSD 3-clause license that
* can be found in the LICENSE.txt file in the project root.
*/