1 package antlr.debug; 2 3 public class ParserMatchEvent extends GuessingEvent { 4 public static int TOKEN=0; 7 public static int BITSET=1; 8 public static int CHAR=2; 9 public static int CHAR_BITSET=3; 10 public static int STRING=4; 11 public static int CHAR_RANGE=5; 12 private boolean inverse; 13 private boolean matched; 14 private Object target; 15 private int value; 16 private String text; 17 18 19 public ParserMatchEvent(Object source) { 20 super(source); 21 } 22 public ParserMatchEvent(Object source, int type, 23 int value, Object target, String text, int guessing, 24 boolean inverse, boolean matched) { 25 super(source); 26 setValues(type,value,target,text,guessing,inverse,matched); 27 } 28 public Object getTarget() { 29 return target; 30 } 31 public String getText() { 32 return text; 33 } 34 public int getValue() { 35 return value; 36 } 37 public boolean isInverse() { 38 return inverse; 39 } 40 public boolean isMatched() { 41 return matched; 42 } 43 void setInverse(boolean inverse) { 44 this.inverse = inverse; 45 } 46 void setMatched(boolean matched) { 47 this.matched = matched; 48 } 49 void setTarget(Object target) { 50 this.target = target; 51 } 52 void setText(String text) { 53 this.text = text; 54 } 55 void setValue(int value) { 56 this.value = value; 57 } 58 59 void setValues(int type, int value, Object target, String text, int guessing, boolean inverse, boolean matched) { 60 super.setValues(type, guessing); 61 setValue(value); 62 setTarget(target); 63 setInverse(inverse); 64 setMatched(matched); 65 setText(text); 66 } 67 public String toString() { 68 return "ParserMatchEvent [" + 69 (isMatched()?"ok,":"bad,") + 70 (isInverse()?"NOT ":"") + 71 (getType()==TOKEN?"token,":"bitset,") + 72 getValue() + "," + getTarget() + "," + getGuessing() + "]"; 73 } 74 } | Popular Tags |