Merge pull request #2098 from jasonmoo/rule_context_methods_fix
Add RuleContext interface methods to reserved words
This commit is contained in:
commit
c1b7bf94f6
|
@ -170,3 +170,4 @@ YYYY/MM/DD, github id, Full name, email
|
||||||
2017/10/27, Griffon26, Maurice van der Pot, griffon26@kfk4ever.com
|
2017/10/27, Griffon26, Maurice van der Pot, griffon26@kfk4ever.com
|
||||||
2017/05/29, rlfnb, Ralf Neeb, rlfnb@rlfnb.de
|
2017/05/29, rlfnb, Ralf Neeb, rlfnb@rlfnb.de
|
||||||
2017/10/29, gendalph, Максим Прохоренко, Maxim\dotProhorenko@gm@il.com
|
2017/10/29, gendalph, Максим Прохоренко, Maxim\dotProhorenko@gm@il.com
|
||||||
|
2017/11/02, jasonmoo, Jason Mooberry, jason.mooberry@gmail.com
|
||||||
|
|
|
@ -49,8 +49,18 @@ public class GoTarget extends Target {
|
||||||
"make", "new", "panic", "print", "println", "real", "recover"
|
"make", "new", "panic", "print", "println", "real", "recover"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// interface definition of RuleContext from runtime/Go/antlr/rule_context.go
|
||||||
|
private static final String[] goRuleContextInterfaceMethods = {
|
||||||
|
"Accept", "GetAltNumber", "GetBaseRuleContext", "GetChild", "GetChildCount",
|
||||||
|
"GetChildren", "GetInvokingState", "GetParent", "GetPayload", "GetRuleContext",
|
||||||
|
"GetRuleIndex", "GetSourceInterval", "GetText", "IsEmpty", "SetAltNumber",
|
||||||
|
"SetInvokingState", "SetParent", "String"
|
||||||
|
};
|
||||||
|
|
||||||
/** Avoid grammar symbols in this set to prevent conflicts in gen'd code. */
|
/** Avoid grammar symbols in this set to prevent conflicts in gen'd code. */
|
||||||
private final Set<String> badWords = new HashSet<String>(goKeywords.length + goPredeclaredIdentifiers.length + 3);
|
private final Set<String> badWords = new HashSet<String>(
|
||||||
|
goKeywords.length + goPredeclaredIdentifiers.length + goRuleContextInterfaceMethods.length + 3
|
||||||
|
);
|
||||||
|
|
||||||
private static final boolean DO_GOFMT = !Boolean.parseBoolean(System.getenv("ANTLR_GO_DISABLE_GOFMT"))
|
private static final boolean DO_GOFMT = !Boolean.parseBoolean(System.getenv("ANTLR_GO_DISABLE_GOFMT"))
|
||||||
&& !Boolean.parseBoolean(System.getProperty("antlr.go.disable-gofmt"));
|
&& !Boolean.parseBoolean(System.getProperty("antlr.go.disable-gofmt"));
|
||||||
|
@ -75,6 +85,7 @@ public class GoTarget extends Target {
|
||||||
protected void addBadWords() {
|
protected void addBadWords() {
|
||||||
badWords.addAll(Arrays.asList(goKeywords));
|
badWords.addAll(Arrays.asList(goKeywords));
|
||||||
badWords.addAll(Arrays.asList(goPredeclaredIdentifiers));
|
badWords.addAll(Arrays.asList(goPredeclaredIdentifiers));
|
||||||
|
badWords.addAll(Arrays.asList(goRuleContextInterfaceMethods));
|
||||||
badWords.add("rule");
|
badWords.add("rule");
|
||||||
badWords.add("parserRule");
|
badWords.add("parserRule");
|
||||||
badWords.add("action");
|
badWords.add("action");
|
||||||
|
|
Loading…
Reference in New Issue