-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathparsetab.py
62 lines (55 loc) · 7.28 KB
/
parsetab.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# parsetab.py
# This file is automatically generated. Do not edit.
# pylint: disable=W,C,R
_tabversion = '3.10'
_lr_method = 'LALR'
_lr_signature = 'CASE COLON COM CONTENT DEFAULT DO ELSE FOR GOTO IF LBRACE LCOM LP RBRACE RCOM RP SEMI SPACE SWITCH WHILEstmts : stmt\n | stmt stmtsstmt :\n | expr\n | ifstmt\n | whilestmt\n | forstmt\n | switch_stmtswitch_stmt : SWITCH LP bool_expr RP LBRACE case_stmt RBRACE stmtcase_stmt : CASE bool_expr COLON stmts\n | DEFAULT COLON stmts\n | CASE bool_expr COLON stmts case_stmtifstmt : IF LP bool_expr RP LBRACE stmts RBRACE elifs stmt\n | IF LP bool_expr RP LBRACE stmts RBRACE stmtelifs : else\n | elif\n | elif elifs elif : ELSE IF LP bool_expr RP LBRACE stmts RBRACEelse : ELSE LBRACE stmts RBRACEwhilestmt : WHILE LP bool_expr RP LBRACE stmts RBRACE stmtforstmt : FOR LP for_expr RP LBRACE stmts RBRACE stmtfor_expr : contents SEMI contents SEMI contentsbool_expr : contentsexpr : contents SEMI\n | func_expr SEMIfunc_expr : contents LP params RPparam : contents\n | func_expr params : param\n | param params contents : CONTENT \n | CONTENT contents'
_lr_action_items = {'IF':([0,2,3,4,5,6,7,16,18,41,42,43,53,54,55,57,59,60,61,62,63,64,65,66,67,68,70,71,72,78,81,83,],[10,10,-4,-5,-6,-7,-8,-24,-25,10,10,10,10,10,10,10,10,10,-14,-15,-16,73,-20,-21,-9,10,-13,-17,10,-19,10,-18,]),'WHILE':([0,2,3,4,5,6,7,16,18,41,42,43,53,54,55,57,59,60,61,62,63,65,66,67,68,70,71,72,78,81,83,],[11,11,-4,-5,-6,-7,-8,-24,-25,11,11,11,11,11,11,11,11,11,-14,-15,-16,-20,-21,-9,11,-13,-17,11,-19,11,-18,]),'FOR':([0,2,3,4,5,6,7,16,18,41,42,43,53,54,55,57,59,60,61,62,63,65,66,67,68,70,71,72,78,81,83,],[12,12,-4,-5,-6,-7,-8,-24,-25,12,12,12,12,12,12,12,12,12,-14,-15,-16,-20,-21,-9,12,-13,-17,12,-19,12,-18,]),'SWITCH':([0,2,3,4,5,6,7,16,18,41,42,43,53,54,55,57,59,60,61,62,63,65,66,67,68,70,71,72,78,81,83,],[13,13,-4,-5,-6,-7,-8,-24,-25,13,13,13,13,13,13,13,13,13,-14,-15,-16,-20,-21,-9,13,-13,-17,13,-19,13,-18,]),'CONTENT':([0,2,3,4,5,6,7,14,16,17,18,19,20,21,22,23,24,26,27,34,39,41,42,43,49,51,53,54,55,57,59,60,61,62,63,65,66,67,68,70,71,72,76,78,81,83,],[14,14,-4,-5,-6,-7,-8,14,-24,14,-25,14,14,14,14,-32,-27,14,-28,-26,14,14,14,14,14,14,14,14,14,14,14,14,-14,-15,-16,-20,-21,-9,14,-13,-17,14,14,-19,14,-18,]),'$end':([0,1,2,3,4,5,6,7,15,16,18,53,54,55,57,60,61,62,63,65,66,67,70,71,78,83,],[-3,0,-1,-4,-5,-6,-7,-8,-2,-24,-25,-3,-3,-3,-3,-3,-14,-15,-16,-20,-21,-9,-13,-17,-19,-18,]),'RBRACE':([2,3,4,5,6,7,15,16,18,41,42,43,46,47,48,50,53,54,55,57,59,60,61,62,63,65,66,67,68,69,70,71,72,74,75,77,78,81,82,83,],[-1,-4,-5,-6,-7,-8,-2,-24,-25,-3,-3,-3,53,54,55,57,-3,-3,-3,-3,-3,-3,-14,-15,-16,-20,-21,-9,-3,-11,-13,-17,-3,-10,78,-12,-19,-3,83,-18,]),'CASE':([2,3,4,5,6,7,15,16,18,45,53,54,55,57,60,61,62,63,65,66,67,68,70,71,74,78,83,],[-1,-4,-5,-6,-7,-8,-2,-24,-25,51,-3,-3,-3,-3,-3,-14,-15,-16,-20,-21,-9,-3,-13,-17,51,-19,-18,]),'DEFAULT':([2,3,4,5,6,7,15,16,18,45,53,54,55,57,60,61,62,63,65,66,67,68,70,71,74,78,83,],[-1,-4,-5,-6,-7,-8,-2,-24,-25,52,-3,-3,-3,-3,-3,-14,-15,-16,-20,-21,-9,-3,-13,-17,52,-19,-18,]),'SEMI':([8,9,14,23,32,34,44,],[16,18,-31,-32,39,-26,49,]),'LP':([8,10,11,12,13,14,23,24,73,],[17,19,20,21,22,-31,-32,17,76,]),'RP':([14,23,24,25,26,27,28,29,30,31,33,34,35,56,79,],[-31,-32,-27,34,-29,-28,36,-23,37,38,40,-26,-30,-22,80,]),'COLON':([14,23,29,52,58,],[-31,-32,-23,59,68,]),'LBRACE':([36,37,38,40,64,80,],[41,42,43,45,72,81,]),'ELSE':([53,63,83,],[64,64,-18,]),}
_lr_action = {}
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = {}
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'stmts':([0,2,41,42,43,59,68,72,81,],[1,15,46,47,48,69,74,75,82,]),'stmt':([0,2,41,42,43,53,54,55,57,59,60,68,72,81,],[2,2,2,2,2,61,65,66,67,2,70,2,2,2,]),'expr':([0,2,41,42,43,53,54,55,57,59,60,68,72,81,],[3,3,3,3,3,3,3,3,3,3,3,3,3,3,]),'ifstmt':([0,2,41,42,43,53,54,55,57,59,60,68,72,81,],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,]),'whilestmt':([0,2,41,42,43,53,54,55,57,59,60,68,72,81,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'forstmt':([0,2,41,42,43,53,54,55,57,59,60,68,72,81,],[6,6,6,6,6,6,6,6,6,6,6,6,6,6,]),'switch_stmt':([0,2,41,42,43,53,54,55,57,59,60,68,72,81,],[7,7,7,7,7,7,7,7,7,7,7,7,7,7,]),'contents':([0,2,14,17,19,20,21,22,26,39,41,42,43,49,51,53,54,55,57,59,60,68,72,76,81,],[8,8,23,24,29,29,32,29,24,44,8,8,8,56,29,8,8,8,8,8,8,8,8,29,8,]),'func_expr':([0,2,17,26,41,42,43,53,54,55,57,59,60,68,72,81,],[9,9,27,27,9,9,9,9,9,9,9,9,9,9,9,9,]),'params':([17,26,],[25,35,]),'param':([17,26,],[26,26,]),'bool_expr':([19,20,22,51,76,],[28,30,33,58,79,]),'for_expr':([21,],[31,]),'case_stmt':([45,74,],[50,77,]),'elifs':([53,63,],[60,71,]),'else':([53,63,],[62,62,]),'elif':([53,63,],[63,63,]),}
_lr_goto = {}
for _k, _v in _lr_goto_items.items():
for _x, _y in zip(_v[0], _v[1]):
if not _x in _lr_goto: _lr_goto[_x] = {}
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> stmts","S'",1,None,None,None),
('stmts -> stmt','stmts',1,'p_stmts','se.py',149),
('stmts -> stmt stmts','stmts',2,'p_stmts','se.py',150),
('stmt -> <empty>','stmt',0,'p_stmt','se.py',180),
('stmt -> expr','stmt',1,'p_stmt','se.py',181),
('stmt -> ifstmt','stmt',1,'p_stmt','se.py',182),
('stmt -> whilestmt','stmt',1,'p_stmt','se.py',183),
('stmt -> forstmt','stmt',1,'p_stmt','se.py',184),
('stmt -> switch_stmt','stmt',1,'p_stmt','se.py',185),
('switch_stmt -> SWITCH LP bool_expr RP LBRACE case_stmt RBRACE stmt','switch_stmt',8,'p_switch_stmt','se.py',203),
('case_stmt -> CASE bool_expr COLON stmts','case_stmt',4,'p_case_stmt','se.py',276),
('case_stmt -> DEFAULT COLON stmts','case_stmt',3,'p_case_stmt','se.py',277),
('case_stmt -> CASE bool_expr COLON stmts case_stmt','case_stmt',5,'p_case_stmt','se.py',278),
('ifstmt -> IF LP bool_expr RP LBRACE stmts RBRACE elifs stmt','ifstmt',9,'p_ifstmt','se.py',317),
('ifstmt -> IF LP bool_expr RP LBRACE stmts RBRACE stmt','ifstmt',8,'p_ifstmt','se.py',318),
('elifs -> else','elifs',1,'p_elseif_s','se.py',341),
('elifs -> elif','elifs',1,'p_elseif_s','se.py',342),
('elifs -> elif elifs','elifs',2,'p_elseif_s','se.py',343),
('elif -> ELSE IF LP bool_expr RP LBRACE stmts RBRACE','elif',8,'p_elseif','se.py',356),
('else -> ELSE LBRACE stmts RBRACE','else',4,'p_else','se.py',365),
('whilestmt -> WHILE LP bool_expr RP LBRACE stmts RBRACE stmt','whilestmt',8,'p_whilestmt','se.py',372),
('forstmt -> FOR LP for_expr RP LBRACE stmts RBRACE stmt','forstmt',8,'p_forstmt','se.py',398),
('for_expr -> contents SEMI contents SEMI contents','for_expr',5,'p_for_expr','se.py',416),
('bool_expr -> contents','bool_expr',1,'p_bool_expr','se.py',433),
('expr -> contents SEMI','expr',2,'p_expr','se.py',447),
('expr -> func_expr SEMI','expr',2,'p_expr','se.py',448),
('func_expr -> contents LP params RP','func_expr',4,'p_func','se.py',473),
('param -> contents','param',1,'p_param','se.py',477),
('param -> func_expr','param',1,'p_param','se.py',478),
('params -> param','params',1,'p_params','se.py',482),
('params -> param params','params',2,'p_params','se.py',483),
('contents -> CONTENT','contents',1,'p_contents','se.py',488),
('contents -> CONTENT contents','contents',2,'p_contents','se.py',489),
]