org.apache.activemq.protobuf.compiler.parser.ProtoParser Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of activemq-osgi Show documentation
Show all versions of activemq-osgi Show documentation
Puts together an ActiveMQ OSGi bundle
/* Generated By:JavaCC: Do not edit this line. ProtoParser.java */
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.activemq.protobuf.compiler.parser;
import org.apache.activemq.protobuf.compiler.*;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.io.File;
import java.io.FileReader;
import java.io.FileNotFoundException;
import java.io.IOException;
/**
* This class is generated with JavaCC. Do not modify manually.
*/
public class ProtoParser implements ProtoParserConstants {
final public ProtoDescriptor ProtoDescriptor() throws ParseException {
ProtoDescriptor proto = new ProtoDescriptor();
String packageName=null;
LinkedHashMap opts = new LinkedHashMap();
LinkedHashMap messages = new LinkedHashMap();
LinkedHashMap enums = new LinkedHashMap();
ArrayList extendsList = new ArrayList();
LinkedHashMap services = new LinkedHashMap();
ArrayList imports = new ArrayList();
OptionDescriptor optionD;
MessageDescriptor messageD;
EnumDescriptor enumD;
ServiceDescriptor serviceD;
MessageDescriptor extendD;
String o;
label_1:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PACKAGE:
jj_consume_token(PACKAGE);
packageName = PackageID();
jj_consume_token(SEMICOLON);
break;
case OPTION:
jj_consume_token(OPTION);
optionD = OptionDescriptor();
jj_consume_token(SEMICOLON);
opts.put(optionD.getName(),optionD);
break;
case IMPORT:
jj_consume_token(IMPORT);
o = StringLitteral();
jj_consume_token(SEMICOLON);
imports.add((String)o);
break;
case MESSAGE:
messageD = MessageDescriptor(proto, null);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[0] = jj_gen;
;
}
messages.put(messageD.getName(),messageD);
break;
case ENUM:
enumD = EnumDescriptor(proto, null);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[1] = jj_gen;
;
}
enums.put(enumD.getName(),enumD);
break;
case SERVICE:
serviceD = ServiceDescriptor(proto);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[2] = jj_gen;
;
}
services.put(serviceD.getName(),serviceD);
break;
case EXTEND:
extendD = ExtendDescriptor(proto, null);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[3] = jj_gen;
;
}
extendsList.add(extendD);
break;
default:
jj_la1[4] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IMPORT:
case PACKAGE:
case SERVICE:
case OPTION:
case MESSAGE:
case EXTEND:
case ENUM:
;
break;
default:
jj_la1[5] = jj_gen;
break label_1;
}
}
jj_consume_token(0);
proto.setPackageName(packageName);
proto.setImports(imports);
proto.setOptions(opts);
proto.setMessages(messages);
proto.setEnums(enums);
proto.setServices(services);
proto.setExtends(extendsList);
{if (true) return proto;}
throw new Error("Missing return statement in function");
}
final public MessageDescriptor MessageDescriptor(ProtoDescriptor proto, MessageDescriptor parent) throws ParseException {
String name;
LinkedHashMap fields = new LinkedHashMap();
LinkedHashMap messages = new LinkedHashMap();
LinkedHashMap enums = new LinkedHashMap();
ArrayList extendsList = new ArrayList();
LinkedHashMap opts = new LinkedHashMap();
MessageDescriptor rc = new MessageDescriptor(proto, parent);
OptionDescriptor optionD;
ExtensionsDescriptor extensionsD=null;
FieldDescriptor fieldD;
MessageDescriptor messageD;
EnumDescriptor enumD;
MessageDescriptor extendD;
jj_consume_token(MESSAGE);
name = ID();
jj_consume_token(LBRACE);
label_2:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OPTION:
case MESSAGE:
case EXTENSIONS:
case EXTEND:
case ENUM:
case REQURIED:
case OPTIONAL:
case REPEATED:
;
break;
default:
jj_la1[6] = jj_gen;
break label_2;
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case OPTION:
jj_consume_token(OPTION);
optionD = OptionDescriptor();
jj_consume_token(SEMICOLON);
opts.put(optionD.getName(),optionD);
break;
case REQURIED:
case OPTIONAL:
case REPEATED:
fieldD = FieldDescriptor(rc);
fields.put(fieldD.getName(), fieldD);
break;
case MESSAGE:
messageD = MessageDescriptor(proto, rc);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[7] = jj_gen;
;
}
messages.put(messageD.getName(),messageD);
break;
case ENUM:
enumD = EnumDescriptor(proto, rc);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[8] = jj_gen;
;
}
enums.put(enumD.getName(), enumD);
break;
case EXTENSIONS:
extensionsD = ExtensionsDescriptor(rc);
jj_consume_token(SEMICOLON);
break;
case EXTEND:
extendD = ExtendDescriptor(proto, rc);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[9] = jj_gen;
;
}
extendsList.add(extendD);
break;
default:
jj_la1[10] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
jj_consume_token(RBRACE);
rc.setName(name);
rc.setFields(fields);
rc.setMessages(messages);
rc.setEnums(enums);
rc.setExtensions(extensionsD);
rc.setOptions(opts);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
/**
* Parses something like:
* optional string foo = 1;
*/
final public FieldDescriptor FieldDescriptor(MessageDescriptor parent) throws ParseException {
String rule;
String type;
String name;
int tag;
LinkedHashMap opts = new LinkedHashMap();
LinkedHashMap fields = new LinkedHashMap();
OptionDescriptor optionD;
FieldDescriptor fieldD;
FieldDescriptor rc = new FieldDescriptor(parent);
MessageDescriptor group = new MessageDescriptor(parent.getProtoDescriptor(), parent);
rule = Rule();
if (jj_2_1(5)) {
type = PackageID();
name = ID();
jj_consume_token(EQUALS);
tag = Integer();
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACKET:
jj_consume_token(LBRACKET);
optionD = OptionDescriptor();
opts.put(optionD.getName(), optionD);
label_3:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case COMMA:
;
break;
default:
jj_la1[11] = jj_gen;
break label_3;
}
jj_consume_token(COMMA);
optionD = OptionDescriptor();
opts.put(optionD.getName(), optionD);
}
jj_consume_token(RBRACKET);
break;
default:
jj_la1[12] = jj_gen;
;
}
jj_consume_token(SEMICOLON);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case GROUP:
jj_consume_token(GROUP);
name = ID();
jj_consume_token(EQUALS);
tag = Integer();
jj_consume_token(LBRACE);
label_4:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case REQURIED:
case OPTIONAL:
case REPEATED:
;
break;
default:
jj_la1[13] = jj_gen;
break label_4;
}
fieldD = FieldDescriptor(group);
fields.put(fieldD.getName(), fieldD);
}
jj_consume_token(RBRACE);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case SEMICOLON:
jj_consume_token(SEMICOLON);
break;
default:
jj_la1[14] = jj_gen;
;
}
type = name;
group.setName(name);
group.setFields(fields);
rc.setGroup(group);
break;
default:
jj_la1[15] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
rc.setName(name);
rc.setType(type);
rc.setRule(rule);
rc.setTag(tag);
rc.setOptions(opts);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
final public ServiceDescriptor ServiceDescriptor(ProtoDescriptor proto) throws ParseException {
String name;
ArrayList methods = new ArrayList();
MethodDescriptor method;
jj_consume_token(SERVICE);
name = ID();
jj_consume_token(LBRACE);
label_5:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case RPC:
;
break;
default:
jj_la1[16] = jj_gen;
break label_5;
}
method = MethodDescriptor(proto);
jj_consume_token(SEMICOLON);
methods.add(method);
}
jj_consume_token(RBRACE);
ServiceDescriptor rc = new ServiceDescriptor(proto);
rc.setName(name);
rc.setMethods(methods);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
final public MethodDescriptor MethodDescriptor(ProtoDescriptor proto) throws ParseException {
String name;
String input;
String output;
jj_consume_token(RPC);
name = ID();
jj_consume_token(LPAREN);
input = PackageID();
jj_consume_token(RPAREN);
jj_consume_token(RETURNS);
jj_consume_token(LPAREN);
output = PackageID();
jj_consume_token(RPAREN);
MethodDescriptor rc = new MethodDescriptor(proto);
rc.setName(name);
rc.setParameter(input);
rc.setReturns(output);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
final public OptionDescriptor OptionDescriptor() throws ParseException {
String name;
String value;
name = ID();
jj_consume_token(EQUALS);
value = Value();
OptionDescriptor rc = new OptionDescriptor();
rc.setName(name);
rc.setValue(value);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
final public MessageDescriptor ExtendDescriptor(ProtoDescriptor proto, MessageDescriptor parent) throws ParseException {
String name;
LinkedHashMap fields = new LinkedHashMap();
MessageDescriptor rc = new MessageDescriptor(proto, parent);
FieldDescriptor fieldD;
jj_consume_token(EXTEND);
name = ID();
jj_consume_token(LBRACE);
label_6:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case REQURIED:
case OPTIONAL:
case REPEATED:
;
break;
default:
jj_la1[17] = jj_gen;
break label_6;
}
fieldD = FieldDescriptor(rc);
fields.put(fieldD.getName(), fieldD);
}
jj_consume_token(RBRACE);
rc.setName(name);
rc.setFields(fields);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
final public ExtensionsDescriptor ExtensionsDescriptor(MessageDescriptor parent) throws ParseException {
int first;
int last;
jj_consume_token(EXTENSIONS);
first = Integer();
jj_consume_token(TO);
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER:
last = Integer();
break;
case MAX:
jj_consume_token(MAX);
last=536870911;
break;
default:
jj_la1[18] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
ExtensionsDescriptor rc = new ExtensionsDescriptor(parent);
rc.setFirst(first);
rc.setLast(last);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
final public EnumDescriptor EnumDescriptor(ProtoDescriptor proto, MessageDescriptor parent) throws ParseException {
Token name;
LinkedHashMap fields = new LinkedHashMap();
EnumDescriptor rc = new EnumDescriptor(proto, parent);
LinkedHashMap opts = new LinkedHashMap();
EnumFieldDescriptor enumD;
OptionDescriptor optionD;
jj_consume_token(ENUM);
name = jj_consume_token(ID);
jj_consume_token(LBRACE);
label_7:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IMPORT:
case PACKAGE:
case SERVICE:
case RPC:
case OPTION:
case MESSAGE:
case EXTENSIONS:
case EXTEND:
case ENUM:
case GROUP:
case REQURIED:
case OPTIONAL:
case REPEATED:
case RETURNS:
case TO:
case MAX:
case ID:
;
break;
default:
jj_la1[19] = jj_gen;
break label_7;
}
if (jj_2_2(2)) {
jj_consume_token(OPTION);
optionD = OptionDescriptor();
jj_consume_token(SEMICOLON);
opts.put(optionD.getName(),optionD);
} else {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case IMPORT:
case PACKAGE:
case SERVICE:
case RPC:
case OPTION:
case MESSAGE:
case EXTENSIONS:
case EXTEND:
case ENUM:
case GROUP:
case REQURIED:
case OPTIONAL:
case REPEATED:
case RETURNS:
case TO:
case MAX:
case ID:
enumD = EnumFieldDescriptor(rc);
jj_consume_token(SEMICOLON);
fields.put(enumD.getName(),enumD);
break;
default:
jj_la1[20] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
}
}
jj_consume_token(RBRACE);
rc.setName(name.image);
rc.setFields(fields);
rc.setOptions(opts);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
/**
* Parses something like:
* optional string foo = 1;
*/
final public EnumFieldDescriptor EnumFieldDescriptor(EnumDescriptor parent) throws ParseException {
String name;
int value=0;
name = ID();
jj_consume_token(EQUALS);
value = Integer();
EnumFieldDescriptor rc = new EnumFieldDescriptor(parent);
rc.setName(name);
rc.setValue(value);
{if (true) return rc;}
throw new Error("Missing return statement in function");
}
final public int Integer() throws ParseException {
Token t;
t = jj_consume_token(INTEGER);
{if (true) return Integer.parseInt(t.image);}
throw new Error("Missing return statement in function");
}
final public String Rule() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case REQURIED:
t = jj_consume_token(REQURIED);
break;
case OPTIONAL:
t = jj_consume_token(OPTIONAL);
break;
case REPEATED:
t = jj_consume_token(REPEATED);
break;
default:
jj_la1[21] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return t.image;}
throw new Error("Missing return statement in function");
}
final public String Value() throws ParseException {
Token t;
String value=null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case STRING:
value = StringLitteral();
break;
case IMPORT:
case PACKAGE:
case SERVICE:
case RPC:
case OPTION:
case MESSAGE:
case EXTENSIONS:
case EXTEND:
case ENUM:
case GROUP:
case REQURIED:
case OPTIONAL:
case REPEATED:
case RETURNS:
case TO:
case MAX:
case ID:
value = ID();
break;
case INTEGER:
t = jj_consume_token(INTEGER);
value = t.image;
break;
case FLOAT:
t = jj_consume_token(FLOAT);
value = t.image;
break;
default:
jj_la1[22] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return value;}
throw new Error("Missing return statement in function");
}
final public String ID() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case ID:
t = jj_consume_token(ID);
break;
case GROUP:
t = jj_consume_token(GROUP);
break;
case IMPORT:
t = jj_consume_token(IMPORT);
break;
case PACKAGE:
t = jj_consume_token(PACKAGE);
break;
case SERVICE:
t = jj_consume_token(SERVICE);
break;
case RPC:
t = jj_consume_token(RPC);
break;
case OPTION:
t = jj_consume_token(OPTION);
break;
case MESSAGE:
t = jj_consume_token(MESSAGE);
break;
case EXTENSIONS:
t = jj_consume_token(EXTENSIONS);
break;
case EXTEND:
t = jj_consume_token(EXTEND);
break;
case ENUM:
t = jj_consume_token(ENUM);
break;
case REQURIED:
t = jj_consume_token(REQURIED);
break;
case OPTIONAL:
t = jj_consume_token(OPTIONAL);
break;
case REPEATED:
t = jj_consume_token(REPEATED);
break;
case RETURNS:
t = jj_consume_token(RETURNS);
break;
case TO:
t = jj_consume_token(TO);
break;
case MAX:
t = jj_consume_token(MAX);
break;
default:
jj_la1[23] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return t.image;}
throw new Error("Missing return statement in function");
}
final public String PackageID() throws ParseException {
String t;
StringBuffer sb = new StringBuffer();
t = ID();
sb.append(t);
label_8:
while (true) {
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case PERIOD:
;
break;
default:
jj_la1[24] = jj_gen;
break label_8;
}
jj_consume_token(PERIOD);
t = ID();
sb.append(".");
sb.append(t);
}
{if (true) return sb.toString();}
throw new Error("Missing return statement in function");
}
final public String StringLitteral() throws ParseException {
Token t;
t = jj_consume_token(STRING);
{if (true) return ParserSupport.decodeString(t);}
throw new Error("Missing return statement in function");
}
final 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); }
}
final 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); }
}
final private boolean jj_3R_14() {
if (jj_scan_token(PERIOD)) return true;
if (jj_3R_10()) return true;
return false;
}
final private boolean jj_3_2() {
if (jj_scan_token(OPTION)) return true;
if (jj_3R_13()) return true;
return false;
}
final private boolean jj_3R_10() {
Token xsp;
xsp = jj_scanpos;
if (jj_scan_token(41)) {
jj_scanpos = xsp;
if (jj_scan_token(17)) {
jj_scanpos = xsp;
if (jj_scan_token(8)) {
jj_scanpos = xsp;
if (jj_scan_token(9)) {
jj_scanpos = xsp;
if (jj_scan_token(10)) {
jj_scanpos = xsp;
if (jj_scan_token(11)) {
jj_scanpos = xsp;
if (jj_scan_token(12)) {
jj_scanpos = xsp;
if (jj_scan_token(13)) {
jj_scanpos = xsp;
if (jj_scan_token(14)) {
jj_scanpos = xsp;
if (jj_scan_token(15)) {
jj_scanpos = xsp;
if (jj_scan_token(16)) {
jj_scanpos = xsp;
if (jj_scan_token(18)) {
jj_scanpos = xsp;
if (jj_scan_token(19)) {
jj_scanpos = xsp;
if (jj_scan_token(20)) {
jj_scanpos = xsp;
if (jj_scan_token(21)) {
jj_scanpos = xsp;
if (jj_scan_token(22)) {
jj_scanpos = xsp;
if (jj_scan_token(23)) return true;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return false;
}
final private boolean jj_3R_11() {
if (jj_scan_token(INTEGER)) return true;
return false;
}
final private boolean jj_3R_9() {
if (jj_3R_10()) return true;
Token xsp;
while (true) {
xsp = jj_scanpos;
if (jj_3R_14()) { jj_scanpos = xsp; break; }
}
return false;
}
final private boolean jj_3R_12() {
if (jj_scan_token(LBRACKET)) return true;
return false;
}
final private boolean jj_3_1() {
if (jj_3R_9()) return true;
if (jj_3R_10()) return true;
if (jj_scan_token(EQUALS)) return true;
if (jj_3R_11()) return true;
Token xsp;
xsp = jj_scanpos;
if (jj_3R_12()) jj_scanpos = xsp;
if (jj_scan_token(SEMICOLON)) return true;
return false;
}
final private boolean jj_3R_13() {
if (jj_3R_10()) return true;
return false;
}
public ProtoParserTokenManager token_source;
SimpleCharStream jj_input_stream;
public Token token, jj_nt;
private int jj_ntk;
private Token jj_scanpos, jj_lastpos;
private int jj_la;
public boolean lookingAhead = false;
private boolean jj_semLA;
private int jj_gen;
final private int[] jj_la1 = new int[25];
static private int[] jj_la1_0;
static private int[] jj_la1_1;
static {
jj_la1_0();
jj_la1_1();
}
private static void jj_la1_0() {
jj_la1_0 = new int[] {0x8000000,0x8000000,0x8000000,0x8000000,0x1b700,0x1b700,0x1df000,0x8000000,0x8000000,0x8000000,0x1df000,0x0,0x10000000,0x1c0000,0x8000000,0x20000,0x800,0x1c0000,0x800000,0xffff00,0xffff00,0x1c0000,0xffff00,0xffff00,0x0,};
}
private static void jj_la1_1() {
jj_la1_1 = new int[] {0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x2,0x0,0x0,0x0,0x0,0x0,0x0,0x4,0x200,0x200,0x0,0x344,0x200,0x1,};
}
final private JJCalls[] jj_2_rtns = new JJCalls[2];
private boolean jj_rescan = false;
private int jj_gc = 0;
public ProtoParser(java.io.InputStream stream) {
this(stream, null);
}
public ProtoParser(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 ProtoParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 25; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public void ReInit(java.io.InputStream stream) {
ReInit(stream, null);
}
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 < 25; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public ProtoParser(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new ProtoParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 25; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
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 < 25; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public ProtoParser(ProtoParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 25; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
public void ReInit(ProtoParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 25; i++) jj_la1[i] = -1;
for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls();
}
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++;
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();
final 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;
}
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 = lookingAhead ? jj_scanpos : 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;
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];
}
boolean exists = false;
for (java.util.Enumeration e = jj_expentries.elements(); e.hasMoreElements();) {
int[] oldentry = (int[])(e.nextElement());
if (oldentry.length == jj_expentry.length) {
exists = true;
for (int i = 0; i < jj_expentry.length; i++) {
if (oldentry[i] != jj_expentry[i]) {
exists = false;
break;
}
}
if (exists) break;
}
}
if (!exists) jj_expentries.addElement(jj_expentry);
if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind;
}
}
public ParseException generateParseException() {
jj_expentries.removeAllElements();
boolean[] la1tokens = new boolean[42];
for (int i = 0; i < 42; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 25; i++) {
if (jj_la1[i] == jj_gen) {
for (int j = 0; j < 32; j++) {
if ((jj_la1_0[i] & (1< 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;
}
}
p = p.next;
} while (p != null);
} catch(LookaheadSuccess ls) { }
}
jj_rescan = false;
}
final 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;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy