/* Generated By:JavaCC: Do not edit this line. Parser.java */ import java.lang.*; import java.io.*; import java.util.*; 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(2, 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 WebScript _WebScript() throws ParseException { WebScript it; Service_List _service_list; it=new WebScript(); _service_list = _Service_List(); it.set_service_list(_service_list); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Service _Service() throws ParseException { Service it; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: it = _Url(); break; case 3: it = _TimeOut(); break; case 5: it = _Limit(); break; case 6: it = _Repeat(); break; case 7: it = _Stall(); break; case 8: it = _Fail(); break; case 12: it = _Post(); break; case 13: it = _Get(); break; case 9: it = _Execution(); 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_Service(Service it) throws ParseException { } final public Url _Url() throws ParseException { Url it; String _url; it=new Url(); jj_consume_token(1); _url = _String(); it.set_url(_url); jj_consume_token(2); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public TimeOut _TimeOut() throws ParseException { TimeOut it; Real _timeout; Service _service; it=new TimeOut(); jj_consume_token(3); _timeout = _Real(); it.set_timeout(_timeout); jj_consume_token(4); _service = _Service(); it.set_service(_service); jj_consume_token(2); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Limit _Limit() throws ParseException { Limit it; Real _start_time; Real _rate; Service _service; it=new Limit(); jj_consume_token(5); _start_time = _Real(); it.set_start_time(_start_time); jj_consume_token(4); _rate = _Real(); it.set_rate(_rate); jj_consume_token(4); _service = _Service(); it.set_service(_service); jj_consume_token(2); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Repeat _Repeat() throws ParseException { Repeat it; Service _service; it=new Repeat(); jj_consume_token(6); _service = _Service(); it.set_service(_service); jj_consume_token(2); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Stall _Stall() throws ParseException { Stall it; it=new Stall(); jj_consume_token(7); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Fail _Fail() throws ParseException { Fail it; it=new Fail(); jj_consume_token(8); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Execution _Execution() throws ParseException { Execution it; Service _service1; ExecutionOp _op; Service _service2; it=new Execution(); jj_consume_token(9); _service1 = _Service(); it.set_service1(_service1); _op = _ExecutionOp(); it.set_op(_op); _service2 = _Service(); it.set_service2(_service2); jj_consume_token(2); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ExecutionOp _ExecutionOp() throws ParseException { ExecutionOp it; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 10: it = _SequenceOp(); break; case 11: it = _ConcurrentOp(); 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_ExecutionOp(ExecutionOp it) throws ParseException { } final public SequenceOp _SequenceOp() throws ParseException { SequenceOp it; it=new SequenceOp(); jj_consume_token(10); common_ExecutionOp(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public ConcurrentOp _ConcurrentOp() throws ParseException { ConcurrentOp it; it=new ConcurrentOp(); jj_consume_token(11); common_ExecutionOp(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Post _Post() throws ParseException { Post it; String _cgi; Condition_List _data; it=new Post(); jj_consume_token(12); _cgi = _String(); it.set_cgi(_cgi); jj_consume_token(4); _data = _Condition_List(); it.set_data(_data); jj_consume_token(2); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Get _Get() throws ParseException { Get it; String _cgi; Condition_List _data; it=new Get(); jj_consume_token(13); _cgi = _String(); it.set_cgi(_cgi); jj_consume_token(4); _data = _Condition_List(); it.set_data(_data); jj_consume_token(2); common_Service(it); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Condition _Condition() throws ParseException { Condition it; Ident _id; String _content; it=new Condition(); _id = _Ident(); it.set_id(_id); jj_consume_token(14); _content = _String(); it.set_content(_content); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Real _Real() throws ParseException { Real it; float _value; it=new Real(); _value = _float(); it.set_value(_value); {if (true) return it;} throw new Error("Missing return statement in function"); } final public RunServiceVisitor _RunServiceVisitor() throws ParseException { RunServiceVisitor it; it=new RunServiceVisitor(); {if (true) return it;} throw new Error("Missing return statement in function"); } final public StopServiceVisitor _StopServiceVisitor() throws ParseException { StopServiceVisitor it; it=new StopServiceVisitor(); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Main _Main() throws ParseException { Main it; it=new Main(); {if (true) return it;} throw new Error("Missing return statement in function"); } final public Service_List _Service_List() throws ParseException { Service_List it; Nonempty_Service_List _first; it=new Service_List(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: case 3: case 5: case 6: case 7: case 8: case 9: case 12: case 13: _first = _Nonempty_Service_List(); it.set_first(_first); break; default: jj_la1[2] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Condition_List _Condition_List() throws ParseException { Condition_List it; Nonempty_Condition_List _first; it=new Condition_List(); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _first = _Nonempty_Condition_List(); it.set_first(_first); break; default: jj_la1[3] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_Service_List _Nonempty_Service_List() throws ParseException { Nonempty_Service_List it; Service _it; Nonempty_Service_List _next; it=new Nonempty_Service_List(); _it = _Service(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case 1: case 3: case 5: case 6: case 7: case 8: case 9: case 12: case 13: _next = _Nonempty_Service_List(); it.set_next(_next); break; default: jj_la1[4] = jj_gen; ; } {if (true) return it;} throw new Error("Missing return statement in function"); } final public Nonempty_Condition_List _Nonempty_Condition_List() throws ParseException { Nonempty_Condition_List it; Condition _it; Nonempty_Condition_List _next; it=new Nonempty_Condition_List(); _it = _Condition(); it.set_it(_it); switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IDENTIFIER: _next = _Nonempty_Condition_List(); it.set_next(_next); break; default: jj_la1[5] = 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[6] = 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[7] = 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; int radix; Number num; 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[8] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch (s.charAt(s.length()-1)) { case 'l': case 'L': num = Long.valueOf(s.substring(0, s.length()-1), radix); break; default: num = Integer.valueOf(s, radix); 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[9] = 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[10]; final private int[] jj_la1_0 = {0x33ea,0xc00,0x33ea,0x80000000,0x33ea,0x80000000,0x60000000,0x60000000,0xe00000,0x1e00000,}; final private int[] jj_la1_1 = {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 < 10; 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 < 10; 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 < 10; 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 < 10; 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[40]; for (int i = 0; i < 40; i++) { la1tokens[i] = false; } if (jj_kind >= 0) { la1tokens[jj_kind] = true; jj_kind = -1; } for (int i = 0; i < 10; i++) { if (jj_la1[i] == jj_gen) { for (int j = 0; j < 32; j++) { if ((jj_la1_0[i] & (1<