From 2b36a19739fe09ce9523b49234aac559a3b6ee68 Mon Sep 17 00:00:00 2001 From: parrt Date: Tue, 22 Nov 2011 16:48:20 -0800 Subject: [PATCH] rm Rule.scope field. not doing scope {...} anymore [git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9442] --- tool/src/org/antlr/v4/semantics/SymbolChecks.java | 4 ---- tool/src/org/antlr/v4/tool/Alternative.java | 1 - tool/src/org/antlr/v4/tool/ErrorType.java | 1 - tool/src/org/antlr/v4/tool/Rule.java | 3 --- 4 files changed, 9 deletions(-) diff --git a/tool/src/org/antlr/v4/semantics/SymbolChecks.java b/tool/src/org/antlr/v4/semantics/SymbolChecks.java index 601b54507..43d32d8f4 100644 --- a/tool/src/org/antlr/v4/semantics/SymbolChecks.java +++ b/tool/src/org/antlr/v4/semantics/SymbolChecks.java @@ -254,10 +254,6 @@ public class SymbolChecks { else if ( tokenIDs.contains(name) ) { etype = ErrorType.LABEL_CONFLICTS_WITH_TOKEN; } - else if ( r.scope !=null && r.scope.get(name)!=null ) { - etype = ErrorType.LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE; - arg2 = r.name; - } else if ( (r.retvals!=null&&r.retvals.get(name)!=null) || (r.args!=null&&r.args.get(name)!=null) ) { diff --git a/tool/src/org/antlr/v4/tool/Alternative.java b/tool/src/org/antlr/v4/tool/Alternative.java index 2149fe3dd..9ead730e4 100644 --- a/tool/src/org/antlr/v4/tool/Alternative.java +++ b/tool/src/org/antlr/v4/tool/Alternative.java @@ -99,7 +99,6 @@ public class Alternative implements AttributeResolver { LabelElementPair anyLabelDef = getAnyLabelDef(x); if ( anyLabelDef!=null && anyLabelDef.type==LabelType.RULE_LABEL ) return true; if ( x.equals(rule.name) ) return true; // $r for action in rule r, $r is a dict - if ( rule!=null && rule.scope!=null ) return true; return false; } diff --git a/tool/src/org/antlr/v4/tool/ErrorType.java b/tool/src/org/antlr/v4/tool/ErrorType.java index 48afbf81d..6f321b237 100644 --- a/tool/src/org/antlr/v4/tool/ErrorType.java +++ b/tool/src/org/antlr/v4/tool/ErrorType.java @@ -87,7 +87,6 @@ public enum ErrorType { SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE(68, "symbol conflicts with global dynamic scope with same name", ErrorSeverity.ERROR), LABEL_CONFLICTS_WITH_RULE(69, "label conflicts with rule with same name", ErrorSeverity.ERROR), LABEL_CONFLICTS_WITH_TOKEN(70, "label conflicts with token with same name", ErrorSeverity.ERROR), - LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE(71, "label conflicts with rule 's dynamically-scoped attribute with same name", ErrorSeverity.ERROR), LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL(72, "label conflicts with rule 's return value or parameter with same name", ErrorSeverity.ERROR), ATTRIBUTE_CONFLICTS_WITH_RULE(73, "rule 's dynamically-scoped attribute conflicts with the rule name", ErrorSeverity.ERROR), ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL(74, "rule 's dynamically-scoped attribute conflicts with 's return value or parameter", ErrorSeverity.ERROR), diff --git a/tool/src/org/antlr/v4/tool/Rule.java b/tool/src/org/antlr/v4/tool/Rule.java index 7c2acdf34..4fcafbfb3 100644 --- a/tool/src/org/antlr/v4/tool/Rule.java +++ b/tool/src/org/antlr/v4/tool/Rule.java @@ -82,7 +82,6 @@ public class Rule implements AttributeResolver { public AttributeDict args; public AttributeDict retvals; public AttributeDict locals; - public AttributeDict scope; // scope { int i; } // TODO: remove /** In which grammar does this rule live? */ public Grammar g; @@ -261,7 +260,6 @@ public class Rule implements AttributeResolver { public boolean resolvesToAttributeDict(String x, ActionAST node) { if ( resolvesToToken(x, node) ) return true; if ( x.equals(name) ) return true; // $r for action in rule r, $r is a dict - if ( scope!=null ) return true; return false; } @@ -307,7 +305,6 @@ public class Rule implements AttributeResolver { buf.append("Rule{name="+name); if ( args!=null ) buf.append(", args=" + args); if ( retvals!=null ) buf.append(", retvals=" + retvals); - if ( scope!=null ) buf.append(", scope=" + scope); buf.append("}"); return buf.toString(); }