📄 slparser.java
字号:
case ACTIONOP:
t = jj_consume_token(ACTIONOP);
term = ActionExpression();
val = new AbsPredicate(t.image);
try {
slotNames = curOntology.getSchema(t.image).getNames();
val.set(slotNames[0], term);
} catch (Exception e) {
val.set(Codec.UNNAMEDPREFIX+"0", term);
}
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACE:
case WORD:
case STRING_LITERAL:
case METASYMBOL:
case LBRACE2:
case WORD2:
case STRING_LITERAL2:
case METASYMBOL2:
arg1 = Wff();
try {
val.set(slotNames[1], arg1);
} catch (Exception e) {
val.set(Codec.UNNAMEDPREFIX+"1", arg1);
}
break;
default:
jj_la1[17] = jj_gen;
;
}
break;
case WORD:
case STRING_LITERAL:
case WORD2:
case STRING_LITERAL2:
s = String();
val = new AbsPredicate(s); int slotNumber=0;
try {
slotNames = curOntology.getSchema(s).getNames();
} catch (Exception e) {
}
label_4:
while (true) {
term = Term();
try {
val.set(slotNames[slotNumber], term);
} catch (Exception e) {
val.set(Codec.UNNAMEDPREFIX+slotNumber, term);
}
slotNumber++;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case LBRACE:
case VARIABLE:
case INTEGER:
case HEXINTEGER:
case FLOATONE:
case FLOATTWO:
case WORD:
case STRING_LITERAL:
case DATETIME:
case PREFIXBYTELENGTHENCODEDSTRING:
case METASYMBOL:
case LBRACE2:
case WORD2:
case STRING_LITERAL2:
case METASYMBOL2:
;
break;
default:
jj_la1[18] = jj_gen;
break label_4;
}
}
break;
default:
jj_la1[19] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return val;}
throw new Error("Missing return statement in function");
}
final public AbsPrimitive Number() throws ParseException {
Token t; AbsPrimitive val = null;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case INTEGER:
t = jj_consume_token(INTEGER);
long value;
try {
val = AbsPrimitive.wrap(Long.parseLong(t.image));
} catch (NumberFormatException e) { //should never happen
e.printStackTrace();
val=AbsPrimitive.wrap(t.image);
}
break;
case HEXINTEGER:
t = jj_consume_token(HEXINTEGER);
val=AbsPrimitive.wrap(t.image);
break;
case FLOATONE:
t = jj_consume_token(FLOATONE);
double d1;
try {
// J2ME incompatible d1=Double.parseDouble(t.image);
d1=(new Double(t.image)).doubleValue();
val=AbsPrimitive.wrap(d1);
} catch (NumberFormatException e) { //should never happen
e.printStackTrace();
val=AbsPrimitive.wrap(t.image);
}
break;
case FLOATTWO:
t = jj_consume_token(FLOATTWO);
double d2;
try {
// J2ME incompatible d2=Double.parseDouble(t.image);
d2=(new Double(t.image)).doubleValue();
val=AbsPrimitive.wrap(d2);
} catch (NumberFormatException e) { //should never happen
e.printStackTrace();
val=AbsPrimitive.wrap(t.image);
}
break;
default:
jj_la1[20] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
{if (true) return val;}
throw new Error("Missing return statement in function");
}
/**
* <p> <code> String = WORD | STRING_LITERAL </code>
*/
final public String String() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case WORD2:
t = jj_consume_token(WORD2);
{if (true) return t.image;}
break;
case STRING_LITERAL2:
t = jj_consume_token(STRING_LITERAL2);
if ( (CaseInsensitiveString.equalsIgnoreCase(t.image,"\"true\""))
||(CaseInsensitiveString.equalsIgnoreCase(t.image,"\"false\"")) )
// in this case leading/trailing quotes must be left
// otherwise the value is confused with a boolean
{if (true) return t.image;}
else
{if (true) return unescape(t.image);}
break;
case WORD:
t = jj_consume_token(WORD);
{if (true) return t.image;}
break;
case STRING_LITERAL:
t = jj_consume_token(STRING_LITERAL);
if ( (CaseInsensitiveString.equalsIgnoreCase(t.image,"\"true\""))
||(CaseInsensitiveString.equalsIgnoreCase(t.image,"\"false\"")) )
// in this case leading/trailing quotes must be left
// otherwise the value is confused with a boolean
{if (true) return t.image;}
else
{if (true) return unescape(t.image);}
break;
default:
jj_la1[21] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
throw new Error("Missing return statement in function");
}
/** This grammar rule is an extension to the FIPA SL Grammar. It is specific to the semantics framework.
It allows to represent a symbol which is not matched by any FIPA-SL token. **/
final public String MetaSymbol() throws ParseException {
Token t;
switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
case METASYMBOL:
t = jj_consume_token(METASYMBOL);
break;
case METASYMBOL2:
t = jj_consume_token(METASYMBOL2);
break;
default:
jj_la1[22] = jj_gen;
jj_consume_token(-1);
throw new ParseException();
}
if (!metaAllowed) {if (true) throw new ParseException(META_EXCEPTION_MESSAGE);} else {if (true) return t.image;}
throw new Error("Missing return statement in function");
}
public SLParserTokenManager token_source;
SimpleCharStream jj_input_stream;
public Token token, jj_nt;
private int jj_ntk;
private int jj_gen;
final private int[] jj_la1 = new int[23];
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[] {0x843020,0x800020,0x1000040,0x843020,0xee003000,0x56003000,0x873fa0,0x33f00,0x87ffa0,0x10003000,0x873fa0,0xc000,0x87ffa0,0xc000,0x42000000,0x840020,0x843020,0x843020,0x873fa0,0xa8003000,0xf00,0x3000,0x40000,};
}
private static void jj_la1_1() {
jj_la1_1 = new int[] {0x1c,0x0,0x0,0x1c,0xf,0xc,0x1c,0xc,0x1c,0xc,0x1c,0x0,0x1c,0x0,0x0,0x10,0x1c,0x1c,0x1c,0xf,0x0,0xc,0x10,};
}
public SLParser(java.io.InputStream stream) {
this(stream, null);
}
public SLParser(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 SLParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 23; i++) jj_la1[i] = -1;
}
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 < 23; i++) jj_la1[i] = -1;
}
public SLParser(java.io.Reader stream) {
jj_input_stream = new SimpleCharStream(stream, 1, 1);
token_source = new SLParserTokenManager(jj_input_stream);
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 23; i++) jj_la1[i] = -1;
}
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 < 23; i++) jj_la1[i] = -1;
}
public SLParser(SLParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 23; i++) jj_la1[i] = -1;
}
public void ReInit(SLParserTokenManager tm) {
token_source = tm;
token = new Token();
jj_ntk = -1;
jj_gen = 0;
for (int i = 0; i < 23; i++) jj_la1[i] = -1;
}
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++;
return token;
}
token = oldToken;
jj_kind = kind;
throw generateParseException();
}
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 = 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;
public ParseException generateParseException() {
jj_expentries.removeAllElements();
boolean[] la1tokens = new boolean[37];
for (int i = 0; i < 37; i++) {
la1tokens[i] = false;
}
if (jj_kind >= 0) {
la1tokens[jj_kind] = true;
jj_kind = -1;
}
for (int i = 0; i < 23; 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.addElement(jj_expentry);
}
}
int[][] exptokseq = new int[jj_expentries.size()][];
for (int i = 0; i < jj_expentries.size(); i++) {
exptokseq[i] = (int[])jj_expentries.elementAt(i);
}
return new ParseException(token, exptokseq, tokenImage);
}
final public void enable_tracing() {
}
final public void disable_tracing() {
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -