add time and tests
This commit is contained in:
parent
ee37f260a3
commit
edcbb72742
9 changed files with 958 additions and 3952 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,784 +0,0 @@
|
|||
State 0:
|
||||
main ::= * expr
|
||||
main ::= * literal
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
id ::= * string_literal
|
||||
id ::= * ID
|
||||
and ::= * expr AND expr
|
||||
or ::= * expr OR expr
|
||||
not ::= * NOT expr
|
||||
eq ::= * id EQ literal
|
||||
neq ::= * id NEQ literal
|
||||
gt ::= * id GT literal
|
||||
gte ::= * id GTE literal
|
||||
lt ::= * id LT literal
|
||||
lte ::= * id LTE literal
|
||||
like ::= * id LIKE literal
|
||||
nlike ::= * id NLIKE literal
|
||||
expr ::= * and
|
||||
expr ::= * or
|
||||
expr ::= * not
|
||||
expr ::= * eq
|
||||
expr ::= * neq
|
||||
expr ::= * gt
|
||||
expr ::= * gte
|
||||
expr ::= * lt
|
||||
expr ::= * lte
|
||||
expr ::= * like
|
||||
expr ::= * nlike
|
||||
expr ::= * LCB expr RCB
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
NOT shift 2
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ID shift-reduce 11 id ::= ID
|
||||
LCB shift 1
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
main accept
|
||||
expr shift 24
|
||||
literal shift 26
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift 25
|
||||
id shift 22
|
||||
and shift-reduce 23 expr ::= and
|
||||
or shift-reduce 24 expr ::= or
|
||||
not shift-reduce 25 expr ::= not
|
||||
eq shift-reduce 26 expr ::= eq
|
||||
neq shift-reduce 27 expr ::= neq
|
||||
gt shift-reduce 28 expr ::= gt
|
||||
gte shift-reduce 29 expr ::= gte
|
||||
lt shift-reduce 30 expr ::= lt
|
||||
lte shift-reduce 31 expr ::= lte
|
||||
like shift-reduce 32 expr ::= like
|
||||
nlike shift-reduce 33 expr ::= nlike
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 1:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
id ::= * string_literal
|
||||
id ::= * ID
|
||||
and ::= * expr AND expr
|
||||
or ::= * expr OR expr
|
||||
not ::= * NOT expr
|
||||
eq ::= * id EQ literal
|
||||
neq ::= * id NEQ literal
|
||||
gt ::= * id GT literal
|
||||
gte ::= * id GTE literal
|
||||
lt ::= * id LT literal
|
||||
lte ::= * id LTE literal
|
||||
like ::= * id LIKE literal
|
||||
nlike ::= * id NLIKE literal
|
||||
expr ::= * and
|
||||
expr ::= * or
|
||||
expr ::= * not
|
||||
expr ::= * eq
|
||||
expr ::= * neq
|
||||
expr ::= * gt
|
||||
expr ::= * gte
|
||||
expr ::= * lt
|
||||
expr ::= * lte
|
||||
expr ::= * like
|
||||
expr ::= * nlike
|
||||
expr ::= * LCB expr RCB
|
||||
expr ::= LCB * expr RCB
|
||||
|
||||
NOT shift 2
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ID shift-reduce 11 id ::= ID
|
||||
LCB shift 1
|
||||
expr shift 23
|
||||
string_literal shift-reduce 10 id ::= string_literal
|
||||
id shift 22
|
||||
and shift-reduce 23 expr ::= and
|
||||
or shift-reduce 24 expr ::= or
|
||||
not shift-reduce 25 expr ::= not
|
||||
eq shift-reduce 26 expr ::= eq
|
||||
neq shift-reduce 27 expr ::= neq
|
||||
gt shift-reduce 28 expr ::= gt
|
||||
gte shift-reduce 29 expr ::= gte
|
||||
lt shift-reduce 30 expr ::= lt
|
||||
lte shift-reduce 31 expr ::= lte
|
||||
like shift-reduce 32 expr ::= like
|
||||
nlike shift-reduce 33 expr ::= nlike
|
||||
|
||||
State 2:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
id ::= * string_literal
|
||||
id ::= * ID
|
||||
and ::= * expr AND expr
|
||||
or ::= * expr OR expr
|
||||
not ::= * NOT expr
|
||||
not ::= NOT * expr
|
||||
eq ::= * id EQ literal
|
||||
neq ::= * id NEQ literal
|
||||
gt ::= * id GT literal
|
||||
gte ::= * id GTE literal
|
||||
lt ::= * id LT literal
|
||||
lte ::= * id LTE literal
|
||||
like ::= * id LIKE literal
|
||||
nlike ::= * id NLIKE literal
|
||||
expr ::= * and
|
||||
expr ::= * or
|
||||
expr ::= * not
|
||||
expr ::= * eq
|
||||
expr ::= * neq
|
||||
expr ::= * gt
|
||||
expr ::= * gte
|
||||
expr ::= * lt
|
||||
expr ::= * lte
|
||||
expr ::= * like
|
||||
expr ::= * nlike
|
||||
expr ::= * LCB expr RCB
|
||||
|
||||
NOT shift 2
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ID shift-reduce 11 id ::= ID
|
||||
LCB shift 1
|
||||
expr shift-reduce 14 not ::= NOT expr
|
||||
string_literal shift-reduce 10 id ::= string_literal
|
||||
id shift 22
|
||||
and shift-reduce 23 expr ::= and
|
||||
or shift-reduce 24 expr ::= or
|
||||
not shift-reduce 25 expr ::= not
|
||||
eq shift-reduce 26 expr ::= eq
|
||||
neq shift-reduce 27 expr ::= neq
|
||||
gt shift-reduce 28 expr ::= gt
|
||||
gte shift-reduce 29 expr ::= gte
|
||||
lt shift-reduce 30 expr ::= lt
|
||||
lte shift-reduce 31 expr ::= lte
|
||||
like shift-reduce 32 expr ::= like
|
||||
nlike shift-reduce 33 expr ::= nlike
|
||||
|
||||
State 3:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
id ::= * string_literal
|
||||
id ::= * ID
|
||||
and ::= * expr AND expr
|
||||
or ::= * expr OR expr
|
||||
or ::= expr OR * expr
|
||||
not ::= * NOT expr
|
||||
eq ::= * id EQ literal
|
||||
neq ::= * id NEQ literal
|
||||
gt ::= * id GT literal
|
||||
gte ::= * id GTE literal
|
||||
lt ::= * id LT literal
|
||||
lte ::= * id LTE literal
|
||||
like ::= * id LIKE literal
|
||||
nlike ::= * id NLIKE literal
|
||||
expr ::= * and
|
||||
expr ::= * or
|
||||
expr ::= * not
|
||||
expr ::= * eq
|
||||
expr ::= * neq
|
||||
expr ::= * gt
|
||||
expr ::= * gte
|
||||
expr ::= * lt
|
||||
expr ::= * lte
|
||||
expr ::= * like
|
||||
expr ::= * nlike
|
||||
expr ::= * LCB expr RCB
|
||||
|
||||
NOT shift 2
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ID shift-reduce 11 id ::= ID
|
||||
LCB shift 1
|
||||
expr shift 37
|
||||
string_literal shift-reduce 10 id ::= string_literal
|
||||
id shift 22
|
||||
and shift-reduce 23 expr ::= and
|
||||
or shift-reduce 24 expr ::= or
|
||||
not shift-reduce 25 expr ::= not
|
||||
eq shift-reduce 26 expr ::= eq
|
||||
neq shift-reduce 27 expr ::= neq
|
||||
gt shift-reduce 28 expr ::= gt
|
||||
gte shift-reduce 29 expr ::= gte
|
||||
lt shift-reduce 30 expr ::= lt
|
||||
lte shift-reduce 31 expr ::= lte
|
||||
like shift-reduce 32 expr ::= like
|
||||
nlike shift-reduce 33 expr ::= nlike
|
||||
|
||||
State 4:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
id ::= * string_literal
|
||||
id ::= * ID
|
||||
and ::= * expr AND expr
|
||||
and ::= expr AND * expr
|
||||
or ::= * expr OR expr
|
||||
not ::= * NOT expr
|
||||
eq ::= * id EQ literal
|
||||
neq ::= * id NEQ literal
|
||||
gt ::= * id GT literal
|
||||
gte ::= * id GTE literal
|
||||
lt ::= * id LT literal
|
||||
lte ::= * id LTE literal
|
||||
like ::= * id LIKE literal
|
||||
nlike ::= * id NLIKE literal
|
||||
expr ::= * and
|
||||
expr ::= * or
|
||||
expr ::= * not
|
||||
expr ::= * eq
|
||||
expr ::= * neq
|
||||
expr ::= * gt
|
||||
expr ::= * gte
|
||||
expr ::= * lt
|
||||
expr ::= * lte
|
||||
expr ::= * like
|
||||
expr ::= * nlike
|
||||
expr ::= * LCB expr RCB
|
||||
|
||||
NOT shift 2
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ID shift-reduce 11 id ::= ID
|
||||
LCB shift 1
|
||||
expr shift-reduce 12 and ::= expr AND expr
|
||||
string_literal shift-reduce 10 id ::= string_literal
|
||||
id shift 22
|
||||
and shift-reduce 23 expr ::= and
|
||||
or shift-reduce 24 expr ::= or
|
||||
not shift-reduce 25 expr ::= not
|
||||
eq shift-reduce 26 expr ::= eq
|
||||
neq shift-reduce 27 expr ::= neq
|
||||
gt shift-reduce 28 expr ::= gt
|
||||
gte shift-reduce 29 expr ::= gte
|
||||
lt shift-reduce 30 expr ::= lt
|
||||
lte shift-reduce 31 expr ::= lte
|
||||
like shift-reduce 32 expr ::= like
|
||||
nlike shift-reduce 33 expr ::= nlike
|
||||
|
||||
State 5:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
nlike ::= id NLIKE * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 22 nlike ::= id NLIKE literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 6:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
like ::= id LIKE * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 21 like ::= id LIKE literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 7:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
lte ::= id LTE * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 20 lte ::= id LTE literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 8:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
lt ::= id LT * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 19 lt ::= id LT literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 9:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
gte ::= id GTE * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 18 gte ::= id GTE literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 10:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
gt ::= id GT * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 17 gt ::= id GT literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 11:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
neq ::= id NEQ * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 16 neq ::= id NEQ literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 12:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
literal ::= * integer_literal
|
||||
float_literal ::= * FLOAT_LITERAL
|
||||
literal ::= * float_literal
|
||||
bool_literal ::= * BOOL_LITERAL
|
||||
literal ::= * bool_literal
|
||||
string_literal ::= * STRING_LITERAL
|
||||
literal ::= * string_literal
|
||||
eq ::= id EQ * literal
|
||||
address_literal ::= * ADDRESS LSB address_literal_content_or_empty RSB
|
||||
literal ::= * address_literal
|
||||
oid_literal ::= * OID LSB oid_literal_content_or_empty RSB
|
||||
literal ::= * oid_literal
|
||||
time_diff_literal ::= * TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
literal ::= * time_diff_literal
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
FLOAT_LITERAL shift-reduce 4 float_literal ::= FLOAT_LITERAL
|
||||
BOOL_LITERAL shift-reduce 6 bool_literal ::= BOOL_LITERAL
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ADDRESS shift 36
|
||||
OID shift 33
|
||||
TIMEDIFF shift 30
|
||||
literal shift-reduce 15 eq ::= id EQ literal
|
||||
integer_literal shift-reduce 3 literal ::= integer_literal
|
||||
float_literal shift-reduce 5 literal ::= float_literal
|
||||
bool_literal shift-reduce 7 literal ::= bool_literal
|
||||
string_literal shift-reduce 9 literal ::= string_literal
|
||||
address_literal shift-reduce 40 literal ::= address_literal
|
||||
oid_literal shift-reduce 46 literal ::= oid_literal
|
||||
time_diff_literal shift-reduce 48 literal ::= time_diff_literal
|
||||
|
||||
State 13:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
id ::= * string_literal
|
||||
id ::= * ID
|
||||
oid_literal_content ::= * id
|
||||
oid_literal_content ::= * oid_literal_content DOT id
|
||||
oid_literal_content_or_empty ::= * oid_literal_content
|
||||
(44) oid_literal_content_or_empty ::= *
|
||||
oid_literal ::= OID LSB * oid_literal_content_or_empty RSB
|
||||
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ID shift-reduce 11 id ::= ID
|
||||
string_literal shift-reduce 10 id ::= string_literal
|
||||
id shift-reduce 41 oid_literal_content ::= id
|
||||
oid_literal_content shift 32
|
||||
oid_literal_content_or_empty shift 31
|
||||
{default} reduce 44 oid_literal_content_or_empty ::=
|
||||
|
||||
State 14:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
address_literal_content ::= * string_literal
|
||||
address_literal_content ::= * address_literal_content COMMA string_literal
|
||||
address_literal_content_or_empty ::= * address_literal_content
|
||||
(38) address_literal_content_or_empty ::= *
|
||||
address_literal ::= ADDRESS LSB * address_literal_content_or_empty RSB
|
||||
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
string_literal shift-reduce 35 address_literal_content ::= string_literal
|
||||
address_literal_content shift 35
|
||||
address_literal_content_or_empty shift 34
|
||||
{default} reduce 38 address_literal_content_or_empty ::=
|
||||
|
||||
State 15:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
id ::= * string_literal
|
||||
id ::= * ID
|
||||
oid_literal_content ::= oid_literal_content DOT * id
|
||||
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
ID shift-reduce 11 id ::= ID
|
||||
string_literal shift-reduce 10 id ::= string_literal
|
||||
id shift-reduce 42 oid_literal_content ::= oid_literal_content DOT id
|
||||
|
||||
State 16:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
time_diff_literal ::= TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal * integer_literal RSB
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
integer_literal shift 27
|
||||
|
||||
State 17:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
time_diff_literal ::= TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON * integer_literal integer_literal RSB
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
integer_literal shift 16
|
||||
|
||||
State 18:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
time_diff_literal ::= TIMEDIFF LSB integer_literal integer_literal COLON * integer_literal COLON integer_literal integer_literal RSB
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
integer_literal shift 28
|
||||
|
||||
State 19:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
time_diff_literal ::= TIMEDIFF LSB integer_literal * integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
integer_literal shift 29
|
||||
|
||||
State 20:
|
||||
integer_literal ::= * INTEGER_LITERAL
|
||||
time_diff_literal ::= TIMEDIFF LSB * integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
|
||||
INTEGER_LITERAL shift-reduce 2 integer_literal ::= INTEGER_LITERAL
|
||||
integer_literal shift 19
|
||||
|
||||
State 21:
|
||||
string_literal ::= * STRING_LITERAL
|
||||
address_literal_content ::= address_literal_content COMMA * string_literal
|
||||
|
||||
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
|
||||
string_literal shift-reduce 36 address_literal_content ::= address_literal_content COMMA string_literal
|
||||
|
||||
State 22:
|
||||
eq ::= id * EQ literal
|
||||
neq ::= id * NEQ literal
|
||||
gt ::= id * GT literal
|
||||
gte ::= id * GTE literal
|
||||
lt ::= id * LT literal
|
||||
lte ::= id * LTE literal
|
||||
like ::= id * LIKE literal
|
||||
nlike ::= id * NLIKE literal
|
||||
|
||||
EQ shift 12
|
||||
NEQ shift 11
|
||||
GT shift 10
|
||||
GTE shift 9
|
||||
LT shift 8
|
||||
LTE shift 7
|
||||
LIKE shift 6
|
||||
NLIKE shift 5
|
||||
|
||||
State 23:
|
||||
and ::= expr * AND expr
|
||||
or ::= expr * OR expr
|
||||
expr ::= LCB expr * RCB
|
||||
|
||||
OR shift 3
|
||||
AND shift 4
|
||||
RCB shift-reduce 34 expr ::= LCB expr RCB
|
||||
|
||||
State 24:
|
||||
(0) main ::= expr *
|
||||
and ::= expr * AND expr
|
||||
or ::= expr * OR expr
|
||||
|
||||
$ reduce 0 main ::= expr
|
||||
OR shift 3
|
||||
AND shift 4
|
||||
|
||||
State 25:
|
||||
(9) literal ::= string_literal *
|
||||
(10) id ::= string_literal *
|
||||
|
||||
$ reduce 9 literal ::= string_literal
|
||||
{default} reduce 10 id ::= string_literal
|
||||
|
||||
State 26:
|
||||
(1) main ::= literal *
|
||||
|
||||
$ reduce 1 main ::= literal
|
||||
|
||||
State 27:
|
||||
time_diff_literal ::= TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal * RSB
|
||||
|
||||
RSB shift-reduce 47 time_diff_literal ::= TIMEDIFF LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
|
||||
State 28:
|
||||
time_diff_literal ::= TIMEDIFF LSB integer_literal integer_literal COLON integer_literal * COLON integer_literal integer_literal RSB
|
||||
|
||||
COLON shift 17
|
||||
|
||||
State 29:
|
||||
time_diff_literal ::= TIMEDIFF LSB integer_literal integer_literal * COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
|
||||
COLON shift 18
|
||||
|
||||
State 30:
|
||||
time_diff_literal ::= TIMEDIFF * LSB integer_literal integer_literal COLON integer_literal COLON integer_literal integer_literal RSB
|
||||
|
||||
LSB shift 20
|
||||
|
||||
State 31:
|
||||
oid_literal ::= OID LSB oid_literal_content_or_empty * RSB
|
||||
|
||||
RSB shift-reduce 45 oid_literal ::= OID LSB oid_literal_content_or_empty RSB
|
||||
|
||||
State 32:
|
||||
oid_literal_content ::= oid_literal_content * DOT id
|
||||
(43) oid_literal_content_or_empty ::= oid_literal_content *
|
||||
|
||||
DOT shift 15
|
||||
{default} reduce 43 oid_literal_content_or_empty ::= oid_literal_content
|
||||
|
||||
State 33:
|
||||
oid_literal ::= OID * LSB oid_literal_content_or_empty RSB
|
||||
|
||||
LSB shift 13
|
||||
|
||||
State 34:
|
||||
address_literal ::= ADDRESS LSB address_literal_content_or_empty * RSB
|
||||
|
||||
RSB shift-reduce 39 address_literal ::= ADDRESS LSB address_literal_content_or_empty RSB
|
||||
|
||||
State 35:
|
||||
address_literal_content ::= address_literal_content * COMMA string_literal
|
||||
(37) address_literal_content_or_empty ::= address_literal_content *
|
||||
|
||||
COMMA shift 21
|
||||
{default} reduce 37 address_literal_content_or_empty ::= address_literal_content
|
||||
|
||||
State 36:
|
||||
address_literal ::= ADDRESS * LSB address_literal_content_or_empty RSB
|
||||
|
||||
LSB shift 14
|
||||
|
||||
State 37:
|
||||
and ::= expr * AND expr
|
||||
or ::= expr * OR expr
|
||||
(13) or ::= expr OR expr *
|
||||
|
||||
AND shift 4
|
||||
{default} reduce 13 or ::= expr OR expr
|
||||
|
||||
----------------------------------------------------
|
||||
Symbols:
|
||||
0: $:
|
||||
1: OR
|
||||
2: AND
|
||||
3: NOT
|
||||
4: INTEGER_LITERAL
|
||||
5: FLOAT_LITERAL
|
||||
6: BOOL_LITERAL
|
||||
7: STRING_LITERAL
|
||||
8: ID
|
||||
9: EQ
|
||||
10: NEQ
|
||||
11: GT
|
||||
12: GTE
|
||||
13: LT
|
||||
14: LTE
|
||||
15: LIKE
|
||||
16: NLIKE
|
||||
17: LCB
|
||||
18: RCB
|
||||
19: COMMA
|
||||
20: ADDRESS
|
||||
21: LSB
|
||||
22: RSB
|
||||
23: DOT
|
||||
24: OID
|
||||
25: TIMEDIFF
|
||||
26: COLON
|
||||
27: error:
|
||||
28: main: NOT INTEGER_LITERAL FLOAT_LITERAL BOOL_LITERAL STRING_LITERAL ID LCB ADDRESS OID TIMEDIFF
|
||||
29: expr: NOT STRING_LITERAL ID LCB
|
||||
30: literal: INTEGER_LITERAL FLOAT_LITERAL BOOL_LITERAL STRING_LITERAL ADDRESS OID TIMEDIFF
|
||||
31: integer_literal: INTEGER_LITERAL
|
||||
32: float_literal: FLOAT_LITERAL
|
||||
33: bool_literal: BOOL_LITERAL
|
||||
34: string_literal: STRING_LITERAL
|
||||
35: id: STRING_LITERAL ID
|
||||
36: and: NOT STRING_LITERAL ID LCB
|
||||
37: or: NOT STRING_LITERAL ID LCB
|
||||
38: not: NOT
|
||||
39: eq: STRING_LITERAL ID
|
||||
40: neq: STRING_LITERAL ID
|
||||
41: gt: STRING_LITERAL ID
|
||||
42: gte: STRING_LITERAL ID
|
||||
43: lt: STRING_LITERAL ID
|
||||
44: lte: STRING_LITERAL ID
|
||||
45: like: STRING_LITERAL ID
|
||||
46: nlike: STRING_LITERAL ID
|
||||
47: address_literal_content: STRING_LITERAL
|
||||
48: address_literal_content_or_empty: <lambda> STRING_LITERAL
|
||||
49: address_literal: ADDRESS
|
||||
50: oid_literal_content: STRING_LITERAL ID
|
||||
51: oid_literal_content_or_empty: <lambda> STRING_LITERAL ID
|
||||
52: oid_literal: OID
|
||||
53: time_diff_literal: TIMEDIFF
|
|
@ -11,7 +11,29 @@
|
|||
}
|
||||
|
||||
%code {
|
||||
&&REPLACER{process.js}&&
|
||||
&&REPLACER{parsers/filters/test_code_environment.js}&&
|
||||
|
||||
var _result = {};
|
||||
var LemonJS = function(_input) {
|
||||
_result = Object.create(null);
|
||||
var parser = new Parser();
|
||||
var lexer = new Lexer(_input);
|
||||
var token;
|
||||
var lexemes = [];
|
||||
while (token = lexer.next()) {
|
||||
if (token.error === 0) {
|
||||
console.log("PARSE", token.lexeme);
|
||||
parser.parse(parser["TOKEN_" + token.lexeme], token);
|
||||
lexemes.push(token);
|
||||
}
|
||||
}
|
||||
parser.parse();
|
||||
|
||||
return {
|
||||
tree: _result.root_node,
|
||||
lexemes: lexemes
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
%syntax_error {
|
||||
|
@ -447,3 +469,36 @@ literal(A) ::= time_diff_literal(B) . {
|
|||
A = B;
|
||||
}
|
||||
|
||||
time_literal(A) ::= TIME(KWD) LSB(B) integer_literal(DAY) SLASH integer_literal(MONTH) SLASH integer_literal(YEAR) integer_literal(HH) COLON integer_literal(MM) COLON integer_literal(SS) integer_literal(MS) RSB(C) . {
|
||||
A = new tokens.time_literal({
|
||||
keyword: new tokens.LEXEME({
|
||||
type: KWD.lexeme,
|
||||
value: KWD.value,
|
||||
start: KWD.start,
|
||||
end: KWD.end
|
||||
}),
|
||||
LSB: new tokens.LEXEME({
|
||||
type: B.lexeme,
|
||||
value: B.value,
|
||||
start: B.start,
|
||||
end: B.end
|
||||
}),
|
||||
RSB: new tokens.LEXEME({
|
||||
type: C.lexeme,
|
||||
value: C.value,
|
||||
start: C.start,
|
||||
end: C.end
|
||||
}),
|
||||
day: DAY,
|
||||
month: MONTH,
|
||||
year: YEAR,
|
||||
hours: HH,
|
||||
minutes: MM,
|
||||
seconds: SS,
|
||||
microseconds: MS,
|
||||
});
|
||||
}
|
||||
|
||||
literal(A) ::= time_literal(B) . {
|
||||
A = B;
|
||||
}
|
636
parsers/filters/real_code_environment.js
Normal file
636
parsers/filters/real_code_environment.js
Normal file
|
@ -0,0 +1,636 @@
|
|||
/**
|
||||
* Created by Aleksey Chichenkov <a.chichenkov@initi.ru> on 1/28/19.
|
||||
*/
|
||||
|
||||
var fs = require("fs");
|
||||
var Lexer = require('./lexer.js');
|
||||
|
||||
var std = (function () {
|
||||
var protos = "__protos__";
|
||||
var keys = "__keys__";
|
||||
|
||||
|
||||
/**
|
||||
* Return unique data
|
||||
*
|
||||
* @param {Object[]} _arr - prototypes of inheritance classes
|
||||
* @param {Object} _main - prototype of resulting class
|
||||
*
|
||||
* @return {Object}
|
||||
* */
|
||||
var unique = function (_arr, _main) {
|
||||
var result = Object.create(null);
|
||||
var to_remove = [];
|
||||
|
||||
for (var i = 0, e = _arr.length; i != e; ++i) {
|
||||
var item = _arr[i];
|
||||
|
||||
for (var key in item) {
|
||||
if (key in result) {
|
||||
to_remove.push(key);
|
||||
continue;
|
||||
}
|
||||
|
||||
result[key] = item[key];
|
||||
}
|
||||
|
||||
if (keys in item) {
|
||||
for (var ii = 0, ee = item[keys].length; ii != ee; ++ii) {
|
||||
var key = item[keys][ii];
|
||||
if (key in result) {
|
||||
to_remove.push(key);
|
||||
continue;
|
||||
}
|
||||
|
||||
result[key] = item[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i != to_remove.length; ++i) {
|
||||
delete result[to_remove[i]];
|
||||
}
|
||||
|
||||
for (var key in _main) {
|
||||
result[key] = _main[key];
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create OOP class
|
||||
*
|
||||
* @param {Function[]} _constrs - inheritance classes
|
||||
* @param {Object} _proto - prototype of resulting class
|
||||
* @param {Object?} _static - static data
|
||||
*
|
||||
* @return {Function}
|
||||
* */
|
||||
var class_creator = function (_constrs, _proto, _static) {
|
||||
_constrs = _constrs || [];
|
||||
_proto = _proto || [];
|
||||
_static = _static || [];
|
||||
|
||||
var constr;
|
||||
if (_proto && _proto.hasOwnProperty("constructor")) {
|
||||
constr = _proto.constructor;
|
||||
delete _proto.constructor;
|
||||
} else {
|
||||
constr = function () {
|
||||
for (var i = 0; i != _constrs.length; ++i) {
|
||||
_constrs[i].apply(this, arguments);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
var proto = Object.create(null);
|
||||
Object.defineProperty(proto, protos, {
|
||||
"value": []
|
||||
});
|
||||
Object.defineProperty(proto, keys, {
|
||||
"value": []
|
||||
});
|
||||
|
||||
/************************FOR MEMBERS*******************************/
|
||||
for (var i = 0, e = _constrs.length; i != e; ++i) {
|
||||
proto[protos].push(_constrs[i].prototype);
|
||||
}
|
||||
|
||||
var m_un = unique(proto[protos], _proto);
|
||||
for (var key in m_un) {
|
||||
proto[keys].push(key);
|
||||
|
||||
Object.defineProperty(proto, key, {
|
||||
"value": m_un[key]
|
||||
});
|
||||
}
|
||||
/************************FOR MEMBERS END***************************/
|
||||
|
||||
/************************FOR STATICS*******************************/
|
||||
var s_un = unique(_constrs, _static);
|
||||
for (var key in s_un) {
|
||||
Object.defineProperty(constr, key, {
|
||||
"value": s_un[key],
|
||||
"enumerable": true
|
||||
});
|
||||
}
|
||||
/************************FOR STATICS END***************************/
|
||||
|
||||
|
||||
Object.defineProperties(constr, {
|
||||
"pr": {
|
||||
"value": proto
|
||||
},
|
||||
"prototype": {
|
||||
"value": proto
|
||||
}
|
||||
});
|
||||
|
||||
Object.freeze(proto);
|
||||
Object.freeze(constr);
|
||||
|
||||
return constr;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if target has prototype
|
||||
*
|
||||
* @param {Object} _target - checkable instance
|
||||
* @param {Object} _proto - posible prototype
|
||||
*
|
||||
* */
|
||||
var check = function (_target, _proto) {
|
||||
for (var i = 0; i != _target[protos].length; ++i) {
|
||||
var t_proto = _target[protos][i];
|
||||
if (t_proto == _proto) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (t_proto[protos]) {
|
||||
if (check(t_proto, _proto))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if target is instance of class
|
||||
*
|
||||
* @param {Object} _target - checkable instance
|
||||
* @param {Function} _constr - posible constructor
|
||||
*
|
||||
* */
|
||||
var class_check = function (_target, _constr) {
|
||||
if (_target instanceof _constr) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return check(_target, _constr.prototype);
|
||||
};
|
||||
|
||||
return {
|
||||
class: class_creator,
|
||||
class_check: class_check
|
||||
};
|
||||
})();
|
||||
|
||||
var tools = {
|
||||
merge: function (_obj) {
|
||||
var target = Object.create(null);
|
||||
var i = 0, e = arguments.length;
|
||||
for (; i != e; ++i) {
|
||||
var options = arguments[i];
|
||||
|
||||
for (var key in options) {
|
||||
if (options[key] === undefined && target === options[key])
|
||||
continue;
|
||||
|
||||
target[key] = options[key];
|
||||
}
|
||||
}
|
||||
|
||||
return target;
|
||||
}
|
||||
};
|
||||
|
||||
var tokens = (function () {
|
||||
var Node = std.class([], {
|
||||
constructor: function Node(_options) {
|
||||
var base = tools.merge({
|
||||
children: []
|
||||
}, _options);
|
||||
|
||||
this.children = base.children;
|
||||
},
|
||||
add: function (_n) {
|
||||
this.children.push(_n);
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
var Lexeme = std.class([Node], {
|
||||
constructor: function Lexeme(_options) {
|
||||
var base = tools.merge({
|
||||
start: -1,
|
||||
end: -1,
|
||||
type: null,
|
||||
value: null
|
||||
}, _options);
|
||||
|
||||
Node.call(this, base);
|
||||
|
||||
this.start = base.start;
|
||||
this.end = base.end;
|
||||
this.type = base.type;
|
||||
this.value = base.value;
|
||||
}
|
||||
});
|
||||
|
||||
var Rule = std.class([Node], {
|
||||
constructor: function NonTerminal(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
Node.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var terminal_literal = std.class([Rule], {
|
||||
constructor: function terminal_literal(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
},
|
||||
position: function () {
|
||||
var first_child = this.children[0];
|
||||
|
||||
return {
|
||||
start: first_child.start,
|
||||
end: first_child.end,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var string_literal = std.class([terminal_literal], {
|
||||
constructor: function string_literal(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
terminal_literal.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var integer_literal = std.class([terminal_literal], {
|
||||
constructor: function integer_literal(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
terminal_literal.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var float_literal = std.class([terminal_literal], {
|
||||
constructor: function float_literal(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
terminal_literal.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var bool_literal = std.class([terminal_literal], {
|
||||
constructor: function bool_literal(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
terminal_literal.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var id = std.class([Rule], {
|
||||
constructor: function id(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
},
|
||||
position: function () {
|
||||
var first_child = this.children[0];
|
||||
|
||||
if(std.class_check(first_child, Lexeme)){
|
||||
return {
|
||||
start: first_child.start,
|
||||
end: first_child.end,
|
||||
}
|
||||
} else {
|
||||
return this.position();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var expr_compares = std.class([Rule], {
|
||||
constructor: function expr_compares(_options) {
|
||||
var base = tools.merge({
|
||||
lexpr: null,
|
||||
op: null,
|
||||
rexpr: null
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.lexpr = base.lexpr;
|
||||
this.op = base.op;
|
||||
this.rexpr = base.rexpr;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.lexpr.position().start,
|
||||
end: this.rexpr.position().end,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var and = std.class([Rule], {
|
||||
constructor: function and(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
expr_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var or = std.class([Rule], {
|
||||
constructor: function or(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
expr_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var not = std.class([Rule], {
|
||||
constructor: function not(_options) {
|
||||
var base = tools.merge({
|
||||
op: null,
|
||||
rexpr: null
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.op = base.op;
|
||||
this.rexpr = base.rexpr;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.op.start,
|
||||
end: this.rexpr.position().end,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var endpoint_compares = std.class([Rule], {
|
||||
constructor: function endpoint_compares(_options) {
|
||||
var base = tools.merge({
|
||||
id: null,
|
||||
op: null,
|
||||
literal: null
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.id = base.id;
|
||||
this.op = base.op;
|
||||
this.literal = base.literal;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.id.start,
|
||||
end: this.literal.end
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var eq = std.class([endpoint_compares], {
|
||||
constructor: function eq(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
},
|
||||
});
|
||||
|
||||
var neq = std.class([endpoint_compares], {
|
||||
constructor: function neq(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
},
|
||||
});
|
||||
|
||||
var gt = std.class([endpoint_compares], {
|
||||
constructor: function gt(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var gte = std.class([endpoint_compares], {
|
||||
constructor: function gte(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var lt = std.class([endpoint_compares], {
|
||||
constructor: function lt(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var lte = std.class([endpoint_compares], {
|
||||
constructor: function lte(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var like = std.class([endpoint_compares], {
|
||||
constructor: function like(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var nlike = std.class([endpoint_compares], {
|
||||
constructor: function nlike(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
endpoint_compares.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var sub_expr = std.class([Rule], {
|
||||
constructor: function expr(_options) {
|
||||
var base = tools.merge({
|
||||
LCB: null,
|
||||
expr: null,
|
||||
RCB: null,
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.LCB = base.LCB;
|
||||
this.expr = base.expr;
|
||||
this.RCB = base.RCB;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.LCB.start,
|
||||
end: this.RCB.end
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var address_literal_content = std.class([Rule], {
|
||||
constructor: function address_literal_content(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var address_literal = std.class([Rule], {
|
||||
constructor: function address_literal(_options) {
|
||||
var base = tools.merge({
|
||||
keyword: null,
|
||||
LSB: null,
|
||||
RSB: null,
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.keyword = base.keyword;
|
||||
this.LSB = base.LSB;
|
||||
this.RSB = base.RSB;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.keyword.start,
|
||||
end: this.RSB.end
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var oid_literal_content = std.class([Rule], {
|
||||
constructor: function oid_literal_content(_options) {
|
||||
var base = tools.merge({}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
}
|
||||
});
|
||||
|
||||
var oid_literal = std.class([Rule], {
|
||||
constructor: function oid_literal(_options) {
|
||||
var base = tools.merge({
|
||||
keyword: null,
|
||||
LSB: null,
|
||||
RSB: null,
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.keyword = base.keyword;
|
||||
this.LSB = base.LSB;
|
||||
this.RSB = base.RSB;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.keyword.start,
|
||||
end: this.RSB.end
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var time_diff_literal = std.class([Rule], {
|
||||
constructor: function time_diff_literal(_options) {
|
||||
var base = tools.merge({
|
||||
keyword: null,
|
||||
LSB: null,
|
||||
RSB: null,
|
||||
days: -1,
|
||||
hours: -1,
|
||||
minutes: -1,
|
||||
seconds: -1,
|
||||
microseconds: -1
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.keyword = base.keyword;
|
||||
this.LSB = base.LSB;
|
||||
this.RSB = base.RSB;
|
||||
this.days = base.days;
|
||||
this.hours = base.hours;
|
||||
this.minutes = base.minutes;
|
||||
this.seconds = base.seconds;
|
||||
this.microseconds = base.microseconds;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.keyword.start,
|
||||
end: this.RSB.end
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var time_literal = std.class([Rule], {
|
||||
constructor: function time_literal(_options) {
|
||||
var base = tools.merge({
|
||||
keyword: null,
|
||||
LSB: null,
|
||||
RSB: null,
|
||||
day: -1,
|
||||
month: -1,
|
||||
year: -1,
|
||||
hours: -1,
|
||||
minutes: -1,
|
||||
seconds: -1,
|
||||
microseconds: -1
|
||||
}, _options);
|
||||
|
||||
Rule.call(this, base);
|
||||
|
||||
this.keyword = base.keyword;
|
||||
this.LSB = base.LSB;
|
||||
this.RSB = base.RSB;
|
||||
this.day = base.day;
|
||||
this.month = base.month;
|
||||
this.year = base.year;
|
||||
this.hours = base.hours;
|
||||
this.minutes = base.minutes;
|
||||
this.seconds = base.seconds;
|
||||
this.microseconds = base.microseconds;
|
||||
},
|
||||
position: function () {
|
||||
return {
|
||||
start: this.keyword.start,
|
||||
end: this.RSB.end
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
// terminal
|
||||
LEXEME: Lexeme,
|
||||
|
||||
// not terminal
|
||||
id: id,
|
||||
string_literal: string_literal,
|
||||
integer_literal: integer_literal,
|
||||
float_literal: float_literal,
|
||||
bool_literal: bool_literal,
|
||||
address_literal: address_literal,
|
||||
oid_literal: oid_literal,
|
||||
time_diff_literal: time_diff_literal,
|
||||
time_literal: time_literal,
|
||||
|
||||
or: or,
|
||||
and: and,
|
||||
not: not,
|
||||
|
||||
eq: eq,
|
||||
neq: neq,
|
||||
gt: gt,
|
||||
gte: gte,
|
||||
lt: lt,
|
||||
lte: lte,
|
||||
like: like,
|
||||
nlike: nlike,
|
||||
|
||||
// expr: expr,
|
||||
sub_expr: sub_expr,
|
||||
address_literal_content: address_literal_content,
|
||||
oid_literal_content: oid_literal_content,
|
||||
}
|
||||
|
||||
})();
|
0
parsers/filters/test_code_environment.js
Normal file
0
parsers/filters/test_code_environment.js
Normal file
Loading…
Add table
Add a link
Reference in a new issue