1 package persistence.antlr; 2 3 8 9 class RuleRefElement extends AlternativeElement { 10 protected String targetRule; protected String args = null; protected String idAssign = null; protected String label; 14 15 16 public RuleRefElement(Grammar g, Token t, int autoGenType_) { 17 super(g, t, autoGenType_); 18 targetRule = t.getText(); 19 if (t.type == ANTLRTokenTypes.TOKEN_REF) { targetRule = CodeGenerator.encodeLexerRuleName(targetRule); 22 } 23 } 24 25 34 public void generate() { 35 grammar.generator.gen(this); 36 } 37 38 public String getArgs() { 39 return args; 40 } 41 42 public String getIdAssign() { 43 return idAssign; 44 } 45 46 public String getLabel() { 47 return label; 48 } 49 50 public Lookahead look(int k) { 51 return grammar.theLLkAnalyzer.look(k, this); 52 } 53 54 public void setArgs(String a) { 55 args = a; 56 } 57 58 public void setIdAssign(String id) { 59 idAssign = id; 60 } 61 62 public void setLabel(String label_) { 63 label = label_; 64 } 65 66 public String toString() { 67 if (args != null) 68 return " " + targetRule + args; 69 else 70 return " " + targetRule; 71 } 72 } 73 | Popular Tags |