/* Generated By:JavaCC: Do not edit this line. TableStorageParser.java */
package org.apache.hadoop.zebra.parser;
import java.io.*;
import java.util.*;
import org.apache.hadoop.zebra.schema.Schema;
import org.apache.hadoop.zebra.schema.ColumnType;
import org.apache.hadoop.zebra.types.*;
public class TableStorageParser implements TableStorageParserConstants {
public TableStorageParser(java.io.Reader in, Partition partition, Schema schema, String comparator) { this(in); mSchema = schema; this.partition = partition; this.comparator = comparator; }
private Schema mSchema;
private int mDefaultCGIndex = -1;
private String mName = null;
private String mCompressor = "gz", mSerializer = "pig";
private String mOwner = null, mGroup = null;
private short mPerm = -1;
private int mCGCount = 0;
private Partition partition;
private String comparator = null;
final public void StorageSchema(ArrayList<CGSchema> s) throws ParseException, ParseException {
CGSchema fs;
CGSchema defaultSchema;
try {
fs = FieldSchema();
mCGCount++; if (fs != null) s.add(fs);
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 27:
;
break;
default:
jj_la1[0] = jj_gen;
break label_1;
}
jj_consume_token(27);
fs = FieldSchema();
mCGCount++; if (fs != null) s.add(fs);
}
jj_consume_token(0);
defaultSchema = partition.generateDefaultCGSchema(mName, mCompressor, mSerializer, mOwner, mGroup, mPerm, mDefaultCGIndex == -1 ? mDefaultCGIndex = mCGCount++ : mDefaultCGIndex, comparator);
if (defaultSchema != null)
s.add(defaultSchema);
// check column group names, add system created names when necessary;
HashSet<String> cgNames = new HashSet<String>();
ArrayList<CGSchema> unnamed = new ArrayList<CGSchema>();
for (int i = 0; i < s.size(); i++) {
CGSchema cgSchema = s.get(i);
String str = cgSchema.getName();
if (str != null) {
if (!cgNames.add(str)) {
{if (true) throw new ParseException("Duplicate column group names.");}
}
} else {
unnamed.add(cgSchema);
}
}
int digits = 1;
int total = unnamed.size();
while (total >= 10) {
++digits;
total /= 10;
}
String formatString = "%0" + digits + "d";
int idx = 0;
for (int i = 0; i < unnamed.size(); i++) {
CGSchema cgSchema = unnamed.get(i);
String str = null;
while (true) {
str = "CG" + String.format(formatString, idx++);
if (!cgNames.contains(str)) {
break;
}
}
cgSchema.setName(str);
}
{if (true) return;}
} catch (TokenMgrError e) {
{if (true) throw new ParseException(e.getMessage());}
}
}
final public boolean ascdsc() throws ParseException, ParseException {
Token t1 = null, t2 = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ASC:
t1 = jj_consume_token(ASC);
break;
case DESC:
t2 = jj_consume_token(DESC);
break;
default:
jj_la1[1] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (t2 != null)
{if (true) return false;}
{if (true) return true;}
throw new Error("Missing return statement in function");
}
final public CGSchema FieldSchema() throws ParseException, ParseException {
Token t1 = null, t2 = null;
Schema fs = null;
CGSchema cs = null;
String name = null;
String compressor = null;
String serializer = null;
String secureBy = null;
String owner = null;
String group = null;
short perm = -1;
String secure = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 28:
jj_consume_token(28);
fs = RecordSchema(null);
jj_consume_token(29);
break;
default:
jj_la1[2] = jj_gen;
;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case AS:
jj_consume_token(AS);
t1 = jj_consume_token(IDENTIFIER);
if (name != null)
{
String msg = "Column group name defined more than once";
} else {
name = t1.image;
}
break;
default:
jj_la1[3] = jj_gen;
;
}
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMPRESS:
case SERIALIZE:
case SECURE:
;
break;
default:
jj_la1[4] = jj_gen;
break label_2;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMPRESS:
jj_consume_token(COMPRESS);
t1 = jj_consume_token(COMPRESSOR);
if(compressor != null )
{
String msg = "Compression information defined more than once";
{if (true) throw new ParseException(msg);}
} else {
compressor = t1.image;
}
break;
case SERIALIZE:
jj_consume_token(SERIALIZE);
t1 = jj_consume_token(SERIALIZER);
if(serializer != null )
{
String msg = "Serializer Information defined more than once";
{if (true) throw new ParseException(msg);}
} else
serializer = t1.image;
break;
case SECURE:
t1 = jj_consume_token(SECURE);
if(secure != null)
{
String msg = "SECURE BY defined more than once";
{if (true) throw new ParseException(msg);}
} else
secure = t1.image;
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case USER:
jj_consume_token(USER);
jj_consume_token(30);
t1 = jj_consume_token(IDENTIFIER);
if(owner != null)
{
String msg = "Uid defined more than once";
{if (true) throw new ParseException(msg);}
} else
owner = t1.image;
break;
case GROUP:
jj_consume_token(GROUP);
jj_consume_token(30);
t1 = jj_consume_token(IDENTIFIER);
if(group != null)
{
String msg = "Gid defined more than once";
{if (true) throw new ParseException(msg);}
} else
group = t1.image;
break;
case PERM:
jj_consume_token(PERM);
jj_consume_token(30);
t1 = jj_consume_token(SHORT);
if(perm != -1)
{
String msg = "Perms defined more than once";
{if (true) throw new ParseException(msg);}
} else
perm = Short.parseShort(t1.image, 8);
break;
default:
jj_la1[5] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case USER:
case GROUP:
case PERM:
;
break;
default:
jj_la1[6] = jj_gen;
break label_3;
}
}
break;
default:
jj_la1[7] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
// String compressor, serializer;
if (compressor == null)
compressor = "gz";
if (serializer == null)
serializer = "pig";
if (fs == null)
{
if (mDefaultCGIndex != -1)
{
String msg = "Default Storage Information defined more than once";
{if (true) throw new ParseException(msg);}
}
mDefaultCGIndex = mCGCount;
mName = name;
mCompressor = compressor;
mSerializer = serializer;
mOwner = owner;
mGroup = group;
mPerm = perm;
} else {
cs = new CGSchema(fs, false, comparator, name, serializer, compressor, owner, group, perm);
}
{if (true) return cs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema ColumnSchema(int colIndex) throws ParseException, ParseException {
Token t1;
String name = "";
Schema.ColumnSchema fs = null;
if (jj_2_1(2)) {
fs = SchemaRecord(mSchema, name, colIndex);
} else if (jj_2_2(2)) {
fs = SchemaMap(mSchema, name, colIndex);
} else if (jj_2_3(2)) {
fs = AtomSchema(mSchema, name, colIndex);
} else {
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema AtomSchema(Schema schema, String name, int colIndex) throws ParseException, ParseException {
Token t1 = null;
Schema.ColumnSchema fs;
t1 = jj_consume_token(IDENTIFIER);
Schema.ColumnSchema fs0 = schema.getColumn(t1.image);
name += t1.image;
if (fs0 == null)
{
String msg = "Column "+name+" not defined in schema";
{if (true) throw new ParseException(msg);}
}
/* create a new field schema using concatenated name */
if (!partition.getPartitionInfo().setCGIndex(fs0, mCGCount, colIndex, name))
{
{if (true) throw new ParseException("Column "+name+" specified more than once!");}
}
fs = new Schema.ColumnSchema(name, fs0.getSchema(), fs0.getType());
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema SchemaMap(Schema schema, String name, int colIndex) throws ParseException, ParseException {
Token t1 = null;
Schema.ColumnSchema fs;
t1 = jj_consume_token(IDENTIFIER);
jj_consume_token(31);
fs = AnonymousMapSchema(schema.getColumn(t1.image), t1.image, 0, colIndex);
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema SchemaRecord(Schema schema, String name, int colIndex) throws ParseException, ParseException {
Token t1 = null;
Schema.ColumnSchema fs;
t1 = jj_consume_token(IDENTIFIER);
jj_consume_token(32);
fs = AnonymousRecordSchema(schema.getColumn(t1.image), t1.image, 0, colIndex);
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema AnonymousColumnSchema(Schema.ColumnSchema schema, String name, int cl, int colIndex) throws ParseException, ParseException {
Token t1;
Schema.ColumnSchema fs = null;
if (jj_2_4(2147483647)) {
fs = AnonymousSchemaRecord(schema, name, cl, colIndex);
} else if (jj_2_5(2147483647)) {
fs = AnonymousSchemaMap(schema, name, cl, colIndex);
} else {
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema AnonymousSchemaRecord(Schema.ColumnSchema schema, String name, int cl, int colIndex) throws ParseException, ParseException {
Schema.ColumnSchema fs;
jj_consume_token(32);
fs = AnonymousRecordSchema(schema, name, cl, colIndex);
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema AnonymousSchemaMap(Schema.ColumnSchema schema, String name, int cl, int colIndex) throws ParseException, ParseException {
Schema.ColumnSchema fs;
jj_consume_token(31);
fs = AnonymousMapSchema(schema, name, cl, colIndex);
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema RecordSchema(Schema list) throws ParseException, ParseException {
if (list == null)
list = new Schema();
Schema.ColumnSchema fs = null;
int colIndex = 0;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IDENTIFIER:
fs = ColumnSchema(colIndex);
list.add(fs);
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 33:
;
break;
default:
jj_la1[8] = jj_gen;
break label_4;
}
jj_consume_token(33);
fs = ColumnSchema(++colIndex);
list.add(fs);
}
break;
default:
jj_la1[9] = jj_gen;
list = null;
}
{if (true) return list;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema AnonymousRecordSchema(Schema.ColumnSchema schema, String name, int cl, int colIndex) throws ParseException, ParseException {
Schema.ColumnSchema fs = null, fs0 = null;
Token t;
ColumnType ct;
if (schema == null)
{
String msg = "no matching column: " + name;
throw new ParseException(msg);
} else if ((ct = schema.getType()) != ColumnType.RECORD && ct != ColumnType.COLLECTION) {
String msg = "Column " + name + " is not a record or a collection of records";
throw new ParseException(msg);
} else if (ct == ColumnType.COLLECTION) {
String msg = "Split of COLLECTION Column, " + name + ", is not supported in this release";
throw new ParseException(msg);
}
Schema cschema = schema.getSchema();
if (ct == ColumnType.COLLECTION)
{
cl += 1;
if (cschema.getNumColumns() == 1 && cschema.getColumn(0).getType() == ColumnType.RECORD && (cschema.getColumn(0).getName() == null || cschema.getColumn(0).getName().isEmpty()))
// an anonymous record inside a collection: go one level lower
{
schema = cschema.getColumn(0);
partition.setSplit(schema, Partition.SplitType.RECORD, Partition.SplitType.RECORD, name, null, false);
}
}
if (jj_2_6(2)) {
t = jj_consume_token(IDENTIFIER);
fs = AnonymousSchemaRecord(cschema.getColumn(t.image), name + "." + t.image, cl, colIndex);
partition.setSplit(schema, Partition.SplitType.RECORD, Partition.SplitType.RECORD, name, t.image, true);
{if (true) return fs;}
} else if (jj_2_7(2)) {
t = jj_consume_token(IDENTIFIER);
fs = AnonymousSchemaMap(cschema.getColumn(t.image), name + "." + t.image, cl, colIndex);
partition.setSplit(schema, Partition.SplitType.RECORD, Partition.SplitType.MAP, name, t.image, true);
{if (true) return fs;}
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IDENTIFIER:
t = jj_consume_token(IDENTIFIER);
partition.setSplit(schema, Partition.SplitType.RECORD, Partition.SplitType.NONE, name, t.image, false);
name = name + "." + t.image;
fs0 = cschema.getColumn(t.image);
if (fs0 == null)
{
String msg = "no matching column: " + name;
{if (true) throw new ParseException(msg);}
}
if (!partition.setCGIndex(fs0, mCGCount, colIndex, name))
{if (true) throw new ParseException("Column "+name+" specified more than once!");}
fs = new Schema.ColumnSchema(name, fs0.getSchema(), fs0.getType());
break;
default:
jj_la1[10] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public Schema.ColumnSchema AnonymousMapSchema(Schema.ColumnSchema schema, String name, int cl, int colIndex) throws ParseException, ParseException {
Schema.ColumnSchema fs = null;
HashSet<String> keys;
if (schema == null)
{
String msg = "no matching column: " + name;
throw new ParseException(msg);
} else if (schema.getType() != ColumnType.MAP) {
String msg = "Column " + name + " is not a map";
throw new ParseException(msg);
}
partition.setSplit(schema, Partition.SplitType.MAP, Partition.SplitType.RECORD, name, null, false);
jj_consume_token(34);
keys = hashKeys();
jj_consume_token(35);
if(!partition.getPartitionInfo().setKeyCGIndex(schema, mCGCount, colIndex, name, keys))
{if (true) throw new ParseException("Column "+name+" has split keys splecified more than once.");}
fs = new Schema.ColumnSchema(name, schema.getSchema(), schema.getType());
{if (true) return fs;}
throw new Error("Missing return statement in function");
}
final public HashSet<String> hashKeys() throws ParseException {
Token t;
HashSet<String> result = new HashSet<String>();
t = hashKey();
result.add(t.image);
label_5:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case 36:
;
break;
default:
jj_la1[11] = jj_gen;
break label_5;
}
jj_consume_token(36);
t = hashKey();
result.add(t.image);
}
{if (true) return result;}
throw new Error("Missing return statement in function");
}
final public Token hashKey() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case MAPKEYIDENTIFIER:
t = jj_consume_token(MAPKEYIDENTIFIER);
break;
case IDENTIFIER:
t = jj_consume_token(IDENTIFIER);
break;
default:
jj_la1[12] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return t;}
throw new Error("Missing return statement in function");
}
private boolean jj_2_1(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_1(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(0, xla); }
}
private boolean jj_2_2(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_2(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(1, xla); }
}
private boolean jj_2_3(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_3(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(2, xla); }
}
private boolean jj_2_4(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_4(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(3, xla); }
}
private boolean jj_2_5(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_5(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(4, xla); }
}
private boolean jj_2_6(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_6(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(5, xla); }
}
private boolean jj_2_7(int xla) {
jj_la = xla; jj_lastpos = jj_scanpos = token;
try { return !jj_3_7(); }
catch(LookaheadSuccess ls) { return true; }
finally { jj_save(6, xla); }
}
private boolean jj_3R_8() {
if (jj_scan_token(IDENTIFIER)) return true;
return false;
}
private boolean jj_3_6() {
if (jj_scan_token(IDENTIFIER)) return true;
if (jj_3R_9()) return true;
return false;
}
private boolean jj_3R_6() {
if (jj_scan_token(IDENTIFIER)) return true;
if (jj_scan_token(32)) return true;
return false;
}
private boolean jj_3R_11() {
Token xsp;
xsp = jj_scanpos;
if (jj_3_6()) {
jj_scanpos = xsp;
if (jj_3_7()) {
jj_scanpos = xsp;
if (jj_3R_13()) return true;
}
}
return false;
}
private boolean jj_3_3() {
if (jj_3R_8()) return true;
return false;
}
private boolean jj_3R_12() {
if (jj_scan_token(34)) return true;
if (jj_3R_14()) return true;
if (jj_scan_token(35)) return true;
return false;
}
private boolean jj_3_2() {
if (jj_3R_7()) return true;
return false;
}
private boolean jj_3_1() {
if (jj_3R_6()) return true;
return false;
}
private boolean jj_3R_10() {
if (jj_scan_token(31)) return true;
if (jj_3R_12()) return true;
return false;
}
private boolean jj_3R_7() {
if (jj_scan_token(IDENTIFIER)) return true;
if (jj_scan_token(31)) return true;
return false;
}
private boolean jj_3R_15() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(25)) {
jj_scanpos = xsp;
if (jj_scan_token(24)) return true;
}
return false;
}
private boolean jj_3R_9() {
if (jj_scan_token(32)) return true;
if (jj_3R_11()) return true;
return false;
}
private boolean jj_3_5() {
if (jj_3R_10()) return true;
return false;
}
private boolean jj_3_4() {
if (jj_3R_9()) return true;
return false;
}
private boolean jj_3R_16() {
if (jj_scan_token(36)) return true;
if (jj_3R_15()) return true;
return false;
}
private boolean jj_3R_13() {
if (jj_scan_token(IDENTIFIER)) return true;
return false;
}
private boolean jj_3R_14() {
if (jj_3R_15()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_16()) { jj_scanpos = xsp; break; }
}
return false;
}
private boolean jj_3_7() {
if (jj_scan_token(IDENTIFIER)) return true;
if (jj_3R_10()) return true;
return false;
}
/** Generated Token Manager. */
public TableStorageParserTokenManager token_source;
SimpleCharStream jj_input_stream;
/** Current token. */
public Token token;
/** Next token. */
public Token jj_nt;
private int jj_ntk;
private Token jj_scanpos, jj_lastpos;
private int jj_la;
private int jj_gen;
final private int[] jj_la1 = new int[13];
static private int[] jj_la1_0;
static private int[] jj_la1_1;
static {
jj_la1_init_0();
jj_la1_init_1();
}
private static void jj_la1_init_0() {
jj_la1_0 = new int[] {0x8000000,0x1800,0x10000000,0x20000,0x2600,0x1c000,0x1c000,0x2600,0x0,0x1000000,0x1000000,0x0,0x3000000,};
}
private static void jj_la1_init_1() {
jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x10,0x0,};
}
final private JJCalls[] jj_2_rtns = new JJCalls[7];
private boolean jj_rescan = false;
private int jj_gc = 0;
/** Constructor with InputStream. */
public TableStorageParser(java.io.InputStream stream) {
this(stream, null);
}
/** Constructor with InputStream and supplied encoding */
public TableStorageParser(java.io.InputStream stream, String encoding) {
try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source = new TableStorageParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 13; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream) {
ReInit(stream, null);
}
/** Reinitialise. */
public void ReInit(java.io.InputStream stream, String encoding) {
try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); }
token_source.ReInit(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 13; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Constructor. */
public TableStorageParser(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new TableStorageParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 13; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Reinitialise. */
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 < 13; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Constructor with generated Token Manager. */
public TableStorageParser(TableStorageParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 13; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
/** Reinitialise. */
public void ReInit(TableStorageParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 13; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
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++;
if (++jj_gc > 100) {
jj_gc = 0;
for (int i = 0; i < jj_2_rtns.length; i++) {
JJCalls c = jj_2_rtns[i];
while (c != null) {
if (c.gen < jj_gen) c.first = null;
c = c.next;
}
}
}
return token;
}
token = oldToken;
jj_kind = kind;
throw generateParseException();
}
static private final class LookaheadSuccess extends java.lang.Error { }
final private LookaheadSuccess jj_ls = new LookaheadSuccess();
private boolean jj_scan_token(int kind) {
if (jj_scanpos == jj_lastpos) {
jj_la--;
if (jj_scanpos.next == null) {
jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken();
} else {
jj_lastpos = jj_scanpos = jj_scanpos.next;
}
} else {
jj_scanpos = jj_scanpos.next;
}
if (jj_rescan) {
int i = 0; Token tok = token;
while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; }
if (tok != null) jj_add_error_token(kind, i);
}
if (jj_scanpos.kind != kind) return true;
if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls;
return false;
}
/** Get the next Token. */
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;
}
/** Get the specific 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;
}
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.List jj_expentries = new java.util.ArrayList();
private int[] jj_expentry;
private int jj_kind = -1;
private int[] jj_lasttokens = new int[100];
private int jj_endpos;
private void jj_add_error_token(int kind, int pos) {
if (pos >= 100) return;
if (pos == jj_endpos + 1) {
jj_lasttokens[jj_endpos++] = kind;
} else if (jj_endpos != 0) {
jj_expentry = new int[jj_endpos];
for (int i = 0; i < jj_endpos; i++) {
jj_expentry[i] = jj_lasttokens[i];
}
jj_entries_loop: for (java.util.Iterator it = jj_expentries.iterator(); it.hasNext();) {
int[] oldentry = (int[])(it.next());
if (oldentry.length == jj_expentry.length) {
for (int i = 0; i < jj_expentry.length; i++) {
if (oldentry[i] != jj_expentry[i]) {
continue jj_entries_loop;
}
}
jj_expentries.add(jj_expentry);
break jj_entries_loop;
}
}
if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
}
}
/** Generate ParseException. */
public ParseException generateParseException() {
jj_expentries.clear();
boolean[] la1tokens = new boolean[37];
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 13; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1<<j)) != 0) {
la1tokens[j] = true;
}
if ((jj_la1_1[i] & (1<<j)) != 0) {
la1tokens[32+j] = true;
}
}
}
}
for (int i = 0; i < 37; i++) {
if (la1tokens[i]) {
jj_expentry = new int[1];
jj_expentry[0] = i;
jj_expentries.add(jj_expentry);
}
}
jj_endpos = 0;
jj_rescan_token();
jj_add_error_token(0, 0);
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = (int[])jj_expentries.get(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
/** Enable tracing. */
final public void enable_tracing() {
}
/** Disable tracing. */
final public void disable_tracing() {
}
private void jj_rescan_token() {
jj_rescan = true;
for (int i = 0; i < 7; i++) {
try {
JJCalls p = jj_2_rtns[i];
do {
if (p.gen > jj_gen) {
jj_la = p.arg; jj_lastpos = jj_scanpos = p.first;
switch (i) {
case 0: jj_3_1(); break;
case 1: jj_3_2(); break;
case 2: jj_3_3(); break;
case 3: jj_3_4(); break;
case 4: jj_3_5(); break;
case 5: jj_3_6(); break;
case 6: jj_3_7(); break;
}
}
p = p.next;
} while (p != null);
} catch(LookaheadSuccess ls) { }
}
jj_rescan = false;
}
private void jj_save(int index, int xla) {
JJCalls p = jj_2_rtns[index];
while (p.gen > jj_gen) {
if (p.next == null) { p = p.next = new JJCalls(); break; }
p = p.next;
}
p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla;
}
static final class JJCalls {
int gen;
Token first;
int arg;
JJCalls next;
}
}