rm Rule.scope field. not doing scope {...} anymore

[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 9442]
This commit is contained in:
parrt 2011-11-22 16:48:20 -08:00
parent 83e5e3fe7f
commit 2b36a19739
4 changed files with 0 additions and 9 deletions

View File

@ -254,10 +254,6 @@ public class SymbolChecks {
else if ( tokenIDs.contains(name) ) { else if ( tokenIDs.contains(name) ) {
etype = ErrorType.LABEL_CONFLICTS_WITH_TOKEN; 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) || else if ( (r.retvals!=null&&r.retvals.get(name)!=null) ||
(r.args!=null&&r.args.get(name)!=null) ) (r.args!=null&&r.args.get(name)!=null) )
{ {

View File

@ -99,7 +99,6 @@ public class Alternative implements AttributeResolver {
LabelElementPair anyLabelDef = getAnyLabelDef(x); LabelElementPair anyLabelDef = getAnyLabelDef(x);
if ( anyLabelDef!=null && anyLabelDef.type==LabelType.RULE_LABEL ) return true; 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 ( 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; return false;
} }

View File

@ -87,7 +87,6 @@ public enum ErrorType {
SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE(68, "symbol <arg> conflicts with global dynamic scope with same name", ErrorSeverity.ERROR), SYMBOL_CONFLICTS_WITH_GLOBAL_SCOPE(68, "symbol <arg> conflicts with global dynamic scope with same name", ErrorSeverity.ERROR),
LABEL_CONFLICTS_WITH_RULE(69, "label <arg> conflicts with rule with same name", ErrorSeverity.ERROR), LABEL_CONFLICTS_WITH_RULE(69, "label <arg> conflicts with rule with same name", ErrorSeverity.ERROR),
LABEL_CONFLICTS_WITH_TOKEN(70, "label <arg> conflicts with token with same name", ErrorSeverity.ERROR), LABEL_CONFLICTS_WITH_TOKEN(70, "label <arg> conflicts with token with same name", ErrorSeverity.ERROR),
LABEL_CONFLICTS_WITH_RULE_SCOPE_ATTRIBUTE(71, "label <arg> conflicts with rule <arg2>'s dynamically-scoped attribute with same name", ErrorSeverity.ERROR),
LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL(72, "label <arg> conflicts with rule <arg2>'s return value or parameter with same name", ErrorSeverity.ERROR), LABEL_CONFLICTS_WITH_RULE_ARG_RETVAL(72, "label <arg> conflicts with rule <arg2>'s return value or parameter with same name", ErrorSeverity.ERROR),
ATTRIBUTE_CONFLICTS_WITH_RULE(73, "rule <arg2>'s dynamically-scoped attribute <arg> conflicts with the rule name", ErrorSeverity.ERROR), ATTRIBUTE_CONFLICTS_WITH_RULE(73, "rule <arg2>'s dynamically-scoped attribute <arg> conflicts with the rule name", ErrorSeverity.ERROR),
ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL(74, "rule <arg2>'s dynamically-scoped attribute <arg> conflicts with <arg2>'s return value or parameter", ErrorSeverity.ERROR), ATTRIBUTE_CONFLICTS_WITH_RULE_ARG_RETVAL(74, "rule <arg2>'s dynamically-scoped attribute <arg> conflicts with <arg2>'s return value or parameter", ErrorSeverity.ERROR),

View File

@ -82,7 +82,6 @@ public class Rule implements AttributeResolver {
public AttributeDict args; public AttributeDict args;
public AttributeDict retvals; public AttributeDict retvals;
public AttributeDict locals; public AttributeDict locals;
public AttributeDict scope; // scope { int i; } // TODO: remove
/** In which grammar does this rule live? */ /** In which grammar does this rule live? */
public Grammar g; public Grammar g;
@ -261,7 +260,6 @@ public class Rule implements AttributeResolver {
public boolean resolvesToAttributeDict(String x, ActionAST node) { public boolean resolvesToAttributeDict(String x, ActionAST node) {
if ( resolvesToToken(x, node) ) return true; if ( resolvesToToken(x, node) ) return true;
if ( x.equals(name) ) return true; // $r for action in rule r, $r is a dict if ( x.equals(name) ) return true; // $r for action in rule r, $r is a dict
if ( scope!=null ) return true;
return false; return false;
} }
@ -307,7 +305,6 @@ public class Rule implements AttributeResolver {
buf.append("Rule{name="+name); buf.append("Rule{name="+name);
if ( args!=null ) buf.append(", args=" + args); if ( args!=null ) buf.append(", args=" + args);
if ( retvals!=null ) buf.append(", retvals=" + retvals); if ( retvals!=null ) buf.append(", retvals=" + retvals);
if ( scope!=null ) buf.append(", scope=" + scope);
buf.append("}"); buf.append("}");
return buf.toString(); return buf.toString();
} }