Ejemplo n.º 1
0
 public final JVector Vector() throws ParseException {
   JType jt;
   jj_consume_token(VECTOR_TKN);
   jj_consume_token(LT_TKN);
   jt = Type();
   jj_consume_token(GT_TKN);
   {
     if (true) return new JVector(jt);
   }
   throw new Error("Missing return statement in function");
 }
Ejemplo n.º 2
0
 public final JMap Map() throws ParseException {
   JType jt1;
   JType jt2;
   jj_consume_token(MAP_TKN);
   jj_consume_token(LT_TKN);
   jt1 = Type();
   jj_consume_token(COMMA_TKN);
   jt2 = Type();
   jj_consume_token(GT_TKN);
   {
     if (true) return new JMap(jt1, jt2);
   }
   throw new Error("Missing return statement in function");
 }
Ejemplo n.º 3
0
 public final ArrayList Module() throws ParseException {
   String mName;
   ArrayList rlist;
   jj_consume_token(MODULE_TKN);
   mName = ModuleName();
   curModuleName = mName;
   jj_consume_token(LBRACE_TKN);
   rlist = RecordList();
   jj_consume_token(RBRACE_TKN);
   {
     if (true) return rlist;
   }
   throw new Error("Missing return statement in function");
 }
Ejemplo n.º 4
0
 public final JRecord Record() throws ParseException {
   String rname;
   ArrayList flist = new ArrayList();
   Token t;
   JField f;
   jj_consume_token(RECORD_TKN);
   t = jj_consume_token(IDENT_TKN);
   rname = t.image;
   jj_consume_token(LBRACE_TKN);
   label_4:
   while (true) {
     f = Field();
     flist.add(f);
     jj_consume_token(SEMICOLON_TKN);
     switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
       case BYTE_TKN:
       case BOOLEAN_TKN:
       case INT_TKN:
       case LONG_TKN:
       case FLOAT_TKN:
       case DOUBLE_TKN:
       case USTRING_TKN:
       case BUFFER_TKN:
       case VECTOR_TKN:
       case MAP_TKN:
       case IDENT_TKN:;
         break;
       default:
         jj_la1[4] = jj_gen;
         break label_4;
     }
   }
   jj_consume_token(RBRACE_TKN);
   String fqn = curModuleName + "." + rname;
   JRecord r = new JRecord(fqn, flist);
   recTab.put(fqn, r);
   {
     if (true) return r;
   }
   throw new Error("Missing return statement in function");
 }
Ejemplo n.º 5
0
 public final JFile Input() throws ParseException {
   ArrayList ilist = new ArrayList();
   ArrayList rlist = new ArrayList();
   JFile i;
   ArrayList l;
   label_1:
   while (true) {
     switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
       case INCLUDE_TKN:
         i = Include();
         ilist.add(i);
         break;
       case MODULE_TKN:
         l = Module();
         rlist.addAll(l);
         break;
       default:
         jj_la1[0] = jj_gen;
         jj_consume_token(-1);
         throw new ParseException();
     }
     switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
       case MODULE_TKN:
       case INCLUDE_TKN:;
         break;
       default:
         jj_la1[1] = jj_gen;
         break label_1;
     }
   }
   jj_consume_token(0);
   {
     if (true) return new JFile(curFileName, ilist, rlist);
   }
   throw new Error("Missing return statement in function");
 }
Ejemplo n.º 6
0
 public final String ModuleName() throws ParseException {
   String name = "";
   Token t;
   t = jj_consume_token(IDENT_TKN);
   name += t.image;
   label_2:
   while (true) {
     switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
       case DOT_TKN:;
         break;
       default:
         jj_la1[2] = jj_gen;
         break label_2;
     }
     jj_consume_token(DOT_TKN);
     t = jj_consume_token(IDENT_TKN);
     name += "." + t.image;
   }
   {
     if (true) return name;
   }
   throw new Error("Missing return statement in function");
 }
Ejemplo n.º 7
0
 public final JFile Include() throws ParseException {
   String fname;
   Token t;
   jj_consume_token(INCLUDE_TKN);
   t = jj_consume_token(CSTRING_TKN);
   JFile ret = null;
   fname = t.image.replaceAll("^\"", "").replaceAll("\"$", "");
   File file = new File(curDir, fname);
   String tmpDir = curDir;
   String tmpFile = curFileName;
   curDir = file.getParent();
   curFileName = file.getName();
   try {
     FileReader reader = new FileReader(file);
     Rcc parser = new Rcc(reader);
     try {
       ret = parser.Input();
       System.out.println(fname + " Parsed Successfully");
     } catch (ParseException e) {
       System.out.println(e.toString());
       System.exit(1);
     }
     try {
       reader.close();
     } catch (IOException e) {
     }
   } catch (FileNotFoundException e) {
     System.out.println("File " + fname + " Not found.");
     System.exit(1);
   }
   curDir = tmpDir;
   curFileName = tmpFile;
   {
     if (true) return ret;
   }
   throw new Error("Missing return statement in function");
 }
Ejemplo n.º 8
0
 public final JType Type() throws ParseException {
   JType jt;
   Token t;
   String rname;
   switch ((jj_ntk == -1) ? jj_ntk() : jj_ntk) {
     case MAP_TKN:
       jt = Map();
       {
         if (true) return jt;
       }
       break;
     case VECTOR_TKN:
       jt = Vector();
       {
         if (true) return jt;
       }
       break;
     case BYTE_TKN:
       jj_consume_token(BYTE_TKN);
       {
         if (true) return new JByte();
       }
       break;
     case BOOLEAN_TKN:
       jj_consume_token(BOOLEAN_TKN);
       {
         if (true) return new JBoolean();
       }
       break;
     case INT_TKN:
       jj_consume_token(INT_TKN);
       {
         if (true) return new JInt();
       }
       break;
     case LONG_TKN:
       jj_consume_token(LONG_TKN);
       {
         if (true) return new JLong();
       }
       break;
     case FLOAT_TKN:
       jj_consume_token(FLOAT_TKN);
       {
         if (true) return new JFloat();
       }
       break;
     case DOUBLE_TKN:
       jj_consume_token(DOUBLE_TKN);
       {
         if (true) return new JDouble();
       }
       break;
     case USTRING_TKN:
       jj_consume_token(USTRING_TKN);
       {
         if (true) return new JString();
       }
       break;
     case BUFFER_TKN:
       jj_consume_token(BUFFER_TKN);
       {
         if (true) return new JBuffer();
       }
       break;
     case IDENT_TKN:
       rname = ModuleName();
       if (rname.indexOf('.', 0) < 0) {
         rname = curModuleName + "." + rname;
       }
       JRecord r = (JRecord) recTab.get(rname);
       if (r == null) {
         System.out.println("Type " + rname + " not known. Exiting.");
         System.exit(1);
       }
       {
         if (true) return r;
       }
       break;
     default:
       jj_la1[5] = jj_gen;
       jj_consume_token(-1);
       throw new ParseException();
   }
   throw new Error("Missing return statement in function");
 }