/*package*/ static void main(String args[]) { OqlParser parser; if (args.length == 0) { System.out.println("OqlParser Parser: Reading from standard input . . ."); parser = new OqlParser(new java.io.DataInputStream(System.in)); } else if (args.length == 1) { System.out.println("OqlParser Parser: Reading from file " + args[0] + " . . ."); try { parser = new OqlParser(new java.io.DataInputStream(new java.io.FileInputStream(args[0]))); } catch (java.io.FileNotFoundException e) { System.out.println("OqlParser Parser Version 1.1: File " + args[0] + " not found."); return; } } else { System.out.println("OqlParser Parser: Usage is one of:"); System.out.println(" java OqlParser < inputfile"); System.out.println("OR"); System.out.println(" java OqlParser inputfile"); return; } try { parser.Query(); ((SimpleNode) parser.jjtree.rootNode()).dump(""); System.out.println("OqlParser Parser: Oql program parsed successfully."); } catch (ParseError e) { System.out.println("OqlParser Parser: Encountered errors during parse."); } }
private final void jj_token_error_setup(Token current, int kind) throws ParseError { jj_errortokens.removeAllElements(); boolean[] la1tokens = new boolean[52]; boolean[] mask = null; for (int i = 0; i < 52; i++) { la1tokens[i] = false; } if (kind >= 0) la1tokens[kind] = true; for (int i = 0; i < 57; i++) { if (jj_expLA1[i] == jj_gen) { switch (i) { case 0: mask = jj_mask_0; break; case 1: mask = jj_mask_1; break; case 2: mask = jj_mask_2; break; case 3: mask = jj_mask_3; break; case 4: mask = jj_mask_4; break; case 5: mask = jj_mask_5; break; case 6: mask = jj_mask_6; break; case 7: mask = jj_mask_7; break; case 8: mask = jj_mask_8; break; case 9: mask = jj_mask_9; break; case 10: mask = jj_mask_10; break; case 11: mask = jj_mask_11; break; case 12: mask = jj_mask_12; break; case 13: mask = jj_mask_13; break; case 14: mask = jj_mask_14; break; case 15: mask = jj_mask_15; break; case 16: mask = jj_mask_16; break; case 17: mask = jj_mask_17; break; case 18: mask = jj_mask_18; break; case 19: mask = jj_mask_19; break; case 20: mask = jj_mask_20; break; case 21: mask = jj_mask_21; break; case 22: mask = jj_mask_22; break; case 23: mask = jj_mask_23; break; case 24: mask = jj_mask_24; break; case 25: mask = jj_mask_25; break; case 26: mask = jj_mask_26; break; case 27: mask = jj_mask_27; break; case 28: mask = jj_mask_28; break; case 29: mask = jj_mask_29; break; case 30: mask = jj_mask_30; break; case 31: mask = jj_mask_31; break; case 32: mask = jj_mask_32; break; case 33: mask = jj_mask_33; break; case 34: mask = jj_mask_34; break; case 35: mask = jj_mask_35; break; case 36: mask = jj_mask_36; break; case 37: mask = jj_mask_37; break; case 38: mask = jj_mask_38; break; case 39: mask = jj_mask_39; break; case 40: mask = jj_mask_40; break; case 41: mask = jj_mask_41; break; case 42: mask = jj_mask_42; break; case 43: mask = jj_mask_43; break; case 44: mask = jj_mask_44; break; case 45: mask = jj_mask_45; break; case 46: mask = jj_mask_46; break; case 47: mask = jj_mask_47; break; case 48: mask = jj_mask_48; break; case 49: mask = jj_mask_49; break; case 50: mask = jj_mask_50; break; case 51: mask = jj_mask_51; break; case 52: mask = jj_mask_52; break; case 53: mask = jj_mask_53; break; case 54: mask = jj_mask_54; break; case 55: mask = jj_mask_55; break; case 56: mask = jj_mask_56; break; } for (int j = 0; j < 52; j++) { if (mask[j]) la1tokens[j] = true; } } } if (la1tokens[0]) { jj_errortokens.addElement(tokenImage[0] + " "); } for (int i = 1; i < 52; i++) { if (la1tokens[i]) { jj_errortokens.addElement(tokenImage[i] + " ..."); } } expected_tokens = new String[jj_errortokens.size()]; for (int i = 0; i < jj_errortokens.size(); i++) { expected_tokens[i] = (String) (jj_errortokens.elementAt(i)); } error_line = current.beginLine; error_column = current.beginColumn; if (current.kind == 0) { error_string = tokenImage[0]; } else { error_string = current.image; } jj_me.token_error(); }