/* Generated By:JavaCC: Do not edit this line. Parser.java */ import edu.neu.ccs.demeter.dj.*; import edu.neu.ccs.demeter.*; public class Parser implements ParserConstants { // oit is uugly. Why isn't there a Character.valueOf(String)? static char unescapifyChar(String s) { char c = s.charAt(0); if (c == '\\') { switch (s.charAt(1)) { case 'n': c = '\n'; break; case 't': c = '\t'; break; case 'b': c = '\b'; break; case 'r': c = '\r'; break; case 'f': c = '\f'; break; case '\\': c = '\\'; break; case '\'': c = '\''; break; case '\"': c = '\"'; break; default: c = (char) Integer.parseInt(s.substring(1, s.length()), 8); break; } } return c; } // Even uglier... static String unescapify(String s) { char str[] = new char[s.length()]; int i = 0, o = 0; while (i < s.length()) { char c = s.charAt(i++); if (c == '\\') { int j = i + 1; while (j < s.length() && Character.digit(s.charAt(j), 8) != -1) { j++; } c = unescapifyChar(s.substring(i-1, j)); i = j; } str[o++] = c; } return String.valueOf(str, 0, o); } final public Main _Main() throws ParseException { Main it = null; it=new Main(); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Histories _Histories() throws ParseException { Histories it = null; NewStrategy_PList _newstrategy_plist; HistoryPcd_PList _historypcd_plist; it=new Histories(); _newstrategy_plist = _NewStrategy_PList(); it.set_newstrategy_plist(_newstrategy_plist); _historypcd_plist = _HistoryPcd_PList(); it.set_historypcd_plist(_historypcd_plist); {if (true) return it;} throw new Error("Missing return statement in function"); } final public HistoryPcd _HistoryPcd() throws ParseException { HistoryPcd it = null; NewStrategy _newstrategy; it=new HistoryPcd(); jj_consume_token(1); jj_consume_token(2); _newstrategy = _NewStrategy(); it.set_newstrategy(_newstrategy); jj_consume_token(3); {if (true) return it;} throw new Error("Missing return statement in function"); } final public NewStrategy _NewStrategy() throws ParseException { NewStrategy it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 4: case 5: it = _PrimitiveNewStrategy(); break; case 7: case 9: case 11: case 12: case 13: case 15: it = _CompositeNewStrategy(); break; default: jj_la1[0] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return it;} throw new Error("Missing return statement in function"); } final public void common_NewStrategy(NewStrategy it) throws ParseException { } final public PrimitiveNewStrategy _PrimitiveNewStrategy() throws ParseException { PrimitiveNewStrategy it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 4: it = _Entry(); break; case 5: it = _Exit(); break; default: jj_la1[1] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return it;} throw new Error("Missing return statement in function"); } final public void common_PrimitiveNewStrategy(PrimitiveNewStrategy it) throws ParseException { common_NewStrategy(it); } final public Entry _Entry() throws ParseException { Entry it = null; Pointcut _pointcut; it=new Entry(); jj_consume_token(4); jj_consume_token(2); _pointcut = _Pointcut(); it.set_pointcut(_pointcut); jj_consume_token(3); common_PrimitiveNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Exit _Exit() throws ParseException { Exit it = null; Pointcut _pointcut; it=new Exit(); jj_consume_token(5); jj_consume_token(2); _pointcut = _Pointcut(); it.set_pointcut(_pointcut); jj_consume_token(3); common_PrimitiveNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Pointcut _Pointcut() throws ParseException { Pointcut it = null; PointcutName _pointcutname; it=new Pointcut(); jj_consume_token(6); _pointcutname = _PointcutName(); it.set_pointcutname(_pointcutname); {if (true) return it;} throw new Error("Missing return statement in function"); } final public CompositeNewStrategy _CompositeNewStrategy() throws ParseException { CompositeNewStrategy it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 7: case 9: it = _NamedNewStrategy(); break; case 11: it = _NamedNewStrategyRef(); break; case 12: it = _OrderedNewStrategy(); break; case 13: it = _OptionalNewStrategy(); break; case 15: it = _ZeroOrMoreNewStrategy(); break; default: jj_la1[2] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return it;} throw new Error("Missing return statement in function"); } final public void common_CompositeNewStrategy(CompositeNewStrategy it) throws ParseException { common_NewStrategy(it); } final public NamedNewStrategy _NamedNewStrategy() throws ParseException { NamedNewStrategy it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 7: it = _AbstractNewStrategy(); break; case 9: it = _ConcreteNewStrategy(); break; default: jj_la1[3] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return it;} throw new Error("Missing return statement in function"); } final public void common_NamedNewStrategy(NamedNewStrategy it) throws ParseException { common_CompositeNewStrategy(it); } final public AbstractNewStrategy _AbstractNewStrategy() throws ParseException { AbstractNewStrategy it = null; Modifiers _modifiers; NewStrategyName _newstrategyname; Formals _formals; it=new AbstractNewStrategy(); jj_consume_token(7); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 17: _modifiers = _Modifiers(); it.set_modifiers(_modifiers); break; default: jj_la1[4] = jj_gen; ; } jj_consume_token(8); _newstrategyname = _NewStrategyName(); it.set_newstrategyname(_newstrategyname); jj_consume_token(2); _formals = _Formals(); it.set_formals(_formals); jj_consume_token(3); common_NamedNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ConcreteNewStrategy _ConcreteNewStrategy() throws ParseException { ConcreteNewStrategy it = null; Modifiers _modifiers; NewStrategyName _newstrategyname; Formals _formals; OrderedNewStrategy_BarList _orderednewstrategy_barlist; it=new ConcreteNewStrategy(); jj_consume_token(9); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 17: _modifiers = _Modifiers(); it.set_modifiers(_modifiers); break; default: jj_la1[5] = jj_gen; ; } jj_consume_token(8); _newstrategyname = _NewStrategyName(); it.set_newstrategyname(_newstrategyname); jj_consume_token(2); _formals = _Formals(); it.set_formals(_formals); jj_consume_token(3); jj_consume_token(10); _orderednewstrategy_barlist = _OrderedNewStrategy_BarList(); it.set_orderednewstrategy_barlist(_orderednewstrategy_barlist); common_NamedNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public NamedNewStrategyRef _NamedNewStrategyRef() throws ParseException { NamedNewStrategyRef it = null; NewStrategyName _newstrategyname; Actuals _actuals; it=new NamedNewStrategyRef(); jj_consume_token(11); _newstrategyname = _NewStrategyName(); it.set_newstrategyname(_newstrategyname); jj_consume_token(2); _actuals = _Actuals(); it.set_actuals(_actuals); jj_consume_token(3); common_CompositeNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public OrderedNewStrategy _OrderedNewStrategy() throws ParseException { OrderedNewStrategy it = null; NewStrategy_PList _newstrategy_plist; it=new OrderedNewStrategy(); jj_consume_token(12); _newstrategy_plist = _NewStrategy_PList(); it.set_newstrategy_plist(_newstrategy_plist); common_CompositeNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public OptionalNewStrategy _OptionalNewStrategy() throws ParseException { OptionalNewStrategy it = null; NewStrategy _newstrategy; it=new OptionalNewStrategy(); jj_consume_token(13); _newstrategy = _NewStrategy(); it.set_newstrategy(_newstrategy); jj_consume_token(14); common_CompositeNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ZeroOrMoreNewStrategy _ZeroOrMoreNewStrategy() throws ParseException { ZeroOrMoreNewStrategy it = null; NewStrategy _newstrategy; it=new ZeroOrMoreNewStrategy(); jj_consume_token(15); _newstrategy = _NewStrategy(); it.set_newstrategy(_newstrategy); jj_consume_token(16); common_CompositeNewStrategy(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Modifiers _Modifiers() throws ParseException { Modifiers it = null; it=new Modifiers(); jj_consume_token(17); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Formals _Formals() throws ParseException { Formals it = null; Pair_CList _pair_clist; it=new Formals(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _pair_clist = _Pair_CList(); it.set_pair_clist(_pair_clist); break; default: jj_la1[6] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Pair _Pair() throws ParseException { Pair it = null; TypeName _typename; VariableName _variablename; it=new Pair(); _typename = _TypeName(); it.set_typename(_typename); _variablename = _VariableName(); it.set_variablename(_variablename); {if (true) return it;} throw new Error("Missing return statement in function"); } final public TypeName _TypeName() throws ParseException { TypeName it = null; Ident _ident; it=new TypeName(); _ident = _Ident(); it.set_ident(_ident); {if (true) return it;} throw new Error("Missing return statement in function"); } final public VariableName _VariableName() throws ParseException { VariableName it = null; Ident _ident; it=new VariableName(); _ident = _Ident(); it.set_ident(_ident); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Actuals _Actuals() throws ParseException { Actuals it = null; it=new Actuals(); jj_consume_token(18); {if (true) return it;} throw new Error("Missing return statement in function"); } final public NewStrategyName _NewStrategyName() throws ParseException { NewStrategyName it = null; Ident _ident; it=new NewStrategyName(); _ident = _Ident(); it.set_ident(_ident); {if (true) return it;} throw new Error("Missing return statement in function"); } final public PointcutName _PointcutName() throws ParseException { PointcutName it = null; Ident _ident; it=new PointcutName(); _ident = _Ident(); it.set_ident(_ident); jj_consume_token(19); {if (true) return it;} throw new Error("Missing return statement in function"); } final public NewStrategy_PList _NewStrategy_PList() throws ParseException { NewStrategy_PList it = null; Nonempty_NewStrategy_PList _first; it=new NewStrategy_PList(); jj_consume_token(2); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 4: case 5: case 7: case 9: case 11: case 12: case 13: case 15: _first = _Nonempty_NewStrategy_PList(); it.set_first(_first); break; default: jj_la1[7] = jj_gen; ; } jj_consume_token(3); {if (true) return it;} throw new Error("Missing return statement in function"); } final public HistoryPcd_PList _HistoryPcd_PList() throws ParseException { HistoryPcd_PList it = null; Nonempty_HistoryPcd_PList _first; it=new HistoryPcd_PList(); jj_consume_token(2); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: _first = _Nonempty_HistoryPcd_PList(); it.set_first(_first); break; default: jj_la1[8] = jj_gen; ; } jj_consume_token(3); {if (true) return it;} throw new Error("Missing return statement in function"); } final public OrderedNewStrategy_BarList _OrderedNewStrategy_BarList() throws ParseException { OrderedNewStrategy_BarList it = null; Nonempty_OrderedNewStrategy_BarList _first; it=new OrderedNewStrategy_BarList(); jj_consume_token(2); _first = _Nonempty_OrderedNewStrategy_BarList(); it.set_first(_first); jj_consume_token(3); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Pair_CList _Pair_CList() throws ParseException { Pair_CList it = null; Nonempty_Pair_CList _first; it=new Pair_CList(); _first = _Nonempty_Pair_CList(); it.set_first(_first); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_NewStrategy_PList _Nonempty_NewStrategy_PList() throws ParseException { Nonempty_NewStrategy_PList it = null; NewStrategy _it; Nonempty_NewStrategy_PList _next; it=new Nonempty_NewStrategy_PList(); _it = _NewStrategy(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 4: case 5: case 7: case 9: case 11: case 12: case 13: case 15: _next = _Nonempty_NewStrategy_PList(); it.set_next(_next); break; default: jj_la1[9] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_HistoryPcd_PList _Nonempty_HistoryPcd_PList() throws ParseException { Nonempty_HistoryPcd_PList it = null; HistoryPcd _it; Nonempty_HistoryPcd_PList _next; it=new Nonempty_HistoryPcd_PList(); _it = _HistoryPcd(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: _next = _Nonempty_HistoryPcd_PList(); it.set_next(_next); break; default: jj_la1[10] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_OrderedNewStrategy_BarList _Nonempty_OrderedNewStrategy_BarList() throws ParseException { Nonempty_OrderedNewStrategy_BarList it = null; OrderedNewStrategy _it; Nonempty_OrderedNewStrategy_BarList _next; it=new Nonempty_OrderedNewStrategy_BarList(); _it = _OrderedNewStrategy(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 20: jj_consume_token(20); _next = _Nonempty_OrderedNewStrategy_BarList(); it.set_next(_next); break; default: jj_la1[11] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_Pair_CList _Nonempty_Pair_CList() throws ParseException { Nonempty_Pair_CList it = null; Pair _it; Nonempty_Pair_CList _next; it=new Nonempty_Pair_CList(); _it = _Pair(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 21: jj_consume_token(21); _next = _Nonempty_Pair_CList(); it.set_next(_next); break; default: jj_la1[12] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public boolean _boolean() throws ParseException { Token t; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRUE: t = jj_consume_token(TRUE); {if (true) return true;} break; case FALSE: t = jj_consume_token(FALSE); {if (true) return false;} break; default: jj_la1[13] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } final public char _char() throws ParseException { Token t; t = jj_consume_token(CHARACTER_LITERAL); String s = t.image; {if (true) return unescapifyChar(s.substring(1, s.length()-1));} throw new Error("Missing return statement in function"); } final public byte _byte() throws ParseException { int i; i = _int(); {if (true) return (byte) i;} throw new Error("Missing return statement in function"); } final public short _short() throws ParseException { int i; i = _int(); {if (true) return (short) i;} throw new Error("Missing return statement in function"); } final public int _int() throws ParseException { Number num; num = _Number(); {if (true) return num.intValue();} throw new Error("Missing return statement in function"); } final public long _long() throws ParseException { Number num; num = _Number(); {if (true) return num.longValue();} throw new Error("Missing return statement in function"); } final public float _float() throws ParseException { Number num; num = _Number(); {if (true) return num.floatValue();} throw new Error("Missing return statement in function"); } final public double _double() throws ParseException { Number num; num = _Number(); {if (true) return num.doubleValue();} throw new Error("Missing return statement in function"); } final public Boolean _Boolean() throws ParseException { Token t; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case TRUE: t = jj_consume_token(TRUE); {if (true) return Boolean.TRUE;} break; case FALSE: t = jj_consume_token(FALSE); {if (true) return Boolean.FALSE;} break; default: jj_la1[14] = jj_gen; jj_consume_token(-1); throw new ParseException(); } throw new Error("Missing return statement in function"); } final public Character _Character() throws ParseException { char c; c = _char(); {if (true) return new Character(c);} throw new Error("Missing return statement in function"); } final public Integer _Integer() throws ParseException { int i; i = _int(); {if (true) return new Integer(i);} throw new Error("Missing return statement in function"); } final public Long _Long() throws ParseException { long l; l = _long(); {if (true) return new Long(l);} throw new Error("Missing return statement in function"); } final public Float _Float() throws ParseException { float f; f = _float(); {if (true) return new Float(f);} throw new Error("Missing return statement in function"); } final public Double _Double() throws ParseException { double d; d = _double(); {if (true) return new Double(d);} throw new Error("Missing return statement in function"); } final public Number _Number() throws ParseException { Token t; String s = null; int radix = 0; Number num = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DECIMAL_LITERAL: case HEX_LITERAL: case OCTAL_LITERAL: switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case DECIMAL_LITERAL: t = jj_consume_token(DECIMAL_LITERAL); s = t.image; radix = 10; break; case HEX_LITERAL: t = jj_consume_token(HEX_LITERAL); // Strip off the "0x". s = t.image.substring(2, t.image.length()); radix = 16; break; case OCTAL_LITERAL: t = jj_consume_token(OCTAL_LITERAL); s = t.image; radix = 8; break; default: jj_la1[15] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch (s.charAt(s.length()-1)) { case 'l': case 'L': s = s.substring(0, s.length()-1); num = new Long(new java.math.BigInteger(s, radix).longValue()); break; default: num = new Integer(new java.math.BigInteger(s, radix).intValue()); break; } break; case FLOATING_POINT_LITERAL: t = jj_consume_token(FLOATING_POINT_LITERAL); s = t.image; switch (s.charAt(s.length()-1)) { case 'd': case 'D': num = Double.valueOf(s.substring(0, s.length()-1)); break; case 'f': case 'F': num = Float.valueOf(s.substring(0, s.length()-1)); break; default: num = Float.valueOf(s); break; } break; default: jj_la1[16] = jj_gen; jj_consume_token(-1); throw new ParseException(); } {if (true) return num;} throw new Error("Missing return statement in function"); } final public String _String() throws ParseException { Token t; t = jj_consume_token(STRING_LITERAL); String s = t.image; {if (true) return unescapify(s.substring(1, s.length()-1));} throw new Error("Missing return statement in function"); } final public StringBuffer _StringBuffer() throws ParseException { String s; s = _String(); {if (true) return new StringBuffer(s);} throw new Error("Missing return statement in function"); } final public Ident _Ident() throws ParseException { Token t; t = jj_consume_token(IDENTIFIER); {if (true) return new Ident(t.image);} throw new Error("Missing return statement in function"); } final public Text _Text() throws ParseException { Token t; t = jj_consume_token(TEXT_LITERAL); String s = t.image; {if (true) return new Text(s.substring(2, s.length()-2));} throw new Error("Missing return statement in function"); } final public Line _Line() throws ParseException { Token t; token_source.SwitchTo(1); t = jj_consume_token(LINE); {if (true) return new Line(t.image);} throw new Error("Missing return statement in function"); } final public Word _Word() throws ParseException { Token t; token_source.SwitchTo(2); t = jj_consume_token(WORD); {if (true) return new Word(t.image);} throw new Error("Missing return statement in function"); } public ParserTokenManager token_source; ASCII_UCodeESC_CharStream jj_input_stream; public Token token, jj_nt; private int jj_ntk; private int jj_gen; final private int[] jj_la1 = new int[17]; final private int[] jj_la1_0 = {0xbab0,0x30,0xba80,0x280,0x20000,0x20000,0x0,0xbab0,0x2,0xbab0,0x2,0x100000,0x200000,0x0,0x0,0x70000000,0xf0000000,}; final private int[] jj_la1_1 = {0x0,0x0,0x0,0x0,0x0,0x0,0x40,0x0,0x0,0x0,0x0,0x0,0x0,0x30,0x30,0x0,0x0,}; public Parser(java.io.InputStream stream) { jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; } public void ReInit(java.io.InputStream stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; } public Parser(java.io.Reader stream) { jj_input_stream = new ASCII_UCodeESC_CharStream(stream, 1, 1); token_source = new ParserTokenManager(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; } public void ReInit(java.io.Reader stream) { jj_input_stream.ReInit(stream, 1, 1); token_source.ReInit(jj_input_stream); token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; } public Parser(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; } public void ReInit(ParserTokenManager tm) { token_source = tm; token = new Token(); jj_ntk = -1; jj_gen = 0; for (int i = 0; i < 17; i++) jj_la1[i] = -1; } final private Token jj_consume_token(int kind) throws ParseException { Token oldToken; if ((oldToken = token).next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; if (token.kind == kind) { jj_gen++; return token; } token = oldToken; jj_kind = kind; throw generateParseException(); } final public Token getNextToken() { if (token.next != null) token = token.next; else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; return token; } final public Token getToken(int index) { Token t = token; for (int i = 0; i < index; i++) { if (t.next != null) t = t.next; else t = t.next = token_source.getNextToken(); } return t; } final private int jj_ntk() { if ((jj_nt=token.next) == null) return (jj_ntk = (token.next=token_source.getNextToken()).kind); else return (jj_ntk = jj_nt.kind); } private java.util.Vector jj_expentries = new java.util.Vector(); private int[] jj_expentry; private int jj_kind = -1; final public ParseException generateParseException() { jj_expentries.removeAllElements(); boolean[] la1tokens = new boolean[47]; for (int i = 0; i < 47; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 17; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<