2 /* Generated By:JavaCC: Do not edit this line. SpecParser.java */
3 package edu.uci.eecs.specCompiler.grammerParser;
5 class SpecParser implements SpecParserConstants {
6 public static void main(String[] argvs)
7 throws ParseException, TokenMgrError {
8 SpecParser parser = new SpecParser(System.in);
10 System.out.println("Parsing finished!");
13 final public void Start() throws ParseException {
14 jj_consume_token(HEAD);
15 jj_consume_token(BEGIN);
16 jj_consume_token(END);
17 jj_consume_token(TAIL);
21 /** Generated Token Manager. */
22 public SpecParserTokenManager token_source;
23 JavaCharStream jj_input_stream;
30 final private int[] jj_la1 = new int[0];
31 static private int[] jj_la1_0;
35 private static void jj_la1_init_0() {
36 jj_la1_0 = new int[] {};
39 /** Constructor with InputStream. */
40 public SpecParser(java.io.InputStream stream) {
43 /** Constructor with InputStream and supplied encoding */
44 public SpecParser(java.io.InputStream stream, String encoding) {
45 try { jj_input_stream = new JavaCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
46 token_source = new SpecParserTokenManager(jj_input_stream);
53 public void ReInit(java.io.InputStream stream) {
57 public void ReInit(java.io.InputStream stream, String encoding) {
58 try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
59 token_source.ReInit(jj_input_stream);
63 for (int i = 0; i < 0; i++) jj_la1[i] = -1;
67 public SpecParser(java.io.Reader stream) {
68 jj_input_stream = new JavaCharStream(stream, 1, 1);
69 token_source = new SpecParserTokenManager(jj_input_stream);
76 public void ReInit(java.io.Reader stream) {
77 jj_input_stream.ReInit(stream, 1, 1);
78 token_source.ReInit(jj_input_stream);
84 /** Constructor with generated Token Manager. */
85 public SpecParser(SpecParserTokenManager tm) {
93 public void ReInit(SpecParserTokenManager tm) {
100 private Token jj_consume_token(int kind) throws ParseException {
102 if ((oldToken = token).next != null) token = token.next;
103 else token = token.next = token_source.getNextToken();
105 if (token.kind == kind) {
111 throw generateParseException();
115 /** Get the next Token. */
116 final public Token getNextToken() {
117 if (token.next != null) token = token.next;
118 else token = token.next = token_source.getNextToken();
124 /** Get the specific Token. */
125 final public Token getToken(int index) {
127 for (int i = 0; i < index; i++) {
128 if (t.next != null) t = t.next;
129 else t = t.next = token_source.getNextToken();
134 private int jj_ntk_f() {
135 if ((jj_nt=token.next) == null)
136 return (jj_ntk = (token.next=token_source.getNextToken()).kind);
138 return (jj_ntk = jj_nt.kind);
141 private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>();
142 private int[] jj_expentry;
143 private int jj_kind = -1;
145 /** Generate ParseException. */
146 public ParseException generateParseException() {
147 jj_expentries.clear();
148 boolean[] la1tokens = new boolean[21];
150 la1tokens[jj_kind] = true;
153 for (int i = 0; i < 0; i++) {
154 if (jj_la1[i] == jj_gen) {
155 for (int j = 0; j < 32; j++) {
156 if ((jj_la1_0[i] & (1<<j)) != 0) {
162 for (int i = 0; i < 21; i++) {
164 jj_expentry = new int[1];
166 jj_expentries.add(jj_expentry);
169 int[][] exptokseq = new int[jj_expentries.size()][];
170 for (int i = 0; i < jj_expentries.size(); i++) {
171 exptokseq[i] = jj_expentries.get(i);
173 return new ParseException(token, exptokseq, tokenImage);
176 /** Enable tracing. */
177 final public void enable_tracing() {
180 /** Disable tracing. */
181 final public void disable_tracing() {