/* 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 ChineseWallPolicyChecker _ChineseWallPolicyChecker() throws ParseException { ChineseWallPolicyChecker it = null; ChineseWallAutomaton_List _chinesewallautomaton_list; it=new ChineseWallPolicyChecker(); _chinesewallautomaton_list = _ChineseWallAutomaton_List(); it.set_chinesewallautomaton_list(_chinesewallautomaton_list); jj_consume_token(0); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ChineseWallAutomaton _ChineseWallAutomaton() throws ParseException { ChineseWallAutomaton it = null; AutomatonName _automatonname; State _currentState; State _startState; Transition_List _transition; Group_List _groups; CIType_List _citypes; Access_List _history; it=new ChineseWallAutomaton(); jj_consume_token(1); jj_consume_token(2); jj_consume_token(3); _automatonname = _AutomatonName(); it.set_automatonname(_automatonname); jj_consume_token(4); _currentState = _State(); it.set_currentState(_currentState); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 5: jj_consume_token(5); _startState = _State(); it.set_startState(_startState); break; default: jj_la1[0] = jj_gen; ; } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 6: jj_consume_token(6); _transition = _Transition_List(); it.set_transition(_transition); break; default: jj_la1[1] = jj_gen; ; } jj_consume_token(7); _groups = _Group_List(); it.set_groups(_groups); jj_consume_token(8); _citypes = _CIType_List(); it.set_citypes(_citypes); jj_consume_token(9); _history = _Access_List(); it.set_history(_history); {if (true) return it;} throw new Error("Missing return statement in function"); } final public State _State() throws ParseException { State it = null; Group_List _accesses; it=new State(); _accesses = _Group_List(); it.set_accesses(_accesses); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Access _Access() throws ParseException { Access it = null; ObjektId _objektid; Group _group; it=new Access(); _objektid = _ObjektId(); it.set_objektid(_objektid); jj_consume_token(10); _group = _Group(); it.set_group(_group); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Group _Group() throws ParseException { Group it = null; GroupName _groupname; CIType _citype; it=new Group(); _groupname = _GroupName(); it.set_groupname(_groupname); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 11: jj_consume_token(11); _citype = _CIType(); it.set_citype(_citype); break; default: jj_la1[2] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public CIType _CIType() throws ParseException { CIType it = null; CITypeName _citypename; it=new CIType(); _citypename = _CITypeName(); it.set_citypename(_citypename); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Transition _Transition() throws ParseException { Transition it = null; Access _newAccess; it=new Transition(); _newAccess = _Access(); it.set_newAccess(_newAccess); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ObjektId _ObjektId() throws ParseException { ObjektId it = null; Ident _ident; it=new ObjektId(); _ident = _Ident(); it.set_ident(_ident); {if (true) return it;} throw new Error("Missing return statement in function"); } final public GroupName _GroupName() throws ParseException { GroupName it = null; Ident _ident; it=new GroupName(); _ident = _Ident(); it.set_ident(_ident); {if (true) return it;} throw new Error("Missing return statement in function"); } final public CITypeName _CITypeName() throws ParseException { CITypeName it = null; Ident _ident; it=new CITypeName(); _ident = _Ident(); it.set_ident(_ident); {if (true) return it;} throw new Error("Missing return statement in function"); } final public AutomatonName _AutomatonName() throws ParseException { AutomatonName it = null; Ident _ident; it=new AutomatonName(); _ident = _Ident(); it.set_ident(_ident); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ChineseWallAutomaton_List _ChineseWallAutomaton_List() throws ParseException { ChineseWallAutomaton_List it = null; Nonempty_ChineseWallAutomaton_List _first; it=new ChineseWallAutomaton_List(); jj_consume_token(12); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: _first = _Nonempty_ChineseWallAutomaton_List(); it.set_first(_first); break; default: jj_la1[3] = jj_gen; ; } jj_consume_token(13); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Transition_List _Transition_List() throws ParseException { Transition_List it = null; Nonempty_Transition_List _first; it=new Transition_List(); jj_consume_token(12); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _first = _Nonempty_Transition_List(); it.set_first(_first); break; default: jj_la1[4] = jj_gen; ; } jj_consume_token(13); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Group_List _Group_List() throws ParseException { Group_List it = null; Nonempty_Group_List _first; it=new Group_List(); jj_consume_token(12); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _first = _Nonempty_Group_List(); it.set_first(_first); break; default: jj_la1[5] = jj_gen; ; } jj_consume_token(13); {if (true) return it;} throw new Error("Missing return statement in function"); } final public CIType_List _CIType_List() throws ParseException { CIType_List it = null; Nonempty_CIType_List _first; it=new CIType_List(); jj_consume_token(12); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _first = _Nonempty_CIType_List(); it.set_first(_first); break; default: jj_la1[6] = jj_gen; ; } jj_consume_token(13); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Access_List _Access_List() throws ParseException { Access_List it = null; Nonempty_Access_List _first; it=new Access_List(); jj_consume_token(12); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _first = _Nonempty_Access_List(); it.set_first(_first); break; default: jj_la1[7] = jj_gen; ; } jj_consume_token(13); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_ChineseWallAutomaton_List _Nonempty_ChineseWallAutomaton_List() throws ParseException { Nonempty_ChineseWallAutomaton_List it = null; ChineseWallAutomaton _it; Nonempty_ChineseWallAutomaton_List _next; it=new Nonempty_ChineseWallAutomaton_List(); _it = _ChineseWallAutomaton(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: _next = _Nonempty_ChineseWallAutomaton_List(); it.set_next(_next); break; default: jj_la1[8] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_Transition_List _Nonempty_Transition_List() throws ParseException { Nonempty_Transition_List it = null; Transition _it; Nonempty_Transition_List _next; it=new Nonempty_Transition_List(); _it = _Transition(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _next = _Nonempty_Transition_List(); 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_Group_List _Nonempty_Group_List() throws ParseException { Nonempty_Group_List it = null; Group _it; Nonempty_Group_List _next; it=new Nonempty_Group_List(); _it = _Group(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _next = _Nonempty_Group_List(); 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_CIType_List _Nonempty_CIType_List() throws ParseException { Nonempty_CIType_List it = null; CIType _it; Nonempty_CIType_List _next; it=new Nonempty_CIType_List(); _it = _CIType(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _next = _Nonempty_CIType_List(); 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_Access_List _Nonempty_Access_List() throws ParseException { Nonempty_Access_List it = null; Access _it; Nonempty_Access_List _next; it=new Nonempty_Access_List(); _it = _Access(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _next = _Nonempty_Access_List(); 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 = {0x20,0x40,0x800,0x2,0x40000000,0x40000000,0x40000000,0x40000000,0x2,0x40000000,0x40000000,0x40000000,0x40000000,0x30000000,0x30000000,0x700000,0xf00000,}; final private int[] jj_la1_1 = {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,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[39]; for (int i = 0; i < 39; 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<