address, float, integer, string, bool, or, not, oid, timediff

This commit is contained in:
Aleksey Chichenkov 2019-01-28 18:37:37 +03:00
parent 8ee01f03e1
commit ee37f260a3
7 changed files with 3510 additions and 1206 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,129 +1,730 @@
State 0:
main ::= * expr
string ::= * STRING_LITERAL
id ::= * string
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
eq ::= * id EQ literal
and ::= * expr AND expr
expr ::= * eq
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
STRING_LITERAL shift-reduce 3 string ::= STRING_LITERAL
ID shift-reduce 5 id ::= ID
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 6
string shift-reduce 4 id ::= string
id shift 11
eq shift-reduce 8 expr ::= eq
and shift-reduce 9 expr ::= and
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 ::= * STRING_LITERAL
id ::= * string
string_literal ::= * STRING_LITERAL
id ::= * string_literal
id ::= * ID
eq ::= * id EQ literal
and ::= * expr AND expr
expr ::= * eq
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
STRING_LITERAL shift-reduce 3 string ::= STRING_LITERAL
ID shift-reduce 5 id ::= ID
NOT shift 2
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
ID shift-reduce 11 id ::= ID
LCB shift 1
expr shift 5
string shift-reduce 4 id ::= string
id shift 11
eq shift-reduce 8 expr ::= eq
and shift-reduce 9 expr ::= and
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 ::= * STRING_LITERAL
id ::= * string
string_literal ::= * STRING_LITERAL
id ::= * string_literal
id ::= * ID
eq ::= * id EQ literal
and ::= * expr AND expr
and ::= expr AND * expr
expr ::= * eq
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
STRING_LITERAL shift-reduce 3 string ::= STRING_LITERAL
ID shift-reduce 5 id ::= ID
NOT shift 2
STRING_LITERAL shift-reduce 8 string_literal ::= STRING_LITERAL
ID shift-reduce 11 id ::= ID
LCB shift 1
expr shift-reduce 7 and ::= expr AND expr
string shift-reduce 4 id ::= string
id shift 11
eq shift-reduce 8 expr ::= eq
and shift-reduce 9 expr ::= and
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:
integer ::= * INTEGER_LITERAL
literal ::= * integer
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 1 integer ::= INTEGER_LITERAL
ADDRESS shift 10
integer shift-reduce 2 literal ::= integer
literal shift-reduce 6 eq ::= id EQ literal
address_literal shift-reduce 16 literal ::= address_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 4:
address_literal_content ::= * STRING_LITERAL
address_literal_content ::= * address_literal_content COMMA STRING_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
(14) address_literal_content_or_empty ::= *
(38) address_literal_content_or_empty ::= *
address_literal ::= ADDRESS LSB * address_literal_content_or_empty RSB
STRING_LITERAL shift-reduce 11 address_literal_content ::= STRING_LITERAL
address_literal_content shift 9
address_literal_content_or_empty shift 7
{default} reduce 14 address_literal_content_or_empty ::=
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 5:
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
AND shift 2
RCB shift-reduce 10 expr ::= LCB expr RCB
OR shift 3
AND shift 4
RCB shift-reduce 34 expr ::= LCB expr RCB
State 6:
State 24:
(0) main ::= expr *
and ::= expr * AND expr
or ::= expr * OR expr
$ reduce 0 main ::= expr
AND shift 2
OR shift 3
AND shift 4
State 7:
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 15 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 8:
address_literal_content ::= address_literal_content COMMA * STRING_LITERAL
State 35:
address_literal_content ::= address_literal_content * COMMA string_literal
(37) address_literal_content_or_empty ::= address_literal_content *
STRING_LITERAL shift-reduce 12 address_literal_content ::= address_literal_content COMMA STRING_LITERAL
COMMA shift 21
{default} reduce 37 address_literal_content_or_empty ::= address_literal_content
State 9:
address_literal_content ::= address_literal_content * COMMA STRING_LITERAL
(13) address_literal_content_or_empty ::= address_literal_content *
COMMA shift 8
{default} reduce 13 address_literal_content_or_empty ::= address_literal_content
State 10:
State 36:
address_literal ::= ADDRESS * LSB address_literal_content_or_empty RSB
LSB shift 4
LSB shift 14
State 11:
eq ::= id * EQ literal
State 37:
and ::= expr * AND expr
or ::= expr * OR expr
(13) or ::= expr OR expr *
EQ shift 3
AND shift 4
{default} reduce 13 or ::= expr OR expr
----------------------------------------------------
Symbols:
@ -132,24 +733,52 @@ Symbols:
2: AND
3: NOT
4: INTEGER_LITERAL
5: STRING_LITERAL
6: ID
7: EQ
8: LCB
9: RCB
10: COMMA
11: ADDRESS
12: LSB
13: RSB
14: error:
15: main: STRING_LITERAL ID LCB
16: expr: STRING_LITERAL ID LCB
17: integer: INTEGER_LITERAL
18: literal: INTEGER_LITERAL ADDRESS
19: string: STRING_LITERAL
20: id: STRING_LITERAL ID
21: eq: STRING_LITERAL ID
22: and: STRING_LITERAL ID LCB
23: address_literal_content: STRING_LITERAL
24: address_literal_content_or_empty: <lambda> STRING_LITERAL
25: address_literal: ADDRESS
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

