diff options
Diffstat (limited to 'tool/src/org/antlr/v4/tool')
7 files changed, 33 insertions, 30 deletions
diff --git a/tool/src/org/antlr/v4/tool/AttributeDict.java b/tool/src/org/antlr/v4/tool/AttributeDict.java index 911170d..e8d487f 100644 --- a/tool/src/org/antlr/v4/tool/AttributeDict.java +++ b/tool/src/org/antlr/v4/tool/AttributeDict.java @@ -39,7 +39,7 @@ import java.util.LinkedHashMap; import java.util.Set; /** Track the attributes within retval, arg lists etc... - * <p/> + * <p> * Each rule has potentially 3 scopes: return values, * parameters, and an implicitly-named scope (i.e., a scope defined in a rule). * Implicitly-defined scopes are named after the rule; rules and scopes then diff --git a/tool/src/org/antlr/v4/tool/ErrorType.java b/tool/src/org/antlr/v4/tool/ErrorType.java index 0fedfc4..32bb574 100644 --- a/tool/src/org/antlr/v4/tool/ErrorType.java +++ b/tool/src/org/antlr/v4/tool/ErrorType.java @@ -34,12 +34,12 @@ import org.antlr.v4.runtime.Lexer; /** * A complex enumeration of all the error messages that the tool can issue. - * <p/> + * <p> * When adding error messages, also add a description of the message to the * Wiki with a location under the Wiki page * <a href="http://www.antlr.org/wiki/display/ANTLR4/Errors+Reported+by+the+ANTLR+Tool">Errors Reported by the ANTLR Tool</a>. * - * @author Jim Idle <jimi@temporal-wave.com>, Terence Parr + * @author Jim Idle <jimi@temporal-wave.com>, Terence Parr * @since 4.0 */ public enum ErrorType { @@ -702,8 +702,8 @@ public enum ErrorType { * <p>The following rule produces this error.</p> * * <pre> - * X : 'foo' -> type(Foo); // ok - * Y : 'foo' -> token(Foo); // error 149 (token is not a supported lexer command) + * X : 'foo' -> type(Foo); // ok + * Y : 'foo' -> token(Foo); // error 149 (token is not a supported lexer command) * </pre> * * @since 4.1 @@ -719,8 +719,8 @@ public enum ErrorType { * <p>The following rule produces this error.</p> * * <pre> - * X : 'foo' -> type(Foo); // ok - * Y : 'foo' -> type; // error 150 (the type command requires an argument) + * X : 'foo' -> type(Foo); // ok + * Y : 'foo' -> type; // error 150 (the type command requires an argument) * </pre> * * @since 4.1 @@ -737,8 +737,8 @@ public enum ErrorType { * <p>The following rule produces this error.</p> * * <pre> - * X : 'foo' -> popMode; // ok - * Y : 'foo' -> popMode(A); // error 151 (the popMode command does not take an argument) + * X : 'foo' -> popMode; // ok + * Y : 'foo' -> popMode(A); // error 151 (the popMode command does not take an argument) * </pre> * * @since 4.1 @@ -825,8 +825,8 @@ public enum ErrorType { * public static final int CUSTOM = HIDDEN + 1; * } * - * X : 'foo' -> channel(HIDDEN); // ok - * Y : 'bar' -> channel(CUSTOM); // warning 155 + * X : 'foo' -> channel(HIDDEN); // ok + * Y : 'bar' -> channel(CUSTOM); // warning 155 * </pre> * * @since 4.2 @@ -891,12 +891,12 @@ public enum ErrorType { * <p>The following rule produces this warning.</p> * * <pre> - * X1 : 'x' -> more // ok + * X1 : 'x' -> more // ok * ; * Y1 : 'x' {more();} // ok * ; * fragment - * X2 : 'x' -> more // warning 158 + * X2 : 'x' -> more // warning 158 * ; * fragment * Y2 : 'x' {more();} // warning 158 diff --git a/tool/src/org/antlr/v4/tool/Grammar.java b/tool/src/org/antlr/v4/tool/Grammar.java index 5632ab4..89e2a26 100644 --- a/tool/src/org/antlr/v4/tool/Grammar.java +++ b/tool/src/org/antlr/v4/tool/Grammar.java @@ -101,6 +101,7 @@ public class Grammar implements AttributeResolver { public static final Set<String> parserOptions = new HashSet<String>(); static { parserOptions.add("superClass"); + parserOptions.add("contextSuperClass"); parserOptions.add("TokenLabelType"); parserOptions.add("tokenVocab"); parserOptions.add("language"); @@ -114,14 +115,14 @@ public class Grammar implements AttributeResolver { public static final Set<String> LexerBlockOptions = new HashSet<String>(); - /** Legal options for rule refs like id<key=value> */ + /** Legal options for rule refs like id<key=value> */ public static final Set<String> ruleRefOptions = new HashSet<String>(); static { ruleRefOptions.add(LeftRecursiveRuleTransformer.PRECEDENCE_OPTION_NAME); ruleRefOptions.add(LeftRecursiveRuleTransformer.TOKENINDEX_OPTION_NAME); } - /** Legal options for terminal refs like ID<assoc=right> */ + /** Legal options for terminal refs like ID<assoc=right> */ public static final Set<String> tokenOptions = new HashSet<String>(); static { tokenOptions.add("assoc"); @@ -553,15 +554,6 @@ public class Grammar implements AttributeResolver { public List<Grammar> getImportedGrammars() { return importedGrammars; } - /** Get delegates below direct delegates of g - public List<Grammar> getIndirectDelegates(Grammar g) { - List<Grammar> direct = getDirectDelegates(g); - List<Grammar> delegates = getDelegates(g); - delegates.removeAll(direct); - return delegates; - } -*/ - public LexerGrammar getImplicitLexer() { return implicitLexer; } diff --git a/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java b/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java index 8457a6a..936b8dc 100644 --- a/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java +++ b/tool/src/org/antlr/v4/tool/GrammarInterpreterRuleContext.java @@ -54,4 +54,15 @@ public class GrammarInterpreterRuleContext extends InterpreterRuleContext { public void setOuterAltNum(int outerAltNum) { this.outerAltNum = outerAltNum; } + + @Override + public int getAltNumber() { + // override here and called old functionality; makes it backward compatible vs changing names + return getOuterAltNum(); + } + + @Override + public void setAltNumber(int altNumber) { + setOuterAltNum(altNumber); + } } diff --git a/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java b/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java index 9361b40..1e77d57 100644 --- a/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java +++ b/tool/src/org/antlr/v4/tool/GrammarParserInterpreter.java @@ -151,7 +151,7 @@ public class GrammarParserInterpreter extends ParserInterpreter { * it's simple. Set decisionStatesThatSetOuterAltNumInContext * indicates which decision states should set the outer alternative number. * - * Left recursive rules are much more complicated to deal with: + * <p>Left recursive rules are much more complicated to deal with: * there is typically a decision for the primary alternatives and a * decision to choose between the recursive operator alternatives. * For example, the following left recursive rule has two primary and 2 diff --git a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java index 6759e20..9668838 100644 --- a/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java +++ b/tool/src/org/antlr/v4/tool/GrammarTransformPipeline.java @@ -166,11 +166,11 @@ public class GrammarTransformPipeline { /** Merge all the rules, token definitions, and named actions from imported grammars into the root grammar tree. Perform: - (tokens { X (= Y 'y')) + (tokens { Z ) -> (tokens { X (= Y 'y') Z) + (tokens { X (= Y 'y')) + (tokens { Z ) -> (tokens { X (= Y 'y') Z) - (@ members {foo}) + (@ members {bar}) -> (@ members {foobar}) + (@ members {foo}) + (@ members {bar}) -> (@ members {foobar}) - (RULES (RULE x y)) + (RULES (RULE z)) -> (RULES (RULE x y z)) + (RULES (RULE x y)) + (RULES (RULE z)) -> (RULES (RULE x y z)) Rules in root prevent same rule from being appended to RULES node. @@ -322,7 +322,7 @@ public class GrammarTransformPipeline { * We'll have this Grammar share token symbols later; don't generate * tokenVocab or tokens{} section. Copy over named actions. * - * Side-effects: it removes children from GRAMMAR & RULES nodes + * Side-effects: it removes children from GRAMMAR & RULES nodes * in combined AST. Anything cut out is dup'd before * adding to lexer to avoid "who's ur daddy" issues */ diff --git a/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java b/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java index 1d3b990..ad06e34 100644 --- a/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java +++ b/tool/src/org/antlr/v4/tool/LeftRecursiveRule.java @@ -136,7 +136,7 @@ public class LeftRecursiveRule extends Rule { return alts; } - /** Get -> labels from those alts we deleted for left-recursive rules. */ + /** Get -> labels from those alts we deleted for left-recursive rules. */ @Override public Map<String, List<Pair<Integer, AltAST>>> getAltLabels() { Map<String, List<Pair<Integer, AltAST>>> labels = new HashMap<String, List<Pair<Integer, AltAST>>>(); |