[git-p4: depot-paths = "//depot/code/antlr4/main/": change = 6689]
This commit is contained in:
parrt 2010-02-12 16:13:04 -08:00
parent 172851245e
commit 66f179823d
5 changed files with 9 additions and 9 deletions

View File

@ -4,7 +4,7 @@ import org.antlr.runtime.Token;
public class ActionAST extends GrammarAST {
// Alt, rule, grammar space
public SymbolSpace space;
public AttributeResolver space;
public ActionAST(Token t) { super(t); }
public ActionAST(int type) { super(type); }
public ActionAST(int type, Token t) { super(type, t); }

View File

@ -9,7 +9,7 @@ import java.util.List;
/** Record use/def information about an outermost alternative in a subrule
* or rule of a grammar.
*/
public class Alternative implements SymbolSpace {
public class Alternative implements AttributeResolver {
Rule rule;
// token IDs, string literals in this alt
@ -33,7 +33,7 @@ public class Alternative implements SymbolSpace {
public Alternative(Rule r) { this.rule = r; }
public SymbolSpace getParent() {
public AttributeResolver getParent() {
return null;
}

View File

@ -5,8 +5,8 @@ package org.antlr.v4.tool;
* then ask space to resolve. If not found in one space we look
* at parent. Alt's parent is rule; rule's parent is grammar.
*/
public interface SymbolSpace {
public SymbolSpace getParent();
public interface AttributeResolver {
public AttributeResolver getParent();
public boolean resolves(String x, ActionAST node);
public boolean resolves(String x, String y, ActionAST node);
public boolean resolveToRuleRef(String x, ActionAST node);

View File

@ -11,7 +11,7 @@ import org.antlr.v4.parse.GrammarASTAdaptor;
import java.util.*;
public class Grammar implements SymbolSpace {
public class Grammar implements AttributeResolver {
public static final Set doNotCopyOptionsToLexer =
new HashSet() {
{
@ -210,7 +210,7 @@ public class Grammar implements SymbolSpace {
return null;
}
public SymbolSpace getParent() { return null; }
public AttributeResolver getParent() { return null; }
public boolean resolves(String x, ActionAST node) {
return false;

View File

@ -5,7 +5,7 @@ import org.stringtemplate.v4.misc.MultiMap;
import java.util.*;
public class Rule implements SymbolSpace {
public class Rule implements AttributeResolver {
/** Rule refs have a predefined set of attributes as well as
* the return values and args.
*/
@ -79,7 +79,7 @@ public class Rule implements SymbolSpace {
for (int i=1; i<=numberOfAlts; i++) alt[i] = new Alternative(this);
}
public SymbolSpace getParent() { return g; }
public AttributeResolver getParent() { return g; }
/** Is isolated x an arg, retval, predefined prop? */
public boolean resolves(String x, ActionAST node) {