View File

@ -22,94 +22,16 @@ main ::= expr(A) . {
_result.root_node = A
}
integer(A) ::= INTEGER_LITERAL(B) . {
A = new Node({
type: "INTEGER_LITERAL",
lexeme: B.lexeme,
start: B.start,
end: B.end
})
main ::= literal(A) . {
_result.root_node = A
}
literal(A) ::= integer(B) . {
A = new Node({
type: "literal",
children: [B]
})
}
string(A) ::= STRING_LITERAL(B) . {
A = new Node({
type: "STRING_LITERAL",
lexeme: B.lexeme,
start: B.start,
end: B.end
})
}
id(A) ::= string(B) . {
A = new Node({
type: "id",
children: [B]
});
}
id(A) ::= ID(B) . {
A = new Node({
type: "ID",
lexeme: B.lexeme,
start: B.start,
end: B.end
})
}
eq(A) ::= id(B) EQ(C) literal(D) . {
A = new Node({
type: "eq",
integer_literal(A) ::= INTEGER_LITERAL(B) . {
A = new tokens.integer_literal({
children: [
B,
new Node({
type: "EQ",
lexeme: C.lexeme,
start: C.start,
end: C.end
}),
D
]
})
}
and(A) ::= expr(B) AND expr(D) . {
A = new Node({
type: "and",
children: [
B,
D
]
})
}
expr(A) ::= eq(B) . {
A = new Node({
type: "expr",
children: [B]
})
}
expr(A) ::= and(B) . {
A = B;
}
expr(A) ::= LCB expr(C) RCB . {
A = C;
}
address_literal_content(A) ::= STRING_LITERAL(B) . {
A = new Node({
children: [
new Node({
type: "STRING_LITERAL",
lexeme: B.lexeme,
new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
})
@ -117,13 +39,292 @@ address_literal_content(A) ::= STRING_LITERAL(B) . {
});
}
address_literal_content(A) ::= address_literal_content(B) COMMA STRING_LITERAL(C) . {
B.add(new Node({
type: "STRING_LITERAL",
lexeme: C.lexeme,
start: C.start,
end: C.end
}));
literal(A) ::= integer_literal(B) . {
A = B;
}
float_literal(A) ::= FLOAT_LITERAL(B) . {
A = new tokens.float_literal({
children: [
new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
})
]
})
}
literal(A) ::= float_literal(B) . {
A = B;
}
bool_literal(A) ::= BOOL_LITERAL(B) . {
A = new tokens.bool_literal({
children: [
new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
})
]
})
}
literal(A) ::= bool_literal(B) . {
A = B;
}
string_literal(A) ::= STRING_LITERAL(B) . {
A = new tokens.string_literal({
children: [
new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
})
]
});
}
literal(A) ::= string_literal(B) . {
A = B;
}
id(A) ::= string_literal(B) . {
A = new tokens.id({
children: [B]
});
}
id(A) ::= ID(B) . {
A = new tokens.id({
children: [
new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
})
]
});
}
and(A) ::= expr(B) AND(C) expr(D) . {
A = new tokens.and({
lexpr: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
rexpr: D
})
}
or(A) ::= expr(B) OR(C) expr(D) . {
A = new tokens.or({
lexpr: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
rexpr: D
})
}
not(A) ::= NOT(C) expr(D) . {
A = new tokens.not({
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
rexpr: D
})
}
eq(A) ::= id(B) EQ(C) literal(D) . {
A = new tokens.eq({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
neq(A) ::= id(B) NEQ(C) literal(D) . {
A = new tokens.neq({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
gt(A) ::= id(B) GT(C) literal(D) . {
A = new tokens.gt({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
gte(A) ::= id(B) GTE(C) literal(D) . {
A = new tokens.gte({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
lt(A) ::= id(B) LT(C) literal(D) . {
A = new tokens.lt({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
lte(A) ::= id(B) LTE(C) literal(D) . {
A = new tokens.lte({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
like(A) ::= id(B) LIKE(C) literal(D) . {
A = new tokens.like({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
nlike(A) ::= id(B) NLIKE(C) literal(D) . {
A = new tokens.nlike({
id: B,
op: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
literal: D
});
}
expr(A) ::= and(B) . {
A = B;
}
expr(A) ::= or(B) . {
A = B;
}
expr(A) ::= not(B) . {
A = B;
}
expr(A) ::= eq(B) . {
A = B;
}
expr(A) ::= neq(B) . {
A = B;
}
expr(A) ::= gt(B) . {
A = B;
}
expr(A) ::= gte(B) . {
A = B;
}
expr(A) ::= lt(B) . {
A = B;
}
expr(A) ::= lte(B) . {
A = B;
}
expr(A) ::= like(B) . {
A = B;
}
expr(A) ::= nlike(B) . {
A = B;
}
expr(A) ::= LCB(B) expr(C) RCB(D) . {
A = new tokens.sub_expr({
LCB: new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
}),
expr: C,
RCB: new tokens.LEXEME({
type: D.lexeme,
value: D.value,
start: D.start,
end: D.end
})
});
}
address_literal_content(A) ::= string_literal(B) . {
A = new tokens.address_literal_content({
children: [B]
});
}
address_literal_content(A) ::= address_literal_content(B) COMMA string_literal(C) . {
B.add(C);
A = B;
}
@ -132,21 +333,117 @@ address_literal_content_or_empty(A) ::= address_literal_content(B) . {
}
address_literal_content_or_empty(A) ::= . {
A = new Node({
type: "address_literal_content"
A = new tokens.address_literal_content({
children: []
});
}
address_literal(A) ::= ADDRESS LSB address_literal_content_or_empty(C) RSB . {
A = new Node({
type: "address_literal",
children: C.children
address_literal(A) ::= ADDRESS(B) LSB(C) address_literal_content_or_empty(D) RSB(E) . {
A = new tokens.address_literal({
children: D.children,
keyword: new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
}),
LSB: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
RSB: new tokens.LEXEME({
type: E.lexeme,
value: E.value,
start: E.start,
end: E.end
})
});
}
literal(A) ::= address_literal(B) . {
A = new Node({
type: "literal",
A = B;
}
oid_literal_content(A) ::= id(B) . {
A = new tokens.oid_literal_content({
children: [B]
});
}
oid_literal_content(A) ::= oid_literal_content(B) DOT id(C) . {
B.add(C);
A = B;
}
oid_literal_content_or_empty(A) ::= oid_literal_content(B) . {
A = B;
}
oid_literal_content_or_empty(A) ::= . {
A = new tokens.oid_literal_content({
children: []
});
}
oid_literal(A) ::= OID(B) LSB(C) oid_literal_content_or_empty(D) RSB(E) . {
A = new tokens.oid_literal({
children: D.children,
keyword: new tokens.LEXEME({
type: B.lexeme,
value: B.value,
start: B.start,
end: B.end
}),
LSB: new tokens.LEXEME({
type: C.lexeme,
value: C.value,
start: C.start,
end: C.end
}),
RSB: new tokens.LEXEME({
type: E.lexeme,
value: E.value,
start: E.start,
end: E.end
})
});
}
literal(A) ::= oid_literal(B) . {
A = B;
}
time_diff_literal(A) ::= TIMEDIFF(KWD) LSB(B) integer_literal(DAYS) integer_literal(HH) COLON integer_literal(MM) COLON integer_literal(SS) integer_literal(MS) RSB(C) . {
A = new tokens.time_diff_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
}),
days: DAYS,
hours: HH,
minutes: MM,
seconds: SS,
microseconds: MS,
});
}
literal(A) ::= time_diff_literal(B) . {
A = B;
}

View File

@ -178,6 +178,7 @@ var tokens = (function () {
class_check: class_check
};
})();
var tools = {
merge: function (_obj) {
var target = Object.create(null);
@ -237,20 +238,51 @@ var tokens = (function () {
}
});
var string_literal = std.class([Rule], {
constructor: function string_literal(_options) {
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);
var integer_literal = std.class([Rule], {
terminal_literal.call(this, base);
}
});
var integer_literal = std.class([terminal_literal], {
constructor: function integer_literal(_options) {
var base = tools.merge({}, _options);
Rule.call(this, base);
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);
}
});
@ -259,87 +291,312 @@ var tokens = (function () {
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 literal = std.class([Rule], {
constructor: function literal(_options) {
var base = tools.merge({}, _options);
Rule.call(this, base);
}
});
var eq = std.class([Rule], {
constructor: function eq(_options) {
var base = tools.merge({
id: null,
EQ: null,
literal: null
}, _options);
Rule.call(this, base);
this.id = base.id;
this.EQ = base.EQ;
this.literal = base.literal;
},
set_id: function (_n) {
this._id = _n;
},
set_EQ: function (_n) {
this._EQ = _n;
},
set_literal: function (_n) {
this._literal = _n;
}
});
var and = std.class([Rule], {
constructor: function and(_options) {
var expr_compares = std.class([Rule], {
constructor: function expr_compares(_options) {
var base = tools.merge({
lexpr: null,
AND: null,
op: null,
rexpr: null
}, _options);
Rule.call(this, base);
this.lexpr = base.lexpr;
this.AND = base.AND;
this.op = base.op;
this.rexpr = base.rexpr;
},
set_lexpr: function (_n) {
this._lexpr = _n;
},
set_AND: function (_n) {
this._AND = _n;
},
set_rexpr: function (_n) {
this._rexpr = _n;
position: function () {
return {
start: this.lexpr.position().start,
end: this.rexpr.position().end,
}
}
});
var expr = std.class([Rule], {
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.ADDRESS.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
}
}
});
return {
// terminal
LEXEME: Lexeme,
// non terminal
// not terminal
id: id,
string_literal: string_literal,
integer_literal: integer_literal,
id: id,
literal: literal,
eq: eq,
float_literal: float_literal,
bool_literal: bool_literal,
address_literal: address_literal,
oid_literal: oid_literal,
time_diff_literal: time_diff_literal,
or: or,
and: and,
expr: expr,
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,
}
})();
@ -349,22 +606,48 @@ var tokens = (function () {
var _result = {};
var LemonJS = function (_input) {
_result = Object.create(null);
var parser = new Parser();
var lexer = new Lexer(_input);
var token;
while (token = lexer.next()) {
console.log("PARSE", token.lexeme);
parser.parse(parser["TOKEN_" + token.lexeme], token);
if(token.error === 0) {
console.log("PARSE", token.lexeme);
parser.parse(parser["TOKEN_" + token.lexeme], token);
}
}
parser.parse();
return _result;
};
fs.mkdirSync("tests");
if(!fs.existsSync("tests")) {
fs.mkdirSync("tests");
}
var test_and = LemonJS("abc == 1 and abc1 == 2 and (bbc == 5)");
fs.writeFileSync("tests/out_test_and.json", JSON.stringify(test_and, true, 3));
fs.writeFileSync("tests/test_and.json", JSON.stringify(test_and, true, 3));
var test_address = LemonJS('abc == Address ["a", "b", "c"]');
fs.writeFileSync("tests/out_tree_address.json", JSON.stringify(test_address, true, 3));
fs.writeFileSync("tests/test_address.json", JSON.stringify(test_address, true, 3));
var test_float = LemonJS('abc == 23.2');
fs.writeFileSync("tests/test_float.json", JSON.stringify(test_float, true, 3));
var test_string = LemonJS('abc == "sadfasdf"');
fs.writeFileSync("tests/test_string.json", JSON.stringify(test_string, true, 3));
var test_bool = LemonJS('abc == true or cab == false');
fs.writeFileSync("tests/test_bool.json", JSON.stringify(test_bool, true, 3));
var test_not = LemonJS('not cab == false');
fs.writeFileSync("tests/test_not.json", JSON.stringify(test_not, true, 3));
var test_oid = LemonJS('abc == Oid [a.b.d]');
fs.writeFileSync("tests/test_oid.json", JSON.stringify(test_oid, true, 3));
var test_timediff = LemonJS('add == TimeDiff [17924 15:01:24 441000]');
fs.writeFileSync("tests/test_timediff.json", JSON.stringify(test_timediff, true, 3));
var test_timediff_single = LemonJS('TimeDiff [17924 15:01:24 441000]');
fs.writeFileSync("tests/test_timediff_single.json", JSON.stringify(test_timediff_single, true, 3));

View File

@ -1,153 +0,0 @@
{
"root_node": {
"type": "and",
"children": [
{
"type": "and",
"children": [
{
"type": "expr",
"children": [
{
"type": "eq",
"children": [
{
"type": "ID",
"children": [],
"lexeme": "ID",
"start": 0,
"end": 3
},
{
"type": "EQ",
"children": [],
"lexeme": "EQ",
"start": 4,
"end": 6
},
{
"type": "literal",
"children": [
{
"type": "INTEGER_LITERAL",
"children": [],
"lexeme": "INTEGER_LITERAL",
"start": 7,
"end": 8
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
},
{
"type": "expr",
"children": [
{
"type": "eq",
"children": [
{
"type": "ID",
"children": [],
"lexeme": "ID",
"start": 13,
"end": 17
},
{
"type": "EQ",
"children": [],
"lexeme": "EQ",
"start": 18,
"end": 20
},
{
"type": "literal",
"children": [
{
"type": "INTEGER_LITERAL",
"children": [],
"lexeme": "INTEGER_LITERAL",
"start": 21,
"end": 22
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
},
{
"type": "expr",
"children": [
{
"type": "eq",
"children": [
{
"type": "ID",
"children": [],
"lexeme": "ID",
"start": 28,
"end": 31
},
{
"type": "EQ",
"children": [],
"lexeme": "EQ",
"start": 32,
"end": 34
},
{
"type": "literal",
"children": [
{
"type": "INTEGER_LITERAL",
"children": [],
"lexeme": "INTEGER_LITERAL",
"start": 35,
"end": 36
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
}

View File

@ -1,69 +0,0 @@
{
"root_node": {
"type": "expr",
"children": [
{
"type": "eq",
"children": [
{
"type": "ID",
"children": [],
"lexeme": "ID",
"start": 0,
"end": 3
},
{
"type": "EQ",
"children": [],
"lexeme": "EQ",
"start": 4,
"end": 6
},
{
"type": "literal",
"children": [
{
"type": "address_literal",
"children": [
{
"type": "STRING_LITERAL",
"children": [],
"lexeme": "STRING_LITERAL",
"start": 16,
"end": 19
},
{
"type": "STRING_LITERAL",
"children": [],
"lexeme": "STRING_LITERAL",
"start": 21,
"end": 24
},
{
"type": "STRING_LITERAL",
"children": [],
"lexeme": "STRING_LITERAL",
"start": 26,
"end": 29
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
],
"lexeme": null,
"start": 0,
"end": 0
}
}