/* Generated By:JavaCC: Do not edit this line. Parser.java */ 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; String _s; it=new Main(); _s = _String(); it.set_s(_s); {if (true) return it;} throw new Error("Missing return statement in function"); } final public LogicAJ _LogicAJ() throws ParseException { LogicAJ it = null; PCD_List _pcd_list; it=new LogicAJ(); _pcd_list = _PCD_List(); it.set_pcd_list(_pcd_list); jj_consume_token(0); {if (true) return it;} throw new Error("Missing return statement in function"); } final public PCD _PCD() throws ParseException { PCD it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: case 4: case 5: case 6: case 7: case 8: it = _Sim(); break; case 2: it = _Com(); 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_PCD(PCD it) throws ParseException { } final public Sim _Sim() throws ParseException { Sim it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: it = _Within(); break; case 4: it = _Target(); break; case 5: it = _This(); break; case 6: it = _Call(); break; case 7: it = _Execution(); break; case 8: it = _Withincode(); 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_Sim(Sim it) throws ParseException { common_PCD(it); } final public Within _Within() throws ParseException { Within it = null; TypePat _typepat; it=new Within(); jj_consume_token(1); jj_consume_token(2); _typepat = _TypePat(); it.set_typepat(_typepat); jj_consume_token(3); common_Sim(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Target _Target() throws ParseException { Target it = null; TypePat _typepat; it=new Target(); jj_consume_token(4); jj_consume_token(2); _typepat = _TypePat(); it.set_typepat(_typepat); jj_consume_token(3); common_Sim(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public This _This() throws ParseException { This it = null; TypePat _typepat; it=new This(); jj_consume_token(5); jj_consume_token(2); _typepat = _TypePat(); it.set_typepat(_typepat); jj_consume_token(3); common_Sim(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Call _Call() throws ParseException { Call it = null; MethodPat _methodpat; it=new Call(); jj_consume_token(6); jj_consume_token(2); _methodpat = _MethodPat(); it.set_methodpat(_methodpat); jj_consume_token(3); common_Sim(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Execution _Execution() throws ParseException { Execution it = null; MethodPat _methodpat; it=new Execution(); jj_consume_token(7); jj_consume_token(2); _methodpat = _MethodPat(); it.set_methodpat(_methodpat); jj_consume_token(3); common_Sim(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Withincode _Withincode() throws ParseException { Withincode it = null; MethodPat _methodpat; it=new Withincode(); jj_consume_token(8); jj_consume_token(2); _methodpat = _MethodPat(); it.set_methodpat(_methodpat); jj_consume_token(3); common_Sim(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Com _Com() throws ParseException { Com it = null; O _o; PCD_List _args; it=new Com(); jj_consume_token(2); _o = _O(); it.set_o(_o); _args = _PCD_List(); it.set_args(_args); jj_consume_token(3); common_PCD(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public O _O() throws ParseException { O it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 9: it = _Inter(); break; case 10: it = _Uni(); break; case 11: it = _Compl(); 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_O(O it) throws ParseException { } final public Inter _Inter() throws ParseException { Inter it = null; it=new Inter(); jj_consume_token(9); common_O(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Uni _Uni() throws ParseException { Uni it = null; it=new Uni(); jj_consume_token(10); common_O(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Compl _Compl() throws ParseException { Compl it = null; it=new Compl(); jj_consume_token(11); common_O(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public LMV _LMV() throws ParseException { LMV it = null; Ident _ident; it=new LMV(); jj_consume_token(12); _ident = _Ident(); it.set_ident(_ident); common_ModifierPart(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public LMV1 _LMV1() throws ParseException { LMV1 it = null; LMV _lmv; it=new LMV1(); _lmv = _LMV(); it.set_lmv(_lmv); common_MethodName(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public LMV2 _LMV2() throws ParseException { LMV2 it = null; LMV _lmv; it=new LMV2(); _lmv = _LMV(); it.set_lmv(_lmv); common_NPat(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public LMV3 _LMV3() throws ParseException { LMV3 it = null; LMV _lmv; it=new LMV3(); _lmv = _LMV(); it.set_lmv(_lmv); {if (true) return it;} throw new Error("Missing return statement in function"); } final public LLMV _LLMV() throws ParseException { LLMV it = null; Ident _ident; it=new LLMV(); jj_consume_token(13); _ident = _Ident(); it.set_ident(_ident); common_Arguments(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public MethodPat _MethodPat() throws ParseException { MethodPat it = null; ModifierPart _modifierpart; TypePat _ret; TypePat _typ; MethodName _methodname; Arguments _arguments; it=new MethodPat(); _modifierpart = _ModifierPart(); it.set_modifierpart(_modifierpart); _ret = _TypePat(); it.set_ret(_ret); _typ = _TypePat(); it.set_typ(_typ); jj_consume_token(14); _methodname = _MethodName(); it.set_methodname(_methodname); jj_consume_token(2); _arguments = _Arguments(); it.set_arguments(_arguments); jj_consume_token(3); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ModifierPart _ModifierPart() throws ParseException { ModifierPart it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 15: it = _ModifierPat(); break; case 12: it = _LMV(); 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_ModifierPart(ModifierPart it) throws ParseException { } final public ModifierPat _ModifierPat() throws ParseException { ModifierPat it = null; it=new ModifierPat(); jj_consume_token(15); common_ModifierPart(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public MethodName _MethodName() throws ParseException { MethodName it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 18: case IDENTIFIER: it = _NamePat(); break; case 12: it = _LMV1(); break; default: jj_la1[4] = 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_MethodName(MethodName it) throws ParseException { } final public Arguments _Arguments() throws ParseException { Arguments it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 2: case 12: case 18: case IDENTIFIER: it = _TypePat(); break; case 13: it = _LLMV(); break; case 16: it = _ListWildCard(); break; default: jj_la1[5] = 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_Arguments(Arguments it) throws ParseException { } final public ListWildCard _ListWildCard() throws ParseException { ListWildCard it = null; it=new ListWildCard(); jj_consume_token(16); common_Arguments(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public TypePat _TypePat() throws ParseException { TypePat it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 12: case 18: case IDENTIFIER: it = _Simple(); break; case 2: it = _Compound(); break; default: jj_la1[6] = 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_TypePat(TypePat it) throws ParseException { common_Arguments(it); } final public Simple _Simple() throws ParseException { Simple it = null; NPat _npat; SubTypes _subtypes; it=new Simple(); _npat = _NPat(); it.set_npat(_npat); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 17: _subtypes = _SubTypes(); it.set_subtypes(_subtypes); break; default: jj_la1[7] = jj_gen; ; } common_TypePat(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public SubTypes _SubTypes() throws ParseException { SubTypes it = null; it=new SubTypes(); jj_consume_token(17); {if (true) return it;} throw new Error("Missing return statement in function"); } final public NPat _NPat() throws ParseException { NPat it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 12: it = _LMV2(); break; case 18: case IDENTIFIER: it = _NamePat2(); break; default: jj_la1[8] = 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_NPat(NPat it) throws ParseException { } final public NamePat _NamePat() throws ParseException { NamePat it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 18: it = _WildCard(); break; case IDENTIFIER: it = _Name(); break; default: jj_la1[9] = 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_NamePat(NamePat it) throws ParseException { common_MethodName(it); } final public NamePat2 _NamePat2() throws ParseException { NamePat2 it = null; NamePat _namepat; it=new NamePat2(); _namepat = _NamePat(); it.set_namepat(_namepat); common_NPat(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public WildCard _WildCard() throws ParseException { WildCard it = null; it=new WildCard(); jj_consume_token(18); common_NamePat(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Name _Name() throws ParseException { Name it = null; Ident _ident; it=new Name(); _ident = _Ident(); it.set_ident(_ident); common_NamePat(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Compound _Compound() throws ParseException { Compound it = null; Op _op; TypePat_List _args; it=new Compound(); jj_consume_token(2); _op = _Op(); it.set_op(_op); _args = _TypePat_List(); it.set_args(_args); jj_consume_token(3); common_TypePat(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Op _Op() throws ParseException { Op it = null; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 19: it = _Intersection(); break; case 20: it = _Union(); break; case 11: it = _Complement(); break; default: jj_la1[10] = 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_Op(Op it) throws ParseException { } final public Intersection _Intersection() throws ParseException { Intersection it = null; it=new Intersection(); jj_consume_token(19); common_Op(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Union _Union() throws ParseException { Union it = null; it=new Union(); jj_consume_token(20); common_Op(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Complement _Complement() throws ParseException { Complement it = null; it=new Complement(); jj_consume_token(11); common_Op(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public PCD_List _PCD_List() throws ParseException { PCD_List it = null; Nonempty_PCD_List _first; it=new PCD_List(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: case 2: case 4: case 5: case 6: case 7: case 8: _first = _Nonempty_PCD_List(); it.set_first(_first); break; default: jj_la1[11] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public TypePat_List _TypePat_List() throws ParseException { TypePat_List it = null; Nonempty_TypePat_List _first; it=new TypePat_List(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 2: case 12: case 18: case IDENTIFIER: _first = _Nonempty_TypePat_List(); it.set_first(_first); break; default: jj_la1[12] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_PCD_List _Nonempty_PCD_List() throws ParseException { Nonempty_PCD_List it = null; PCD _it; Nonempty_PCD_List _next; it=new Nonempty_PCD_List(); _it = _PCD(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: case 2: case 4: case 5: case 6: case 7: case 8: _next = _Nonempty_PCD_List(); it.set_next(_next); break; default: jj_la1[13] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_TypePat_List _Nonempty_TypePat_List() throws ParseException { Nonempty_TypePat_List it = null; TypePat _it; Nonempty_TypePat_List _next; it=new Nonempty_TypePat_List(); _it = _TypePat(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 2: case 12: case 18: case IDENTIFIER: _next = _Nonempty_TypePat_List(); it.set_next(_next); break; default: jj_la1[14] = 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[15] = 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[16] = 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[17] = 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[18] = 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[19]; final private int[] jj_la1_0 = {0x1f6,0x1f2,0xe00,0x9000,0x41000,0x53004,0x41004,0x20000,0x41000,0x40000,0x180800,0x1f6,0x41004,0x1f6,0x41004,0x0,0x0,0x38000000,0x78000000,}; final private int[] jj_la1_1 = {0x0,0x0,0x0,0x0,0x20,0x20,0x20,0x0,0x20,0x20,0x0,0x0,0x20,0x0,0x20,0x18,0x18,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 < 19; 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 < 19; 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 < 19; 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 < 19; 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 < 19; 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 < 19; 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[46]; for (int i = 0; i < 46; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 19; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<