aboutsummaryrefslogtreecommitdiff
path: root/contrib/byacc/test/btyacc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/byacc/test/btyacc')
-rw-r--r--contrib/byacc/test/btyacc/big_b.error0
-rw-r--r--contrib/byacc/test/btyacc/big_b.output19
-rw-r--r--contrib/byacc/test/btyacc/big_l.error0
-rw-r--r--contrib/byacc/test/btyacc/big_l.output19
-rw-r--r--contrib/byacc/test/btyacc/btyacc_calc1.error1
-rw-r--r--contrib/byacc/test/btyacc/btyacc_calc1.output949
-rw-r--r--contrib/byacc/test/btyacc/btyacc_calc1.tab.c1732
-rw-r--r--contrib/byacc/test/btyacc/btyacc_calc1.tab.h23
-rw-r--r--contrib/byacc/test/btyacc/btyacc_demo.error1
-rw-r--r--contrib/byacc/test/btyacc/btyacc_demo.output1360
-rw-r--r--contrib/byacc/test/btyacc/btyacc_demo.tab.c2331
-rw-r--r--contrib/byacc/test/btyacc/btyacc_demo.tab.h36
-rw-r--r--contrib/byacc/test/btyacc/calc.error0
-rw-r--r--contrib/byacc/test/btyacc/calc.output485
-rw-r--r--contrib/byacc/test/btyacc/calc.tab.c1431
-rw-r--r--contrib/byacc/test/btyacc/calc.tab.h8
-rw-r--r--contrib/byacc/test/btyacc/calc1.error2
-rw-r--r--contrib/byacc/test/btyacc/calc1.output900
-rw-r--r--contrib/byacc/test/btyacc/calc1.tab.c1677
-rw-r--r--contrib/byacc/test/btyacc/calc1.tab.h23
-rw-r--r--contrib/byacc/test/btyacc/calc2.error0
-rw-r--r--contrib/byacc/test/btyacc/calc2.output485
-rw-r--r--contrib/byacc/test/btyacc/calc2.tab.c1444
-rw-r--r--contrib/byacc/test/btyacc/calc2.tab.h8
-rw-r--r--contrib/byacc/test/btyacc/calc3.error0
-rw-r--r--contrib/byacc/test/btyacc/calc3.output485
-rw-r--r--contrib/byacc/test/btyacc/calc3.tab.c1449
-rw-r--r--contrib/byacc/test/btyacc/calc3.tab.h8
-rw-r--r--contrib/byacc/test/btyacc/code_calc.code.c1328
-rw-r--r--contrib/byacc/test/btyacc/code_calc.error0
-rw-r--r--contrib/byacc/test/btyacc/code_calc.output485
-rw-r--r--contrib/byacc/test/btyacc/code_calc.tab.c137
-rw-r--r--contrib/byacc/test/btyacc/code_calc.tab.h8
-rw-r--r--contrib/byacc/test/btyacc/code_debug.c1125
-rw-r--r--contrib/byacc/test/btyacc/code_debug.error0
-rw-r--r--contrib/byacc/test/btyacc/code_debug.h6
-rw-r--r--contrib/byacc/test/btyacc/code_debug.i60
-rw-r--r--contrib/byacc/test/btyacc/code_debug.output34
-rw-r--r--contrib/byacc/test/btyacc/code_error.code.c1239
-rw-r--r--contrib/byacc/test/btyacc/code_error.error0
-rw-r--r--contrib/byacc/test/btyacc/code_error.output34
-rw-r--r--contrib/byacc/test/btyacc/code_error.tab.c55
-rw-r--r--contrib/byacc/test/btyacc/code_error.tab.h5
-rw-r--r--contrib/byacc/test/btyacc/empty.error0
-rw-r--r--contrib/byacc/test/btyacc/empty.output28
-rw-r--r--contrib/byacc/test/btyacc/empty.tab.c1254
-rw-r--r--contrib/byacc/test/btyacc/empty.tab.h5
-rw-r--r--contrib/byacc/test/btyacc/err_inherit1.error3
-rw-r--r--contrib/byacc/test/btyacc/err_inherit1.output0
-rw-r--r--contrib/byacc/test/btyacc/err_inherit1.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_inherit1.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_inherit2.error5
-rw-r--r--contrib/byacc/test/btyacc/err_inherit2.output0
-rw-r--r--contrib/byacc/test/btyacc/err_inherit2.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_inherit2.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_inherit3.error23
-rw-r--r--contrib/byacc/test/btyacc/err_inherit3.output229
-rw-r--r--contrib/byacc/test/btyacc/err_inherit3.tab.c1414
-rw-r--r--contrib/byacc/test/btyacc/err_inherit3.tab.h25
-rw-r--r--contrib/byacc/test/btyacc/err_inherit4.error13
-rw-r--r--contrib/byacc/test/btyacc/err_inherit4.output178
-rw-r--r--contrib/byacc/test/btyacc/err_inherit4.tab.c1403
-rw-r--r--contrib/byacc/test/btyacc/err_inherit4.tab.h25
-rw-r--r--contrib/byacc/test/btyacc/err_inherit5.error1
-rw-r--r--contrib/byacc/test/btyacc/err_inherit5.output0
-rw-r--r--contrib/byacc/test/btyacc/err_inherit5.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_inherit5.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax1.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax1.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax1.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax1.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax10.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax10.output37
-rw-r--r--contrib/byacc/test/btyacc/err_syntax10.tab.c1253
-rw-r--r--contrib/byacc/test/btyacc/err_syntax10.tab.h5
-rw-r--r--contrib/byacc/test/btyacc/err_syntax11.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax11.output35
-rw-r--r--contrib/byacc/test/btyacc/err_syntax11.tab.c1259
-rw-r--r--contrib/byacc/test/btyacc/err_syntax11.tab.h5
-rw-r--r--contrib/byacc/test/btyacc/err_syntax12.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax12.output35
-rw-r--r--contrib/byacc/test/btyacc/err_syntax12.tab.c1265
-rw-r--r--contrib/byacc/test/btyacc/err_syntax12.tab.h6
-rw-r--r--contrib/byacc/test/btyacc/err_syntax13.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax13.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax13.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax13.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax14.error2
-rw-r--r--contrib/byacc/test/btyacc/err_syntax14.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax14.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax14.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax15.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax15.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax15.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax15.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax16.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax16.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax16.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax16.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax17.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax17.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax17.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax17.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax18.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax18.output52
-rw-r--r--contrib/byacc/test/btyacc/err_syntax18.tab.c1266
-rw-r--r--contrib/byacc/test/btyacc/err_syntax18.tab.h5
-rw-r--r--contrib/byacc/test/btyacc/err_syntax19.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax19.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax19.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax19.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax2.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax2.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax2.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax2.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax20.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax20.output51
-rw-r--r--contrib/byacc/test/btyacc/err_syntax20.tab.c1261
-rw-r--r--contrib/byacc/test/btyacc/err_syntax20.tab.h6
-rw-r--r--contrib/byacc/test/btyacc/err_syntax21.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax21.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax21.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax21.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax22.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax22.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax22.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax22.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax23.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax23.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax23.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax23.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax24.error2
-rw-r--r--contrib/byacc/test/btyacc/err_syntax24.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax24.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax24.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax25.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax25.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax25.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax25.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax26.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax26.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax26.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax26.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax27.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax27.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax27.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax27.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax3.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax3.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax3.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax3.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax4.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax4.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax4.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax4.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax5.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax5.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax5.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax5.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax6.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax6.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax6.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax6.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7a.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7a.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7a.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7a.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7b.error3
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7b.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7b.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax7b.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8a.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8a.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8a.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax8a.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax9.error1
-rw-r--r--contrib/byacc/test/btyacc/err_syntax9.output0
-rw-r--r--contrib/byacc/test/btyacc/err_syntax9.tab.c15
-rw-r--r--contrib/byacc/test/btyacc/err_syntax9.tab.h0
-rw-r--r--contrib/byacc/test/btyacc/error.error0
-rw-r--r--contrib/byacc/test/btyacc/error.output34
-rw-r--r--contrib/byacc/test/btyacc/error.tab.c1258
-rw-r--r--contrib/byacc/test/btyacc/error.tab.h5
-rw-r--r--contrib/byacc/test/btyacc/grammar.dot906
-rw-r--r--contrib/byacc/test/btyacc/grammar.error1
-rw-r--r--contrib/byacc/test/btyacc/grammar.output2304
-rw-r--r--contrib/byacc/test/btyacc/grammar.tab.c2813
-rw-r--r--contrib/byacc/test/btyacc/grammar.tab.h40
-rw-r--r--contrib/byacc/test/btyacc/help.error0
-rw-r--r--contrib/byacc/test/btyacc/help.output19
-rw-r--r--contrib/byacc/test/btyacc/inherit0.error0
-rw-r--r--contrib/byacc/test/btyacc/inherit0.output165
-rw-r--r--contrib/byacc/test/btyacc/inherit0.tab.c1321
-rw-r--r--contrib/byacc/test/btyacc/inherit0.tab.h10
-rw-r--r--contrib/byacc/test/btyacc/inherit1.error0
-rw-r--r--contrib/byacc/test/btyacc/inherit1.output165
-rw-r--r--contrib/byacc/test/btyacc/inherit1.tab.c1346
-rw-r--r--contrib/byacc/test/btyacc/inherit1.tab.h25
-rw-r--r--contrib/byacc/test/btyacc/inherit2.error0
-rw-r--r--contrib/byacc/test/btyacc/inherit2.output199
-rw-r--r--contrib/byacc/test/btyacc/inherit2.tab.c1409
-rw-r--r--contrib/byacc/test/btyacc/inherit2.tab.h25
-rw-r--r--contrib/byacc/test/btyacc/no_b_opt.error0
-rw-r--r--contrib/byacc/test/btyacc/no_b_opt.output19
-rw-r--r--contrib/byacc/test/btyacc/no_b_opt1.error0
-rw-r--r--contrib/byacc/test/btyacc/no_b_opt1.output1
-rw-r--r--contrib/byacc/test/btyacc/no_code_c.error0
-rw-r--r--contrib/byacc/test/btyacc/no_code_c.output1
-rw-r--r--contrib/byacc/test/btyacc/no_defines.error0
-rw-r--r--contrib/byacc/test/btyacc/no_defines.output1
-rw-r--r--contrib/byacc/test/btyacc/no_graph.error0
-rw-r--r--contrib/byacc/test/btyacc/no_graph.output1
-rw-r--r--contrib/byacc/test/btyacc/no_include.error0
-rw-r--r--contrib/byacc/test/btyacc/no_include.output1
-rw-r--r--contrib/byacc/test/btyacc/no_opts.error0
-rw-r--r--contrib/byacc/test/btyacc/no_opts.output1
-rw-r--r--contrib/byacc/test/btyacc/no_output.error0
-rw-r--r--contrib/byacc/test/btyacc/no_output.output1
-rw-r--r--contrib/byacc/test/btyacc/no_output1.error0
-rw-r--r--contrib/byacc/test/btyacc/no_output1.output1
-rw-r--r--contrib/byacc/test/btyacc/no_output2.error0
-rw-r--r--contrib/byacc/test/btyacc/no_output2.output19
-rw-r--r--contrib/byacc/test/btyacc/no_p_opt.error0
-rw-r--r--contrib/byacc/test/btyacc/no_p_opt.output19
-rw-r--r--contrib/byacc/test/btyacc/no_p_opt1.error0
-rw-r--r--contrib/byacc/test/btyacc/no_p_opt1.output1
-rw-r--r--contrib/byacc/test/btyacc/no_verbose.error0
-rw-r--r--contrib/byacc/test/btyacc/no_verbose.output1
-rw-r--r--contrib/byacc/test/btyacc/nostdin.error0
-rw-r--r--contrib/byacc/test/btyacc/nostdin.output19
-rw-r--r--contrib/byacc/test/btyacc/ok_syntax1.error0
-rw-r--r--contrib/byacc/test/btyacc/ok_syntax1.output511
-rw-r--r--contrib/byacc/test/btyacc/ok_syntax1.tab.c1472
-rw-r--r--contrib/byacc/test/btyacc/ok_syntax1.tab.h35
-rw-r--r--contrib/byacc/test/btyacc/pure_calc.error0
-rw-r--r--contrib/byacc/test/btyacc/pure_calc.output485
-rw-r--r--contrib/byacc/test/btyacc/pure_calc.tab.c1445
-rw-r--r--contrib/byacc/test/btyacc/pure_calc.tab.h8
-rw-r--r--contrib/byacc/test/btyacc/pure_error.error0
-rw-r--r--contrib/byacc/test/btyacc/pure_error.output34
-rw-r--r--contrib/byacc/test/btyacc/pure_error.tab.c1274
-rw-r--r--contrib/byacc/test/btyacc/pure_error.tab.h5
-rw-r--r--contrib/byacc/test/btyacc/quote_calc-s.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc-s.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc-s.tab.c1445
-rw-r--r--contrib/byacc/test/btyacc/quote_calc-s.tab.h14
-rw-r--r--contrib/byacc/test/btyacc/quote_calc.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc.tab.c1451
-rw-r--r--contrib/byacc/test/btyacc/quote_calc.tab.h20
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2-s.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2-s.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2-s.tab.c1445
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2-s.tab.h14
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2.tab.c1451
-rw-r--r--contrib/byacc/test/btyacc/quote_calc2.tab.h20
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3-s.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3-s.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3-s.tab.c1446
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3-s.tab.h14
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3.tab.c1446
-rw-r--r--contrib/byacc/test/btyacc/quote_calc3.tab.h14
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4-s.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4-s.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4-s.tab.c1446
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4-s.tab.h14
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4.error1
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4.output593
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4.tab.c1446
-rw-r--r--contrib/byacc/test/btyacc/quote_calc4.tab.h14
-rw-r--r--contrib/byacc/test/btyacc/rename_debug.c1121
-rw-r--r--contrib/byacc/test/btyacc/rename_debug.error0
-rw-r--r--contrib/byacc/test/btyacc/rename_debug.h6
-rw-r--r--contrib/byacc/test/btyacc/rename_debug.i60
-rw-r--r--contrib/byacc/test/btyacc/rename_debug.output34
-rw-r--r--contrib/byacc/test/btyacc/varsyntax_calc1.error2
-rw-r--r--contrib/byacc/test/btyacc/varsyntax_calc1.output900
-rw-r--r--contrib/byacc/test/btyacc/varsyntax_calc1.tab.c1678
-rw-r--r--contrib/byacc/test/btyacc/varsyntax_calc1.tab.h23
291 files changed, 68693 insertions, 0 deletions
diff --git a/contrib/byacc/test/btyacc/big_b.error b/contrib/byacc/test/btyacc/big_b.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/big_b.error
diff --git a/contrib/byacc/test/btyacc/big_b.output b/contrib/byacc/test/btyacc/big_b.output
new file mode 100644
index 000000000000..28e455543be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/big_b.output
@@ -0,0 +1,19 @@
+Usage: YACC [options] filename
+
+Options:
+ -b file_prefix set filename prefix (default "y.")
+ -B create a backtracking parser
+ -d write definitions (.tab.h)
+ -D enable value stack memory reclamation
+ -i write interface (y.tab.i)
+ -g write a graphical description
+ -l suppress #line directives
+ -L enable position processing, e.g., "%locations"
+ -o output_file (default ".tab.c")
+ -p symbol_prefix set symbol prefix (default "yy")
+ -P create a reentrant parser, e.g., "%pure-parser"
+ -r produce separate code and table files (y.code.c)
+ -s suppress #define's for quoted names in %token lines
+ -t add debugging support
+ -v write description (y.output)
+ -V show version information and exit
diff --git a/contrib/byacc/test/btyacc/big_l.error b/contrib/byacc/test/btyacc/big_l.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/big_l.error
diff --git a/contrib/byacc/test/btyacc/big_l.output b/contrib/byacc/test/btyacc/big_l.output
new file mode 100644
index 000000000000..28e455543be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/big_l.output
@@ -0,0 +1,19 @@
+Usage: YACC [options] filename
+
+Options:
+ -b file_prefix set filename prefix (default "y.")
+ -B create a backtracking parser
+ -d write definitions (.tab.h)
+ -D enable value stack memory reclamation
+ -i write interface (y.tab.i)
+ -g write a graphical description
+ -l suppress #line directives
+ -L enable position processing, e.g., "%locations"
+ -o output_file (default ".tab.c")
+ -p symbol_prefix set symbol prefix (default "yy")
+ -P create a reentrant parser, e.g., "%pure-parser"
+ -r produce separate code and table files (y.code.c)
+ -s suppress #define's for quoted names in %token lines
+ -t add debugging support
+ -v write description (y.output)
+ -V show version information and exit
diff --git a/contrib/byacc/test/btyacc/btyacc_calc1.error b/contrib/byacc/test/btyacc/btyacc_calc1.error
new file mode 100644
index 000000000000..1807ff988010
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_calc1.error
@@ -0,0 +1 @@
+YACC: 17 shift/reduce conflicts, 27 reduce/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/btyacc_calc1.output b/contrib/byacc/test/btyacc/btyacc_calc1.output
new file mode 100644
index 000000000000..fe68c43780cb
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_calc1.output
@@ -0,0 +1,949 @@
+ 0 $accept : lines $end
+
+ 1 lines :
+ 2 | lines line '\n'
+ 3 | lines error '\n'
+
+ 4 line : dexp
+ 5 | vexp
+ 6 | DREG '=' dexp
+ 7 | VREG '=' vexp
+
+ 8 dexp : CONST
+ 9 | DREG
+ 10 | dexp '+' dexp
+ 11 | dexp '-' dexp
+ 12 | dexp '*' dexp
+ 13 | dexp '/' dexp
+ 14 | '-' dexp
+ 15 | '(' dexp ')'
+
+ 16 vexp : dexp
+ 17 | '(' dexp ',' dexp ')'
+ 18 | VREG
+ 19 | vexp '+' vexp
+ 20 | dexp '+' vexp
+ 21 | vexp '-' vexp
+ 22 | dexp '-' vexp
+ 23 | vexp '*' vexp
+ 24 | dexp '*' vexp
+ 25 | vexp '/' vexp
+ 26 | dexp '/' vexp
+ 27 | '-' vexp
+ 28 | '(' vexp ')'
+
+state 0
+ $accept : . lines $end (0)
+ lines : . (1)
+
+ . reduce 1
+
+ lines goto 1
+
+
+state 1
+ $accept : lines . $end (0)
+ lines : lines . line '\n' (2)
+ lines : lines . error '\n' (3)
+
+ $end accept
+ error shift 2
+ DREG shift 3
+ VREG shift 4
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 8
+ vexp goto 9
+ line goto 10
+
+
+state 2
+ lines : lines error . '\n' (3)
+
+ '\n' shift 11
+ . error
+
+
+state 3
+ line : DREG . '=' dexp (6)
+ dexp : DREG . (9)
+
+ '=' shift 12
+ '+' reduce 9
+ '-' reduce 9
+ '*' reduce 9
+ '/' reduce 9
+ '\n' reduce 9
+
+
+state 4
+ line : VREG . '=' vexp (7)
+ vexp : VREG . (18)
+
+ '=' shift 13
+ '+' reduce 18
+ '-' reduce 18
+ '*' reduce 18
+ '/' reduce 18
+ '\n' reduce 18
+
+
+state 5
+ dexp : CONST . (8)
+
+ . reduce 8
+
+
+state 6
+ dexp : '-' . dexp (14)
+ vexp : '-' . vexp (27)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 16
+ vexp goto 17
+
+
+state 7
+ dexp : '(' . dexp ')' (15)
+ vexp : '(' . dexp ',' dexp ')' (17)
+ vexp : '(' . vexp ')' (28)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 18
+ vexp goto 19
+
+
+8: shift/reduce conflict (shift 20, reduce 16) on '+'
+8: shift/reduce conflict (shift 21, reduce 16) on '-'
+8: shift/reduce conflict (shift 22, reduce 16) on '*'
+8: shift/reduce conflict (shift 23, reduce 16) on '/'
+8: reduce/reduce conflict (reduce 4, reduce 16) on '\n'
+state 8
+ line : dexp . (4)
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' [trial] shift 20
+ '-' [trial] shift 21
+ '*' [trial] shift 22
+ '/' [trial] shift 23
+ '+' [trial] reduce 16
+ '-' [trial] reduce 16
+ '*' [trial] reduce 16
+ '/' [trial] reduce 16
+ '\n' [trial] reduce 4
+ '\n' [trial] reduce 16
+
+
+state 9
+ line : vexp . (5)
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ '\n' reduce 5
+
+
+state 10
+ lines : lines line . '\n' (2)
+
+ '\n' shift 28
+ . error
+
+
+state 11
+ lines : lines error '\n' . (3)
+
+ . reduce 3
+
+
+state 12
+ line : DREG '=' . dexp (6)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 31
+
+
+state 13
+ line : VREG '=' . vexp (7)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 32
+ vexp goto 33
+
+
+state 14
+ dexp : DREG . (9)
+
+ . reduce 9
+
+
+state 15
+ vexp : VREG . (18)
+
+ . reduce 18
+
+
+16: reduce/reduce conflict (reduce 14, reduce 16) on '+'
+16: reduce/reduce conflict (reduce 14, reduce 16) on '-'
+16: reduce/reduce conflict (reduce 14, reduce 16) on '*'
+16: reduce/reduce conflict (reduce 14, reduce 16) on '/'
+16: reduce/reduce conflict (reduce 14, reduce 16) on '\n'
+16: reduce/reduce conflict (reduce 14, reduce 16) on ')'
+state 16
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '-' dexp . (14)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' [trial] reduce 14
+ '+' [trial] reduce 16
+ '-' [trial] reduce 14
+ '-' [trial] reduce 16
+ '*' [trial] reduce 14
+ '*' [trial] reduce 16
+ '/' [trial] reduce 14
+ '/' [trial] reduce 16
+ '\n' [trial] reduce 14
+ '\n' [trial] reduce 16
+ ')' [trial] reduce 14
+ ')' [trial] reduce 16
+ ',' reduce 14
+
+
+state 17
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : '-' vexp . (27)
+
+ . reduce 27
+
+
+18: shift/reduce conflict (shift 20, reduce 16) on '+'
+18: shift/reduce conflict (shift 21, reduce 16) on '-'
+18: shift/reduce conflict (shift 22, reduce 16) on '*'
+18: shift/reduce conflict (shift 23, reduce 16) on '/'
+18: shift/reduce conflict (shift 34, reduce 16) on ')'
+state 18
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '(' dexp . ')' (15)
+ vexp : dexp . (16)
+ vexp : '(' dexp . ',' dexp ')' (17)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' [trial] shift 20
+ '-' [trial] shift 21
+ '*' [trial] shift 22
+ '/' [trial] shift 23
+ ')' [trial] shift 34
+ ',' shift 35
+ '+' [trial] reduce 16
+ '-' [trial] reduce 16
+ '*' [trial] reduce 16
+ '/' [trial] reduce 16
+ ')' [trial] reduce 16
+
+
+state 19
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : '(' vexp . ')' (28)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ ')' shift 36
+ . error
+
+
+state 20
+ dexp : dexp '+' . dexp (10)
+ vexp : dexp '+' . vexp (20)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 37
+ vexp goto 38
+
+
+state 21
+ dexp : dexp '-' . dexp (11)
+ vexp : dexp '-' . vexp (22)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 39
+ vexp goto 40
+
+
+state 22
+ dexp : dexp '*' . dexp (12)
+ vexp : dexp '*' . vexp (24)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 41
+ vexp goto 42
+
+
+state 23
+ dexp : dexp '/' . dexp (13)
+ vexp : dexp '/' . vexp (26)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 43
+ vexp goto 44
+
+
+state 24
+ vexp : vexp '+' . vexp (19)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 32
+ vexp goto 45
+
+
+state 25
+ vexp : vexp '-' . vexp (21)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 32
+ vexp goto 46
+
+
+state 26
+ vexp : vexp '*' . vexp (23)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 32
+ vexp goto 47
+
+
+state 27
+ vexp : vexp '/' . vexp (25)
+
+ DREG shift 14
+ VREG shift 15
+ CONST shift 5
+ '-' shift 6
+ '(' shift 7
+ . error
+
+ dexp goto 32
+ vexp goto 48
+
+
+state 28
+ lines : lines line '\n' . (2)
+
+ . reduce 2
+
+
+state 29
+ dexp : '-' . dexp (14)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 49
+
+
+state 30
+ dexp : '(' . dexp ')' (15)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 50
+
+
+state 31
+ line : DREG '=' dexp . (6)
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ '\n' reduce 6
+
+
+32: shift/reduce conflict (shift 20, reduce 16) on '+'
+32: shift/reduce conflict (shift 21, reduce 16) on '-'
+32: shift/reduce conflict (shift 22, reduce 16) on '*'
+32: shift/reduce conflict (shift 23, reduce 16) on '/'
+state 32
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' [trial] shift 20
+ '-' [trial] shift 21
+ '*' [trial] shift 22
+ '/' [trial] shift 23
+ '+' [trial] reduce 16
+ '-' [trial] reduce 16
+ '*' [trial] reduce 16
+ '/' [trial] reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 33
+ line : VREG '=' vexp . (7)
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ '\n' reduce 7
+
+
+state 34
+ dexp : '(' dexp ')' . (15)
+
+ . reduce 15
+
+
+state 35
+ vexp : '(' dexp ',' . dexp ')' (17)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 55
+
+
+state 36
+ vexp : '(' vexp ')' . (28)
+
+ . reduce 28
+
+
+37: reduce/reduce conflict (reduce 10, reduce 16) on '+'
+37: reduce/reduce conflict (reduce 10, reduce 16) on '-'
+37: shift/reduce conflict (shift 22, reduce 16) on '*'
+37: shift/reduce conflict (shift 23, reduce 16) on '/'
+37: reduce/reduce conflict (reduce 10, reduce 16) on '\n'
+37: reduce/reduce conflict (reduce 10, reduce 16) on ')'
+state 37
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp '+' dexp . (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '*' [trial] shift 22
+ '/' [trial] shift 23
+ '+' [trial] reduce 10
+ '+' [trial] reduce 16
+ '-' [trial] reduce 10
+ '-' [trial] reduce 16
+ '*' [trial] reduce 16
+ '/' [trial] reduce 16
+ '\n' [trial] reduce 10
+ '\n' [trial] reduce 16
+ ')' [trial] reduce 10
+ ')' [trial] reduce 16
+ ',' reduce 10
+
+
+state 38
+ vexp : vexp . '+' vexp (19)
+ vexp : dexp '+' vexp . (20)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 20
+ '-' reduce 20
+ '\n' reduce 20
+ ')' reduce 20
+
+
+39: reduce/reduce conflict (reduce 11, reduce 16) on '+'
+39: reduce/reduce conflict (reduce 11, reduce 16) on '-'
+39: shift/reduce conflict (shift 22, reduce 16) on '*'
+39: shift/reduce conflict (shift 23, reduce 16) on '/'
+39: reduce/reduce conflict (reduce 11, reduce 16) on '\n'
+39: reduce/reduce conflict (reduce 11, reduce 16) on ')'
+state 39
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp '-' dexp . (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '*' [trial] shift 22
+ '/' [trial] shift 23
+ '+' [trial] reduce 11
+ '+' [trial] reduce 16
+ '-' [trial] reduce 11
+ '-' [trial] reduce 16
+ '*' [trial] reduce 16
+ '/' [trial] reduce 16
+ '\n' [trial] reduce 11
+ '\n' [trial] reduce 16
+ ')' [trial] reduce 11
+ ')' [trial] reduce 16
+ ',' reduce 11
+
+
+state 40
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : dexp '-' vexp . (22)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 22
+ '-' reduce 22
+ '\n' reduce 22
+ ')' reduce 22
+
+
+41: reduce/reduce conflict (reduce 12, reduce 16) on '+'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '-'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '*'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '/'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '\n'
+41: reduce/reduce conflict (reduce 12, reduce 16) on ')'
+state 41
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp '*' dexp . (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' [trial] reduce 12
+ '+' [trial] reduce 16
+ '-' [trial] reduce 12
+ '-' [trial] reduce 16
+ '*' [trial] reduce 12
+ '*' [trial] reduce 16
+ '/' [trial] reduce 12
+ '/' [trial] reduce 16
+ '\n' [trial] reduce 12
+ '\n' [trial] reduce 16
+ ')' [trial] reduce 12
+ ')' [trial] reduce 16
+ ',' reduce 12
+
+
+state 42
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : dexp '*' vexp . (24)
+ vexp : vexp . '/' vexp (25)
+
+ . reduce 24
+
+
+43: reduce/reduce conflict (reduce 13, reduce 16) on '+'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '-'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '*'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '/'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '\n'
+43: reduce/reduce conflict (reduce 13, reduce 16) on ')'
+state 43
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : dexp '/' dexp . (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' [trial] reduce 13
+ '+' [trial] reduce 16
+ '-' [trial] reduce 13
+ '-' [trial] reduce 16
+ '*' [trial] reduce 13
+ '*' [trial] reduce 16
+ '/' [trial] reduce 13
+ '/' [trial] reduce 16
+ '\n' [trial] reduce 13
+ '\n' [trial] reduce 16
+ ')' [trial] reduce 13
+ ')' [trial] reduce 16
+ ',' reduce 13
+
+
+state 44
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : dexp '/' vexp . (26)
+
+ . reduce 26
+
+
+state 45
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp '+' vexp . (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 19
+ '-' reduce 19
+ '\n' reduce 19
+ ')' reduce 19
+
+
+state 46
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp '-' vexp . (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 21
+ '-' reduce 21
+ '\n' reduce 21
+ ')' reduce 21
+
+
+state 47
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp '*' vexp . (23)
+ vexp : vexp . '/' vexp (25)
+
+ . reduce 23
+
+
+state 48
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : vexp '/' vexp . (25)
+
+ . reduce 25
+
+
+state 49
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '-' dexp . (14)
+
+ . reduce 14
+
+
+state 50
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '(' dexp . ')' (15)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ ')' shift 34
+ . error
+
+
+state 51
+ dexp : dexp '+' . dexp (10)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 56
+
+
+state 52
+ dexp : dexp '-' . dexp (11)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 57
+
+
+state 53
+ dexp : dexp '*' . dexp (12)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 58
+
+
+state 54
+ dexp : dexp '/' . dexp (13)
+
+ DREG shift 14
+ CONST shift 5
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 59
+
+
+state 55
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : '(' dexp ',' dexp . ')' (17)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ ')' shift 60
+ . error
+
+
+state 56
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp '+' dexp . (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '*' shift 53
+ '/' shift 54
+ '+' reduce 10
+ '-' reduce 10
+ '\n' reduce 10
+ ')' reduce 10
+
+
+state 57
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp '-' dexp . (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '*' shift 53
+ '/' shift 54
+ '+' reduce 11
+ '-' reduce 11
+ '\n' reduce 11
+ ')' reduce 11
+
+
+state 58
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp '*' dexp . (12)
+ dexp : dexp . '/' dexp (13)
+
+ . reduce 12
+
+
+state 59
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : dexp '/' dexp . (13)
+
+ . reduce 13
+
+
+state 60
+ vexp : '(' dexp ',' dexp ')' . (17)
+
+ . reduce 17
+
+
+State 8 contains 4 shift/reduce conflicts, 1 reduce/reduce conflict.
+State 16 contains 6 reduce/reduce conflicts.
+State 18 contains 5 shift/reduce conflicts.
+State 32 contains 4 shift/reduce conflicts.
+State 37 contains 2 shift/reduce conflicts, 4 reduce/reduce conflicts.
+State 39 contains 2 shift/reduce conflicts, 4 reduce/reduce conflicts.
+State 41 contains 6 reduce/reduce conflicts.
+State 43 contains 6 reduce/reduce conflicts.
+
+
+15 terminals, 5 nonterminals
+29 grammar rules, 61 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DREG
+ 3 258 VREG
+ 4 259 CONST
+ 5 43 '+'
+ 6 45 '-'
+ 7 42 '*'
+ 8 47 '/'
+ 9 260 UMINUS
+ 10 10 '\n'
+ 11 61 '='
+ 12 40 '('
+ 13 41 ')'
+ 14 44 ','
+ 15 261 $accept
+ 16 262 lines
+ 17 263 dexp
+ 18 264 vexp
+ 19 265 line
diff --git a/contrib/byacc/test/btyacc/btyacc_calc1.tab.c b/contrib/byacc/test/btyacc/btyacc_calc1.tab.c
new file mode 100644
index 000000000000..6e4cadecc2a3
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_calc1.tab.c
@@ -0,0 +1,1732 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 1
+#define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
+
+#ifndef yyparse
+#define yyparse calc1_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex calc1_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror calc1_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar calc1_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval calc1_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval calc1_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug calc1_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs calc1_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag calc1_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs calc1_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen calc1_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred calc1_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos calc1_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto calc1_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex calc1_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex calc1_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex calc1_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable calc1_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck calc1_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname calc1_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule calc1_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex calc1_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable calc1_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "calc1_"
+
+#define YYPURE 1
+
+#line 3 "btyacc_calc1.y"
+
+/* http://dinosaur.compilertools.net/yacc/index.html */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+
+typedef struct interval
+{
+ double lo, hi;
+}
+INTERVAL;
+
+INTERVAL vmul(double, double, INTERVAL);
+INTERVAL vdiv(double, double, INTERVAL);
+
+int dcheck(INTERVAL);
+
+double dreg[26];
+INTERVAL vreg[26];
+
+#line 29 "btyacc_calc1.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ int ival;
+ double dval;
+ INTERVAL vval;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 158 "btyacc_calc1.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
+# define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval)
+# define YYLEX yylex(&yylval)
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DREG 257
+#define VREG 258
+#define CONST 259
+#define UMINUS 260
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT calc1_lhs[] = { -1,
+ 0, 0, 0, 3, 3, 3, 3, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+};
+static const YYINT calc1_len[] = { 2,
+ 0, 3, 3, 1, 1, 3, 3, 1, 1, 3,
+ 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 3,
+};
+static const YYINT calc1_defred[] = { 1,
+ 0, 0, 0, 0, 8, 0, 0, 0, 0, 0,
+ 3, 0, 0, 9, 18, 0, 27, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
+ 0, 24, 0, 26, 0, 0, 23, 25, 14, 0,
+ 0, 0, 0, 0, 0, 0, 0, 12, 13, 17,
+};
+static const YYINT calc1_stos[] = { 0,
+ 262, 256, 257, 258, 259, 45, 40, 263, 264, 265,
+ 10, 61, 61, 257, 258, 263, 264, 263, 264, 43,
+ 45, 42, 47, 43, 45, 42, 47, 10, 45, 40,
+ 263, 263, 264, 41, 44, 41, 263, 264, 263, 264,
+ 263, 264, 263, 264, 264, 264, 264, 264, 263, 263,
+ 43, 45, 42, 47, 263, 263, 263, 263, 263, 41,
+};
+static const YYINT calc1_dgoto[] = { 1,
+ 32, 9, 10,
+};
+static const YYINT calc1_sindex[] = { 0,
+ -40, -9, -59, -54, 0, -37, -37, 0, 82, 4,
+ 0, -34, -37, 0, 0, 0, 0, -31, -25, -37,
+ -37, -37, -37, -37, -37, -37, -37, 0, -34, -34,
+ 132, 0, 82, 0, -34, 0, 0, -12, 0, -12,
+ 0, 0, 0, 0, -12, -12, 0, 0, 0, 112,
+ -34, -34, -34, -34, 119, -11, -11, 0, 0, 0,
+};
+static const YYINT calc1_rindex[] = { 0,
+ 0, 0, 51, 58, 0, 0, 0, 0, 11, 0,
+ 0, 0, 0, 0, 0, -16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 19, 9, 27, 0, 0, 0, -5, 41, -4, 77,
+ -2, 0, 8, 0, 78, 85, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 92, 99, 0, 0, 0,
+};
+#if YYBTYACC
+static const YYINT calc1_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 65, 0, 0,
+ 0, 0, 0, 0, 0, 2, 0, 126, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 138, 0, 0, 0, 0, 17, 0, 24, 0,
+ 31, 0, 38, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+#endif
+static const YYINT calc1_gindex[] = { 0,
+ 3, 125, 0,
+};
+#define YYTABLESIZE 225
+static const YYINT calc1_table[] = { 7,
+ 11, 12, 7, 8, 6, 30, 13, 6, 16, 18,
+ 29, 14, 35, 28, 31, 36, 26, 24, 16, 25,
+ 5, 27, 37, 39, 41, 43, 20, 14, 6, 26,
+ 53, 49, 50, 23, 27, 54, 7, 55, 10, 11,
+ 26, 12, 14, 14, 14, 0, 14, 29, 14, 16,
+ 20, 13, 0, 56, 57, 58, 59, 20, 6, 20,
+ 9, 20, 0, 9, 23, 6, 23, 18, 23, 0,
+ 9, 26, 26, 26, 11, 26, 0, 26, 29, 29,
+ 29, 20, 29, 20, 29, 20, 22, 19, 0, 0,
+ 0, 0, 9, 9, 21, 9, 0, 9, 0, 18,
+ 18, 10, 18, 0, 18, 0, 6, 0, 11, 3,
+ 0, 9, 0, 0, 0, 0, 0, 22, 19, 22,
+ 19, 22, 19, 26, 24, 21, 25, 21, 27, 21,
+ 17, 19, 10, 0, 10, 0, 10, 33, 0, 11,
+ 0, 11, 0, 11, 38, 40, 42, 44, 45, 46,
+ 47, 48, 34, 53, 51, 0, 52, 0, 54, 60,
+ 53, 51, 0, 52, 0, 54, 18, 6, 0, 0,
+ 3, 0, 9, 53, 51, 0, 52, 0, 54, 6,
+ 0, 0, 3, 0, 9, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 5, 14,
+ 15, 5, 14, 0, 5,
+};
+static const YYINT calc1_check[] = { 40,
+ 10, 61, 40, 1, 45, 40, 61, 45, 6, 7,
+ 45, 10, 44, 10, 12, 41, 42, 43, 10, 45,
+ 10, 47, 20, 21, 22, 23, 10, 44, 10, 42,
+ 42, 29, 30, 10, 47, 47, 10, 35, 44, 44,
+ 10, 44, 41, 42, 43, -1, 45, 10, 47, 41,
+ 10, 44, -1, 51, 52, 53, 54, 41, 42, 43,
+ 10, 45, -1, 47, 41, 42, 43, 10, 45, -1,
+ 47, 41, 42, 43, 10, 45, -1, 47, 41, 42,
+ 43, 41, 45, 43, 47, 45, 10, 10, -1, -1,
+ -1, -1, 42, 43, 10, 45, -1, 47, -1, 42,
+ 43, 10, 45, -1, 47, -1, 42, 43, 10, 45,
+ -1, 47, -1, -1, -1, -1, -1, 41, 41, 43,
+ 43, 45, 45, 42, 43, 41, 45, 43, 47, 45,
+ 6, 7, 41, -1, 43, -1, 45, 13, -1, 41,
+ -1, 43, -1, 45, 20, 21, 22, 23, 24, 25,
+ 26, 27, 41, 42, 43, -1, 45, -1, 47, 41,
+ 42, 43, -1, 45, -1, 47, 41, 42, 43, -1,
+ 45, -1, 47, 42, 43, -1, 45, -1, 47, 42,
+ 43, -1, 45, -1, 47, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
+ 258, 259, 257, -1, 259,
+};
+#if YYBTYACC
+static const YYINT calc1_ctable[] = { 20,
+ 16, -1, 21, 16, -1, 22, 16, -1, 23, 16,
+ -1, 4, 16, -1, 14, 16, -1, 34, 16, -1,
+ 10, 16, -1, 11, 16, -1, 12, 16, -1, 13,
+ 16, -1,
+};
+#endif
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 260
+#define YYUNDFTOKEN 266
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const calc1_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,
+0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+"error","DREG","VREG","CONST","UMINUS","$accept","lines","dexp","vexp","line",
+"illegal-symbol",
+};
+static const char *const calc1_rule[] = {
+"$accept : lines",
+"lines :",
+"lines : lines line '\\n'",
+"lines : lines error '\\n'",
+"line : dexp",
+"line : vexp",
+"line : DREG '=' dexp",
+"line : VREG '=' vexp",
+"dexp : CONST",
+"dexp : DREG",
+"dexp : dexp '+' dexp",
+"dexp : dexp '-' dexp",
+"dexp : dexp '*' dexp",
+"dexp : dexp '/' dexp",
+"dexp : '-' dexp",
+"dexp : '(' dexp ')'",
+"vexp : dexp",
+"vexp : '(' dexp ',' dexp ')'",
+"vexp : VREG",
+"vexp : vexp '+' vexp",
+"vexp : dexp '+' vexp",
+"vexp : vexp '-' vexp",
+"vexp : dexp '-' vexp",
+"vexp : vexp '*' vexp",
+"vexp : dexp '*' vexp",
+"vexp : vexp '/' vexp",
+"vexp : dexp '/' vexp",
+"vexp : '-' vexp",
+"vexp : '(' vexp ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+#line 174 "btyacc_calc1.y"
+ /* beginning of subroutines section */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+#define BSZ 50 /* buffer size for floating point numbers */
+
+static void
+YYERROR_DECL()
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+ /* lexical analysis */
+
+static int
+YYLEX_DECL()
+{
+ int c;
+
+ while ((c = getchar()) == ' ')
+ { /* skip over blanks */
+ }
+
+ if (isupper(c))
+ {
+#if YYPURE
+ (*yylval).ival = c - 'A';
+#else
+ yylval.ival = c - 'A';
+#endif
+ return (VREG);
+ }
+ if (islower(c))
+ {
+#if YYPURE
+ (*yylval).ival = c - 'a';
+#else
+ yylval.ival = c - 'a';
+#endif
+ return (DREG);
+ }
+
+ if (isdigit(c) || c == '.')
+ {
+ /* gobble up digits, points, exponents */
+ char buf[BSZ + 1], *cp = buf;
+ int dot = 0, expr = 0;
+
+ for (; (cp - buf) < BSZ; ++cp, c = getchar())
+ {
+
+ *cp = (char) c;
+ if (isdigit(c))
+ continue;
+ if (c == '.')
+ {
+ if (dot++ || expr)
+ return ('.'); /* will cause syntax error */
+ continue;
+ }
+
+ if (c == 'e')
+ {
+ if (expr++)
+ return ('e'); /* will cause syntax error */
+ continue;
+ }
+
+ /* end of number */
+ break;
+ }
+ *cp = '\0';
+
+ if ((cp - buf) >= BSZ)
+ printf("constant too long: truncated\n");
+ else
+ ungetc(c, stdin); /* push back last char read */
+#if YYPURE
+ (*yylval).dval = atof(buf);
+#else
+ yylval.dval = atof(buf);
+#endif
+ return (CONST);
+ }
+ return (c);
+}
+
+static INTERVAL
+hilo(double a, double b, double c, double d)
+{
+ /* returns the smallest interval containing a, b, c, and d */
+ /* used by *, / routines */
+ INTERVAL v;
+
+ if (a > b)
+ {
+ v.hi = a;
+ v.lo = b;
+ }
+ else
+ {
+ v.hi = b;
+ v.lo = a;
+ }
+
+ if (c > d)
+ {
+ if (c > v.hi)
+ v.hi = c;
+ if (d < v.lo)
+ v.lo = d;
+ }
+ else
+ {
+ if (d > v.hi)
+ v.hi = d;
+ if (c < v.lo)
+ v.lo = c;
+ }
+ return (v);
+}
+
+INTERVAL
+vmul(double a, double b, INTERVAL v)
+{
+ return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
+}
+
+int
+dcheck(INTERVAL v)
+{
+ if (v.hi >= 0. && v.lo <= 0.)
+ {
+ printf("divisor interval contains 0.\n");
+ return (1);
+ }
+ return (0);
+}
+
+INTERVAL
+vdiv(double a, double b, INTERVAL v)
+{
+ return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
+}
+#line 598 "btyacc_calc1.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yyerrflag;
+ int yychar;
+ YYSTYPE yyval;
+ YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyloc; /* position returned by actions */
+ YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+ /* variables for the parser stack */
+ YYSTACKDATA yystack;
+#if YYBTYACC
+
+ /* Current parser state */
+ static YYParseState *yyps = 0;
+
+ /* yypath != NULL: do the full parse, starting at *yypath parser state. */
+ static YYParseState *yypath = 0;
+
+ /* Base of the lexical value queue */
+ static YYSTYPE *yylvals = 0;
+
+ /* Current position at lexical value queue */
+ static YYSTYPE *yylvp = 0;
+
+ /* End position of lexical value queue */
+ static YYSTYPE *yylve = 0;
+
+ /* The last allocated position at the lexical value queue */
+ static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* Base of the lexical position queue */
+ static YYLTYPE *yylpsns = 0;
+
+ /* Current position at lexical position queue */
+ static YYLTYPE *yylpp = 0;
+
+ /* End position of lexical position queue */
+ static YYLTYPE *yylpe = 0;
+
+ /* The last allocated position at the lexical position queue */
+ static YYLTYPE *yylplim = 0;
+#endif
+
+ /* Current position at lexical token queue */
+ static short *yylexp = 0;
+
+ static short *yylexemes = 0;
+#endif /* YYBTYACC */
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 2:
+#line 51 "btyacc_calc1.y"
+{YYVALID;}
+break;
+case 3:
+#line 52 "btyacc_calc1.y"
+{YYVALID;} if (!yytrial)
+#line 53 "btyacc_calc1.y"
+{
+ yyerrok;
+ }
+break;
+case 4:
+ if (!yytrial)
+#line 59 "btyacc_calc1.y"
+ {
+ (void) printf("%15.8f\n", yystack.l_mark[0].dval);
+ }
+break;
+case 5:
+ if (!yytrial)
+#line 63 "btyacc_calc1.y"
+ {
+ (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[0].vval.lo, yystack.l_mark[0].vval.hi);
+ }
+break;
+case 6:
+ if (!yytrial)
+#line 67 "btyacc_calc1.y"
+ {
+ dreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].dval;
+ }
+break;
+case 7:
+ if (!yytrial)
+#line 71 "btyacc_calc1.y"
+ {
+ vreg[yystack.l_mark[-2].ival] = yystack.l_mark[0].vval;
+ }
+break;
+case 9:
+ if (!yytrial)
+#line 78 "btyacc_calc1.y"
+ {
+ yyval.dval = dreg[yystack.l_mark[0].ival];
+ }
+break;
+case 10:
+ if (!yytrial)
+#line 82 "btyacc_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
+ }
+break;
+case 11:
+ if (!yytrial)
+#line 86 "btyacc_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
+ }
+break;
+case 12:
+ if (!yytrial)
+#line 90 "btyacc_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
+ }
+break;
+case 13:
+ if (!yytrial)
+#line 94 "btyacc_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
+ }
+break;
+case 14:
+ if (!yytrial)
+#line 98 "btyacc_calc1.y"
+ {
+ yyval.dval = -yystack.l_mark[0].dval;
+ }
+break;
+case 15:
+ if (!yytrial)
+#line 102 "btyacc_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-1].dval;
+ }
+break;
+case 16:
+ if (!yytrial)
+#line 108 "btyacc_calc1.y"
+ {
+ yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
+ }
+break;
+case 17:
+ if (!yytrial)
+#line 112 "btyacc_calc1.y"
+ {
+ yyval.vval.lo = yystack.l_mark[-3].dval;
+ yyval.vval.hi = yystack.l_mark[-1].dval;
+ if ( yyval.vval.lo > yyval.vval.hi )
+ {
+ (void) printf("interval out of order\n");
+ YYERROR;
+ }
+ }
+break;
+case 18:
+ if (!yytrial)
+#line 122 "btyacc_calc1.y"
+ {
+ yyval.vval = vreg[yystack.l_mark[0].ival];
+ }
+break;
+case 19:
+ if (!yytrial)
+#line 126 "btyacc_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 20:
+ if (!yytrial)
+#line 131 "btyacc_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 21:
+ if (!yytrial)
+#line 136 "btyacc_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 22:
+ if (!yytrial)
+#line 141 "btyacc_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 23:
+ if (!yytrial)
+#line 146 "btyacc_calc1.y"
+ {
+ yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 24:
+ if (!yytrial)
+#line 150 "btyacc_calc1.y"
+ {
+ yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
+ }
+break;
+case 25:
+ if (!yytrial)
+#line 154 "btyacc_calc1.y"
+ {
+ if (dcheck(yystack.l_mark[0].vval)) YYERROR;
+ yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 26:
+ if (!yytrial)
+#line 159 "btyacc_calc1.y"
+ {
+ if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
+ yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
+ }
+break;
+case 27:
+ if (!yytrial)
+#line 164 "btyacc_calc1.y"
+ {
+ yyval.vval.hi = -yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = -yystack.l_mark[0].vval.hi;
+ }
+break;
+case 28:
+ if (!yytrial)
+#line 169 "btyacc_calc1.y"
+ {
+ yyval.vval = yystack.l_mark[-1].vval;
+ }
+break;
+#line 1498 "btyacc_calc1.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/btyacc_calc1.tab.h b/contrib/byacc/test/btyacc/btyacc_calc1.tab.h
new file mode 100644
index 000000000000..1802350b0d2a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_calc1.tab.h
@@ -0,0 +1,23 @@
+#ifndef _calc1__defines_h_
+#define _calc1__defines_h_
+
+#define DREG 257
+#define VREG 258
+#define CONST 259
+#define UMINUS 260
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ int ival;
+ double dval;
+ INTERVAL vval;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE calc1_lval;
+
+#endif /* _calc1__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/btyacc_demo.error b/contrib/byacc/test/btyacc/btyacc_demo.error
new file mode 100644
index 000000000000..4542fbf3b9ca
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_demo.error
@@ -0,0 +1 @@
+YACC: 7 shift/reduce conflicts, 5 reduce/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/btyacc_demo.output b/contrib/byacc/test/btyacc/btyacc_demo.output
new file mode 100644
index 000000000000..bc64d2467e75
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_demo.output
@@ -0,0 +1,1360 @@
+ 0 $accept : input $end
+
+ 1 opt_scope :
+ 2 | CLCL
+ 3 | opt_scope ID CLCL
+
+ 4 typename : opt_scope ID
+
+ 5 $$1 :
+
+ 6 input : $$1 decl_list
+
+ 7 decl_list :
+
+ 8 $$2 :
+
+ 9 decl_list : decl_list $$2 decl
+
+ 10 $$3 :
+
+ 11 decl : decl_specs $$2 $$3 declarator_list ';'
+
+ 12 $$4 :
+
+ 13 decl : decl_specs $$2 $$3 declarator $$4 block_statement
+
+ 14 decl_specs : decl_spec
+ 15 | decl_specs $$2 decl_spec
+
+ 16 cv_quals :
+ 17 | cv_quals cv_qual
+
+ 18 decl_spec : cv_qual
+ 19 | typename
+ 20 | EXTERN
+ 21 | REGISTER
+ 22 | STATIC
+
+ 23 cv_qual : CONST
+ 24 | VOLATILE
+
+ 25 $$5 :
+
+ 26 $$6 :
+
+ 27 declarator_list : declarator_list ',' $$5 $$6 declarator
+ 28 | declarator
+
+ 29 declarator :
+ 30 | ID
+
+ 31 $$7 :
+
+ 32 $$8 :
+
+ 33 declarator : '(' $$7 $$8 declarator ')'
+ 34 | '*' cv_quals $$5 $$6 declarator
+ 35 | declarator '[' $$5 expr ']'
+ 36 | declarator '(' $$5 formal_arg_list ')' cv_quals
+
+ 37 formal_arg_list :
+ 38 | nonempty_formal_arg_list
+
+ 39 nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg
+ 40 | formal_arg
+
+ 41 formal_arg : decl_specs $$2 $$3 declarator
+
+ 42 expr : expr '+' $$7 expr
+ 43 | expr '-' $$7 expr
+ 44 | expr '*' $$7 expr
+ 45 | expr '%' $$7 expr
+ 46 | expr '/' $$7 expr
+ 47 | '*' $$2 expr
+ 48 | ID
+ 49 | CONSTANT
+
+ 50 statement : decl
+
+ 51 $$9 :
+
+ 52 statement : $$9 expr ';'
+
+ 53 $$10 :
+
+ 54 $$11 :
+
+ 55 statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement
+ 56 | IF '(' $$7 expr ')' THEN $$10 statement
+
+ 57 $$12 :
+
+ 58 statement : $$12 block_statement
+
+ 59 statement_list :
+ 60 | statement_list $$2 statement
+
+ 61 block_statement : '{' $$2 statement_list '}'
+
+state 0
+ $accept : . input $end (0)
+ $$1 : . (5)
+
+ . reduce 5
+
+ input goto 1
+ $$1 goto 2
+
+
+state 1
+ $accept : input . $end (0)
+
+ $end accept
+
+
+state 2
+ input : $$1 . decl_list (6)
+ decl_list : . (7)
+
+ . reduce 7
+
+ decl_list goto 3
+
+
+state 3
+ input : $$1 decl_list . (6)
+ decl_list : decl_list . $$2 decl (9)
+ $$2 : . (8)
+
+ $end reduce 6
+ ID reduce 8
+ EXTERN reduce 8
+ REGISTER reduce 8
+ STATIC reduce 8
+ CONST reduce 8
+ VOLATILE reduce 8
+ CLCL reduce 8
+
+ $$2 goto 4
+
+
+state 4
+ decl_list : decl_list $$2 . decl (9)
+ opt_scope : . (1)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ CLCL shift 10
+ ID reduce 1
+
+ decl goto 11
+ decl_specs goto 12
+ decl_spec goto 13
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+
+
+state 5
+ decl_spec : EXTERN . (20)
+
+ . reduce 20
+
+
+state 6
+ decl_spec : REGISTER . (21)
+
+ . reduce 21
+
+
+state 7
+ decl_spec : STATIC . (22)
+
+ . reduce 22
+
+
+state 8
+ cv_qual : CONST . (23)
+
+ . reduce 23
+
+
+state 9
+ cv_qual : VOLATILE . (24)
+
+ . reduce 24
+
+
+state 10
+ opt_scope : CLCL . (2)
+
+ . reduce 2
+
+
+state 11
+ decl_list : decl_list $$2 decl . (9)
+
+ . reduce 9
+
+
+state 12
+ decl : decl_specs . $$2 $$3 declarator_list ';' (11)
+ decl : decl_specs . $$2 $$3 declarator $$4 block_statement (13)
+ decl_specs : decl_specs . $$2 decl_spec (15)
+ $$2 : . (8)
+
+ . reduce 8
+
+ $$2 goto 17
+
+
+state 13
+ decl_specs : decl_spec . (14)
+
+ . reduce 14
+
+
+state 14
+ decl_spec : typename . (19)
+
+ . reduce 19
+
+
+state 15
+ decl_spec : cv_qual . (18)
+
+ . reduce 18
+
+
+state 16
+ opt_scope : opt_scope . ID CLCL (3)
+ typename : opt_scope . ID (4)
+
+ ID shift 18
+ . error
+
+
+17: reduce/reduce conflict (reduce 1, reduce 10) on ID
+state 17
+ decl : decl_specs $$2 . $$3 declarator_list ';' (11)
+ decl : decl_specs $$2 . $$3 declarator $$4 block_statement (13)
+ decl_specs : decl_specs $$2 . decl_spec (15)
+ opt_scope : . (1)
+ $$3 : . (10)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ CLCL shift 10
+ '*' reduce 10
+ '(' reduce 10
+ '[' reduce 10
+ ID [trial] reduce 1
+ ID [trial] reduce 10
+ ';' reduce 10
+ ',' reduce 10
+ '{' reduce 10
+
+ decl_spec goto 19
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+ $$3 goto 20
+
+
+18: shift/reduce conflict (shift 21, reduce 4) on CLCL
+state 18
+ opt_scope : opt_scope ID . CLCL (3)
+ typename : opt_scope ID . (4)
+
+ CLCL [trial] shift 21
+ '*' reduce 4
+ '(' reduce 4
+ '[' reduce 4
+ ID reduce 4
+ EXTERN reduce 4
+ REGISTER reduce 4
+ STATIC reduce 4
+ CONST reduce 4
+ VOLATILE reduce 4
+ CLCL [trial] reduce 4
+ ';' reduce 4
+ ',' reduce 4
+ ')' reduce 4
+ '{' reduce 4
+
+
+state 19
+ decl_specs : decl_specs $$2 decl_spec . (15)
+
+ . reduce 15
+
+
+20: shift/reduce conflict (shift 23, reduce 29) on '('
+state 20
+ decl : decl_specs $$2 $$3 . declarator_list ';' (11)
+ decl : decl_specs $$2 $$3 . declarator $$4 block_statement (13)
+ declarator : . (29)
+
+ '*' shift 22
+ '(' [trial] shift 23
+ ID shift 24
+ '(' [trial] reduce 29
+ '[' reduce 29
+ ';' reduce 29
+ ',' reduce 29
+ '{' reduce 29
+
+ declarator_list goto 25
+ declarator goto 26
+
+
+state 21
+ opt_scope : opt_scope ID CLCL . (3)
+
+ . reduce 3
+
+
+state 22
+ declarator : '*' . cv_quals $$5 $$6 declarator (34)
+ cv_quals : . (16)
+
+ . reduce 16
+
+ cv_quals goto 27
+
+
+state 23
+ declarator : '(' . $$7 $$8 declarator ')' (33)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 28
+
+
+state 24
+ declarator : ID . (30)
+
+ . reduce 30
+
+
+state 25
+ decl : decl_specs $$2 $$3 declarator_list . ';' (11)
+ declarator_list : declarator_list . ',' $$5 $$6 declarator (27)
+
+ ';' shift 29
+ ',' shift 30
+ . error
+
+
+state 26
+ decl : decl_specs $$2 $$3 declarator . $$4 block_statement (13)
+ declarator_list : declarator . (28)
+ declarator : declarator . '[' $$5 expr ']' (35)
+ declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36)
+ $$4 : . (12)
+
+ '(' shift 31
+ '[' shift 32
+ ';' reduce 28
+ ',' reduce 28
+ '{' reduce 12
+
+ $$4 goto 33
+
+
+state 27
+ cv_quals : cv_quals . cv_qual (17)
+ declarator : '*' cv_quals . $$5 $$6 declarator (34)
+ $$5 : . (25)
+
+ CONST shift 8
+ VOLATILE shift 9
+ '*' reduce 25
+ '(' reduce 25
+ '[' reduce 25
+ ID reduce 25
+ ';' reduce 25
+ ',' reduce 25
+ ')' reduce 25
+ '{' reduce 25
+
+ cv_qual goto 34
+ $$5 goto 35
+
+
+state 28
+ declarator : '(' $$7 . $$8 declarator ')' (33)
+ $$8 : . (32)
+
+ . reduce 32
+
+ $$8 goto 36
+
+
+state 29
+ decl : decl_specs $$2 $$3 declarator_list ';' . (11)
+
+ . reduce 11
+
+
+state 30
+ declarator_list : declarator_list ',' . $$5 $$6 declarator (27)
+ $$5 : . (25)
+
+ . reduce 25
+
+ $$5 goto 37
+
+
+state 31
+ declarator : declarator '(' . $$5 formal_arg_list ')' cv_quals (36)
+ $$5 : . (25)
+
+ . reduce 25
+
+ $$5 goto 38
+
+
+state 32
+ declarator : declarator '[' . $$5 expr ']' (35)
+ $$5 : . (25)
+
+ . reduce 25
+
+ $$5 goto 39
+
+
+state 33
+ decl : decl_specs $$2 $$3 declarator $$4 . block_statement (13)
+
+ '{' shift 40
+ . error
+
+ block_statement goto 41
+
+
+state 34
+ cv_quals : cv_quals cv_qual . (17)
+
+ . reduce 17
+
+
+state 35
+ declarator : '*' cv_quals $$5 . $$6 declarator (34)
+ $$6 : . (26)
+
+ . reduce 26
+
+ $$6 goto 42
+
+
+36: shift/reduce conflict (shift 23, reduce 29) on '('
+state 36
+ declarator : '(' $$7 $$8 . declarator ')' (33)
+ declarator : . (29)
+
+ '*' shift 22
+ '(' [trial] shift 23
+ ID shift 24
+ '(' [trial] reduce 29
+ '[' reduce 29
+ ')' reduce 29
+
+ declarator goto 43
+
+
+state 37
+ declarator_list : declarator_list ',' $$5 . $$6 declarator (27)
+ $$6 : . (26)
+
+ . reduce 26
+
+ $$6 goto 44
+
+
+state 38
+ declarator : declarator '(' $$5 . formal_arg_list ')' cv_quals (36)
+ opt_scope : . (1)
+ formal_arg_list : . (37)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ CLCL shift 10
+ ID reduce 1
+ ')' reduce 37
+
+ formal_arg goto 45
+ decl_specs goto 46
+ decl_spec goto 13
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+ formal_arg_list goto 47
+ nonempty_formal_arg_list goto 48
+
+
+state 39
+ declarator : declarator '[' $$5 . expr ']' (35)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 52
+
+
+state 40
+ block_statement : '{' . $$2 statement_list '}' (61)
+ $$2 : . (8)
+
+ . reduce 8
+
+ $$2 goto 53
+
+
+state 41
+ decl : decl_specs $$2 $$3 declarator $$4 block_statement . (13)
+
+ . reduce 13
+
+
+42: shift/reduce conflict (shift 23, reduce 29) on '('
+state 42
+ declarator : '*' cv_quals $$5 $$6 . declarator (34)
+ declarator : . (29)
+
+ '*' shift 22
+ '(' [trial] shift 23
+ ID shift 24
+ '(' [trial] reduce 29
+ '[' reduce 29
+ ';' reduce 29
+ ',' reduce 29
+ ')' reduce 29
+ '{' reduce 29
+
+ declarator goto 54
+
+
+state 43
+ declarator : '(' $$7 $$8 declarator . ')' (33)
+ declarator : declarator . '[' $$5 expr ']' (35)
+ declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36)
+
+ '(' shift 31
+ '[' shift 32
+ ')' shift 55
+ . error
+
+
+44: shift/reduce conflict (shift 23, reduce 29) on '('
+state 44
+ declarator_list : declarator_list ',' $$5 $$6 . declarator (27)
+ declarator : . (29)
+
+ '*' shift 22
+ '(' [trial] shift 23
+ ID shift 24
+ '(' [trial] reduce 29
+ '[' reduce 29
+ ';' reduce 29
+ ',' reduce 29
+
+ declarator goto 56
+
+
+state 45
+ nonempty_formal_arg_list : formal_arg . (40)
+
+ . reduce 40
+
+
+state 46
+ decl_specs : decl_specs . $$2 decl_spec (15)
+ formal_arg : decl_specs . $$2 $$3 declarator (41)
+ $$2 : . (8)
+
+ . reduce 8
+
+ $$2 goto 57
+
+
+state 47
+ declarator : declarator '(' $$5 formal_arg_list . ')' cv_quals (36)
+
+ ')' shift 58
+ . error
+
+
+state 48
+ formal_arg_list : nonempty_formal_arg_list . (38)
+ nonempty_formal_arg_list : nonempty_formal_arg_list . ',' $$7 formal_arg (39)
+
+ ',' shift 59
+ ')' reduce 38
+
+
+state 49
+ expr : '*' . $$2 expr (47)
+ $$2 : . (8)
+
+ . reduce 8
+
+ $$2 goto 60
+
+
+state 50
+ expr : ID . (48)
+
+ . reduce 48
+
+
+state 51
+ expr : CONSTANT . (49)
+
+ . reduce 49
+
+
+state 52
+ declarator : declarator '[' $$5 expr . ']' (35)
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+
+ '+' shift 61
+ '-' shift 62
+ '*' shift 63
+ '/' shift 64
+ '%' shift 65
+ ']' shift 66
+ . error
+
+
+state 53
+ block_statement : '{' $$2 . statement_list '}' (61)
+ statement_list : . (59)
+
+ . reduce 59
+
+ statement_list goto 67
+
+
+state 54
+ declarator : '*' cv_quals $$5 $$6 declarator . (34)
+ declarator : declarator . '[' $$5 expr ']' (35)
+ declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36)
+
+ '(' shift 31
+ '[' shift 32
+ ';' reduce 34
+ ',' reduce 34
+ ')' reduce 34
+ '{' reduce 34
+
+
+state 55
+ declarator : '(' $$7 $$8 declarator ')' . (33)
+
+ . reduce 33
+
+
+state 56
+ declarator_list : declarator_list ',' $$5 $$6 declarator . (27)
+ declarator : declarator . '[' $$5 expr ']' (35)
+ declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36)
+
+ '(' shift 31
+ '[' shift 32
+ ';' reduce 27
+ ',' reduce 27
+
+
+57: reduce/reduce conflict (reduce 1, reduce 10) on ID
+state 57
+ decl_specs : decl_specs $$2 . decl_spec (15)
+ formal_arg : decl_specs $$2 . $$3 declarator (41)
+ opt_scope : . (1)
+ $$3 : . (10)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ CLCL shift 10
+ '*' reduce 10
+ '(' reduce 10
+ '[' reduce 10
+ ID [trial] reduce 1
+ ID [trial] reduce 10
+ ',' reduce 10
+ ')' reduce 10
+
+ decl_spec goto 19
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+ $$3 goto 68
+
+
+state 58
+ declarator : declarator '(' $$5 formal_arg_list ')' . cv_quals (36)
+ cv_quals : . (16)
+
+ . reduce 16
+
+ cv_quals goto 69
+
+
+state 59
+ nonempty_formal_arg_list : nonempty_formal_arg_list ',' . $$7 formal_arg (39)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 70
+
+
+state 60
+ expr : '*' $$2 . expr (47)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 71
+
+
+state 61
+ expr : expr '+' . $$7 expr (42)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 72
+
+
+state 62
+ expr : expr '-' . $$7 expr (43)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 73
+
+
+state 63
+ expr : expr '*' . $$7 expr (44)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 74
+
+
+state 64
+ expr : expr '/' . $$7 expr (46)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 75
+
+
+state 65
+ expr : expr '%' . $$7 expr (45)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 76
+
+
+state 66
+ declarator : declarator '[' $$5 expr ']' . (35)
+
+ . reduce 35
+
+
+state 67
+ statement_list : statement_list . $$2 statement (60)
+ block_statement : '{' $$2 statement_list . '}' (61)
+ $$2 : . (8)
+
+ '}' shift 77
+ '*' reduce 8
+ ID reduce 8
+ CONSTANT reduce 8
+ EXTERN reduce 8
+ REGISTER reduce 8
+ STATIC reduce 8
+ CONST reduce 8
+ VOLATILE reduce 8
+ IF reduce 8
+ CLCL reduce 8
+ '{' reduce 8
+
+ $$2 goto 78
+
+
+68: shift/reduce conflict (shift 23, reduce 29) on '('
+state 68
+ formal_arg : decl_specs $$2 $$3 . declarator (41)
+ declarator : . (29)
+
+ '*' shift 22
+ '(' [trial] shift 23
+ ID shift 24
+ '(' [trial] reduce 29
+ '[' reduce 29
+ ',' reduce 29
+ ')' reduce 29
+
+ declarator goto 79
+
+
+state 69
+ cv_quals : cv_quals . cv_qual (17)
+ declarator : declarator '(' $$5 formal_arg_list ')' cv_quals . (36)
+
+ CONST shift 8
+ VOLATILE shift 9
+ '(' reduce 36
+ '[' reduce 36
+ ';' reduce 36
+ ',' reduce 36
+ ')' reduce 36
+ '{' reduce 36
+
+ cv_qual goto 34
+
+
+state 70
+ nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 . formal_arg (39)
+ opt_scope : . (1)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ CLCL shift 10
+ ID reduce 1
+
+ formal_arg goto 80
+ decl_specs goto 46
+ decl_spec goto 13
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+
+
+state 71
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+ expr : '*' $$2 expr . (47)
+
+ . reduce 47
+
+
+state 72
+ expr : expr '+' $$7 . expr (42)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 81
+
+
+state 73
+ expr : expr '-' $$7 . expr (43)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 82
+
+
+state 74
+ expr : expr '*' $$7 . expr (44)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 83
+
+
+state 75
+ expr : expr '/' $$7 . expr (46)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 84
+
+
+state 76
+ expr : expr '%' $$7 . expr (45)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 85
+
+
+state 77
+ block_statement : '{' $$2 statement_list '}' . (61)
+
+ . reduce 61
+
+
+78: reduce/reduce conflict (reduce 1, reduce 51) on ID
+state 78
+ statement_list : statement_list $$2 . statement (60)
+ opt_scope : . (1)
+ $$9 : . (51)
+ $$12 : . (57)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ IF shift 86
+ CLCL shift 10
+ '*' reduce 51
+ ID [trial] reduce 1
+ ID [trial] reduce 51
+ CONSTANT reduce 51
+ '{' reduce 57
+
+ decl goto 87
+ statement goto 88
+ decl_specs goto 12
+ decl_spec goto 13
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+ $$9 goto 89
+ $$12 goto 90
+
+
+state 79
+ declarator : declarator . '[' $$5 expr ']' (35)
+ declarator : declarator . '(' $$5 formal_arg_list ')' cv_quals (36)
+ formal_arg : decl_specs $$2 $$3 declarator . (41)
+
+ '(' shift 31
+ '[' shift 32
+ ',' reduce 41
+ ')' reduce 41
+
+
+state 80
+ nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg . (39)
+
+ . reduce 39
+
+
+state 81
+ expr : expr . '+' $$7 expr (42)
+ expr : expr '+' $$7 expr . (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+
+ '*' shift 63
+ '/' shift 64
+ '%' shift 65
+ '+' reduce 42
+ '-' reduce 42
+ ';' reduce 42
+ ')' reduce 42
+ ']' reduce 42
+
+
+state 82
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr '-' $$7 expr . (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+
+ '*' shift 63
+ '/' shift 64
+ '%' shift 65
+ '+' reduce 43
+ '-' reduce 43
+ ';' reduce 43
+ ')' reduce 43
+ ']' reduce 43
+
+
+state 83
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr '*' $$7 expr . (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+
+ . reduce 44
+
+
+state 84
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+ expr : expr '/' $$7 expr . (46)
+
+ . reduce 46
+
+
+state 85
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr '%' $$7 expr . (45)
+ expr : expr . '/' $$7 expr (46)
+
+ . reduce 45
+
+
+state 86
+ statement : IF . '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement (55)
+ statement : IF . '(' $$7 expr ')' THEN $$10 statement (56)
+
+ '(' shift 91
+ . error
+
+
+state 87
+ statement : decl . (50)
+
+ . reduce 50
+
+
+state 88
+ statement_list : statement_list $$2 statement . (60)
+
+ . reduce 60
+
+
+state 89
+ statement : $$9 . expr ';' (52)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 92
+
+
+state 90
+ statement : $$12 . block_statement (58)
+
+ '{' shift 40
+ . error
+
+ block_statement goto 93
+
+
+state 91
+ statement : IF '(' . $$7 expr ')' THEN $$10 statement ELSE $$11 statement (55)
+ statement : IF '(' . $$7 expr ')' THEN $$10 statement (56)
+ $$7 : . (31)
+
+ . reduce 31
+
+ $$7 goto 94
+
+
+state 92
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+ statement : $$9 expr . ';' (52)
+
+ '+' shift 61
+ '-' shift 62
+ '*' shift 63
+ '/' shift 64
+ '%' shift 65
+ ';' shift 95
+ . error
+
+
+state 93
+ statement : $$12 block_statement . (58)
+
+ . reduce 58
+
+
+state 94
+ statement : IF '(' $$7 . expr ')' THEN $$10 statement ELSE $$11 statement (55)
+ statement : IF '(' $$7 . expr ')' THEN $$10 statement (56)
+
+ '*' shift 49
+ ID shift 50
+ CONSTANT shift 51
+ . error
+
+ expr goto 96
+
+
+state 95
+ statement : $$9 expr ';' . (52)
+
+ . reduce 52
+
+
+state 96
+ expr : expr . '+' $$7 expr (42)
+ expr : expr . '-' $$7 expr (43)
+ expr : expr . '*' $$7 expr (44)
+ expr : expr . '%' $$7 expr (45)
+ expr : expr . '/' $$7 expr (46)
+ statement : IF '(' $$7 expr . ')' THEN $$10 statement ELSE $$11 statement (55)
+ statement : IF '(' $$7 expr . ')' THEN $$10 statement (56)
+
+ '+' shift 61
+ '-' shift 62
+ '*' shift 63
+ '/' shift 64
+ '%' shift 65
+ ')' shift 97
+ . error
+
+
+state 97
+ statement : IF '(' $$7 expr ')' . THEN $$10 statement ELSE $$11 statement (55)
+ statement : IF '(' $$7 expr ')' . THEN $$10 statement (56)
+
+ THEN shift 98
+ . error
+
+
+state 98
+ statement : IF '(' $$7 expr ')' THEN . $$10 statement ELSE $$11 statement (55)
+ statement : IF '(' $$7 expr ')' THEN . $$10 statement (56)
+ $$10 : . (53)
+
+ . reduce 53
+
+ $$10 goto 99
+
+
+99: reduce/reduce conflict (reduce 1, reduce 51) on ID
+state 99
+ statement : IF '(' $$7 expr ')' THEN $$10 . statement ELSE $$11 statement (55)
+ statement : IF '(' $$7 expr ')' THEN $$10 . statement (56)
+ opt_scope : . (1)
+ $$9 : . (51)
+ $$12 : . (57)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ IF shift 86
+ CLCL shift 10
+ '*' reduce 51
+ ID [trial] reduce 1
+ ID [trial] reduce 51
+ CONSTANT reduce 51
+ '{' reduce 57
+
+ decl goto 87
+ statement goto 100
+ decl_specs goto 12
+ decl_spec goto 13
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+ $$9 goto 89
+ $$12 goto 90
+
+
+100: shift/reduce conflict (shift 101, reduce 56) on ELSE
+state 100
+ statement : IF '(' $$7 expr ')' THEN $$10 statement . ELSE $$11 statement (55)
+ statement : IF '(' $$7 expr ')' THEN $$10 statement . (56)
+
+ ELSE [trial] shift 101
+ '*' reduce 56
+ ID reduce 56
+ CONSTANT reduce 56
+ EXTERN reduce 56
+ REGISTER reduce 56
+ STATIC reduce 56
+ CONST reduce 56
+ VOLATILE reduce 56
+ IF reduce 56
+ ELSE [trial] reduce 56
+ CLCL reduce 56
+ '{' reduce 56
+ '}' reduce 56
+
+
+state 101
+ statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE . $$11 statement (55)
+ $$11 : . (54)
+
+ . reduce 54
+
+ $$11 goto 102
+
+
+102: reduce/reduce conflict (reduce 1, reduce 51) on ID
+state 102
+ statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 . statement (55)
+ opt_scope : . (1)
+ $$9 : . (51)
+ $$12 : . (57)
+
+ EXTERN shift 5
+ REGISTER shift 6
+ STATIC shift 7
+ CONST shift 8
+ VOLATILE shift 9
+ IF shift 86
+ CLCL shift 10
+ '*' reduce 51
+ ID [trial] reduce 1
+ ID [trial] reduce 51
+ CONSTANT reduce 51
+ '{' reduce 57
+
+ decl goto 87
+ statement goto 103
+ decl_specs goto 12
+ decl_spec goto 13
+ typename goto 14
+ cv_qual goto 15
+ opt_scope goto 16
+ $$9 goto 89
+ $$12 goto 90
+
+
+state 103
+ statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement . (55)
+
+ . reduce 55
+
+
+State 17 contains 1 reduce/reduce conflict.
+State 18 contains 1 shift/reduce conflict.
+State 20 contains 1 shift/reduce conflict.
+State 36 contains 1 shift/reduce conflict.
+State 42 contains 1 shift/reduce conflict.
+State 44 contains 1 shift/reduce conflict.
+State 57 contains 1 reduce/reduce conflict.
+State 68 contains 1 shift/reduce conflict.
+State 78 contains 1 reduce/reduce conflict.
+State 99 contains 1 reduce/reduce conflict.
+State 100 contains 1 shift/reduce conflict.
+State 102 contains 1 reduce/reduce conflict.
+
+
+29 terminals, 31 nonterminals
+62 grammar rules, 104 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 43 '+'
+ 3 45 '-'
+ 4 42 '*'
+ 5 47 '/'
+ 6 37 '%'
+ 7 257 PREFIX
+ 8 258 POSTFIX
+ 9 40 '('
+ 10 91 '['
+ 11 46 '.'
+ 12 259 ID
+ 13 260 CONSTANT
+ 14 261 EXTERN
+ 15 262 REGISTER
+ 16 263 STATIC
+ 17 264 CONST
+ 18 265 VOLATILE
+ 19 266 IF
+ 20 267 THEN
+ 21 268 ELSE
+ 22 269 CLCL
+ 23 59 ';'
+ 24 44 ','
+ 25 41 ')'
+ 26 93 ']'
+ 27 123 '{'
+ 28 125 '}'
+ 29 270 $accept
+ 30 271 input
+ 31 272 expr
+ 32 273 decl
+ 33 274 declarator_list
+ 34 275 decl_list
+ 35 276 statement
+ 36 277 statement_list
+ 37 278 block_statement
+ 38 279 declarator
+ 39 280 formal_arg
+ 40 281 decl_specs
+ 41 282 decl_spec
+ 42 283 typename
+ 43 284 cv_quals
+ 44 285 cv_qual
+ 45 286 opt_scope
+ 46 287 formal_arg_list
+ 47 288 nonempty_formal_arg_list
+ 48 289 $$1
+ 49 290 $$2
+ 50 291 $$3
+ 51 292 $$4
+ 52 293 $$5
+ 53 294 $$6
+ 54 295 $$7
+ 55 296 $$8
+ 56 297 $$9
+ 57 298 $$10
+ 58 299 $$11
+ 59 300 $$12
diff --git a/contrib/byacc/test/btyacc/btyacc_demo.tab.c b/contrib/byacc/test/btyacc/btyacc_demo.tab.c
new file mode 100644
index 000000000000..4a92347b66a4
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_demo.tab.c
@@ -0,0 +1,2331 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 1
+#define YYDEBUGSTR (yytrial ? YYPREFIX "debug(trial)" : YYPREFIX "debug")
+
+#ifndef yyparse
+#define yyparse demo_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex demo_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror demo_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar demo_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval demo_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval demo_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug demo_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs demo_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag demo_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs demo_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen demo_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred demo_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos demo_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto demo_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex demo_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex demo_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex demo_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable demo_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck demo_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname demo_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule demo_rule
+#endif /* yyrule */
+
+#ifndef yyloc
+#define yyloc demo_loc
+#endif /* yyloc */
+
+#ifndef yylloc
+#define yylloc demo_lloc
+#endif /* yylloc */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex demo_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable demo_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "demo_"
+
+#define YYPURE 0
+
+#line 15 "btyacc_demo.y"
+/* dummy types just for compile check */
+typedef int Code;
+typedef int Decl_List;
+typedef int Expr;
+typedef int Expr_List;
+typedef int Scope;
+typedef int Type;
+enum Operator { ADD, SUB, MUL, MOD, DIV, DEREF };
+
+typedef unsigned char bool;
+typedef struct Decl {
+ Scope *scope;
+ Type *type;
+ bool (*istype)(void);
+} Decl;
+
+#include "btyacc_demo.tab.h"
+#include <stdlib.h>
+#include <stdio.h>
+#line 36 "btyacc_demo.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union {
+ Scope *scope;
+ Expr *expr;
+ Expr_List *elist;
+ Type *type;
+ Decl *decl;
+ Decl_List *dlist;
+ Code *code;
+ char *id;
+ } YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 167 "btyacc_demo.tab.c"
+
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+/* Default: YYLTYPE is the text position type. */
+typedef struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+} YYLTYPE;
+#define YYLTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(YYLTYPE loc, const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(yylloc, msg)
+#endif
+
+#ifndef YYDESTRUCT_DECL
+#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)
+#endif
+#ifndef YYDESTRUCT_CALL
+#define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define PREFIX 257
+#define POSTFIX 258
+#define ID 259
+#define CONSTANT 260
+#define EXTERN 261
+#define REGISTER 262
+#define STATIC 263
+#define CONST 264
+#define VOLATILE 265
+#define IF 266
+#define THEN 267
+#define ELSE 268
+#define CLCL 269
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT demo_lhs[] = { -1,
+ 15, 15, 15, 12, 18, 0, 4, 19, 4, 20,
+ 2, 21, 2, 10, 10, 13, 13, 11, 11, 11,
+ 11, 11, 14, 14, 22, 23, 3, 3, 8, 8,
+ 24, 25, 8, 8, 8, 8, 16, 16, 17, 17,
+ 9, 1, 1, 1, 1, 1, 1, 1, 1, 5,
+ 26, 5, 27, 28, 5, 5, 29, 5, 6, 6,
+ 7,
+};
+static const YYINT demo_len[] = { 2,
+ 0, 1, 3, 2, 0, 2, 0, 0, 3, 0,
+ 5, 0, 6, 1, 3, 0, 2, 1, 1, 1,
+ 1, 1, 1, 1, 0, 0, 5, 1, 0, 1,
+ 0, 0, 5, 5, 5, 6, 0, 1, 4, 1,
+ 4, 4, 4, 4, 4, 4, 3, 1, 1, 1,
+ 0, 3, 0, 0, 11, 8, 0, 2, 0, 3,
+ 4,
+};
+static const YYINT demo_defred[] = { 5,
+ 0, 7, 0, 0, 20, 21, 22, 23, 24, 2,
+ 9, 8, 14, 19, 18, 0, 0, 0, 15, 0,
+ 3, 16, 31, 30, 0, 0, 0, 32, 11, 25,
+ 25, 25, 0, 17, 26, 0, 26, 0, 0, 8,
+ 13, 0, 0, 0, 40, 8, 0, 0, 8, 48,
+ 49, 0, 59, 0, 33, 0, 0, 16, 31, 0,
+ 31, 31, 31, 31, 31, 35, 0, 0, 0, 0,
+ 47, 0, 0, 0, 0, 0, 61, 0, 0, 39,
+ 0, 0, 44, 46, 45, 0, 50, 60, 0, 0,
+ 31, 0, 58, 0, 52, 0, 0, 53, 0, 0,
+ 54, 0, 55,
+};
+static const YYINT demo_stos[] = { 0,
+ 271, 289, 275, 290, 261, 262, 263, 264, 265, 269,
+ 273, 281, 282, 283, 285, 286, 290, 259, 282, 291,
+ 269, 42, 40, 259, 274, 279, 284, 295, 59, 44,
+ 40, 91, 292, 285, 293, 296, 293, 293, 293, 123,
+ 278, 294, 279, 294, 280, 281, 287, 288, 42, 259,
+ 260, 272, 290, 279, 41, 279, 290, 41, 44, 290,
+ 43, 45, 42, 47, 37, 93, 277, 291, 284, 295,
+ 272, 295, 295, 295, 295, 295, 125, 290, 279, 280,
+ 272, 272, 272, 272, 272, 266, 273, 276, 297, 300,
+ 40, 272, 278, 295, 59, 272, 41, 267, 298, 276,
+ 268, 299, 276,
+};
+static const YYINT demo_dgoto[] = { 1,
+ 52, 87, 25, 3, 88, 67, 41, 26, 45, 12,
+ 13, 14, 27, 15, 16, 47, 48, 2, 4, 20,
+ 33, 35, 42, 28, 36, 89, 99, 102, 90,
+};
+static const YYINT demo_sindex[] = { 0,
+ 0, 0, 0, -124, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, -256, -124, 0, 0, -33,
+ 0, 0, 0, 0, 34, -4, -205, 0, 0, 0,
+ 0, 0, -110, 0, 0, -33, 0, -124, -15, 0,
+ 0, -33, -36, -33, 0, 0, 4, 7, 0, 0,
+ 0, 5, 0, -4, 0, -4, -124, 0, 0, -15,
+ 0, 0, 0, 0, 0, 0, -46, -33, -205, -124,
+ 0, -15, -15, -15, -15, -15, 0, -91, -4, 0,
+ 122, 122, 0, 0, 0, 40, 0, 0, -15, -110,
+ 0, 106, 0, -15, 0, 113, -183, 0, -91, 0,
+ 0, -91, 0,
+};
+static const YYINT demo_rindex[] = { 0,
+ 0, 0, 1, -157, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -28, -22, 0, -29,
+ 0, 0, 0, 0, 0, -27, -34, 0, 0, 0,
+ 0, 0, 0, 0, 0, 8, 0, -12, 0, 0,
+ 0, -20, 0, 32, 0, 0, 0, 69, 0, 0,
+ 0, 0, 0, -18, 0, 56, 33, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -31, -1, -6, -157,
+ 0, 0, 0, 0, 0, 0, 0, -14, 63, 0,
+ 13, 23, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -14, -42,
+ 0, -14, 0,
+};
+#if YYBTYACC
+static const YYINT demo_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -145, -150, 0, 81,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 82, 0, 0, 0, 0,
+ 0, 91, 0, 112, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, -113, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 117, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, -98, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, -96, -92,
+ 0, -82, 0,
+};
+#endif
+static const YYINT demo_gindex[] = { 0,
+ 53, 175, 0, 0, 9, 0, 90, 76, 111, 27,
+ 29, 0, 124, -25, 0, 0, 0, 0, 21, 126,
+ 0, 136, 147, 71, 0, 0, 0, 0, 0,
+};
+#define YYTABLESIZE 270
+static const YYINT demo_table[] = { 56,
+ 6, 34, 18, 31, 55, 25, 25, 25, 22, 25,
+ 8, 10, 40, 10, 29, 10, 28, 4, 4, 4,
+ 29, 4, 34, 29, 25, 34, 49, 51, 37, 29,
+ 10, 28, 17, 36, 36, 31, 4, 36, 29, 29,
+ 34, 65, 29, 34, 58, 19, 63, 61, 29, 62,
+ 59, 64, 36, 42, 32, 42, 25, 42, 8, 9,
+ 53, 29, 10, 43, 46, 43, 57, 43, 4, 60,
+ 29, 42, 10, 10, 10, 29, 10, 30, 77, 91,
+ 56, 43, 56, 98, 36, 19, 32, 78, 25, 29,
+ 29, 8, 29, 29, 10, 12, 46, 66, 29, 27,
+ 4, 1, 29, 41, 34, 42, 41, 100, 57, 38,
+ 103, 43, 71, 0, 27, 43, 36, 54, 4, 56,
+ 7, 7, 29, 10, 81, 82, 83, 84, 85, 70,
+ 7, 72, 73, 74, 75, 76, 5, 6, 7, 8,
+ 9, 92, 65, 79, 10, 0, 96, 63, 61, 65,
+ 62, 7, 64, 97, 63, 61, 7, 62, 65, 64,
+ 9, 94, 9, 63, 95, 37, 38, 39, 64, 5,
+ 6, 7, 8, 9, 86, 13, 9, 10, 11, 93,
+ 80, 69, 68, 44, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 56, 56, 56, 56,
+ 56, 56, 56, 56, 25, 24, 56, 8, 8, 8,
+ 8, 8, 8, 8, 8, 0, 4, 8, 4, 4,
+ 4, 4, 4, 50, 51, 51, 1, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 8,
+ 0, 8, 8, 8, 8, 8, 0, 0, 0, 8,
+};
+static const YYINT demo_check[] = { 42,
+ 0, 27, 259, 40, 41, 40, 41, 42, 42, 44,
+ 42, 40, 123, 42, 44, 44, 44, 40, 41, 42,
+ 41, 44, 41, 44, 59, 44, 42, 42, 41, 59,
+ 59, 59, 12, 40, 41, 40, 59, 44, 59, 41,
+ 59, 37, 44, 69, 41, 17, 42, 43, 41, 45,
+ 44, 47, 59, 41, 91, 43, 91, 45, 264, 265,
+ 40, 91, 91, 41, 38, 43, 46, 45, 91, 49,
+ 91, 59, 40, 41, 42, 44, 44, 44, 125, 40,
+ 123, 59, 125, 267, 91, 57, 91, 67, 123, 91,
+ 59, 123, 59, 123, 123, 123, 70, 93, 91, 44,
+ 123, 259, 123, 41, 123, 93, 44, 99, 123, 41,
+ 102, 36, 60, 259, 59, 93, 123, 42, 269, 44,
+ 40, 40, 91, 91, 72, 73, 74, 75, 76, 59,
+ 40, 61, 62, 63, 64, 65, 261, 262, 263, 264,
+ 265, 89, 37, 68, 269, 259, 94, 42, 43, 37,
+ 45, 40, 47, 41, 42, 43, 40, 45, 37, 47,
+ 259, 91, 259, 42, 59, 30, 31, 32, 47, 261,
+ 262, 263, 264, 265, 266, 268, 259, 269, 4, 90,
+ 70, 58, 57, 37, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 259, 260, 261, 262,
+ 263, 264, 265, 266, 259, 259, 269, 259, 260, 261,
+ 262, 263, 264, 265, 266, -1, 259, 269, 261, 262,
+ 263, 264, 265, 259, 260, 260, 259, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, 259,
+ -1, 261, 262, 263, 264, 265, -1, -1, -1, 269,
+};
+#if YYBTYACC
+static const YYINT demo_ctable[] = { -1,
+ 1, 10, -1, 21, 4, -1, 23, 29, -1, 1,
+ 51, -1, 101, 56, -1,
+};
+#endif
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 269
+#define YYUNDFTOKEN 301
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const demo_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+"'%'",0,0,"'('","')'","'*'","'+'","','","'-'","'.'","'/'",0,0,0,0,0,0,0,0,0,0,0,
+"';'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,
+"']'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'{'",0,"'}'",0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,"error","PREFIX","POSTFIX","ID","CONSTANT","EXTERN",
+"REGISTER","STATIC","CONST","VOLATILE","IF","THEN","ELSE","CLCL","$accept",
+"input","expr","decl","declarator_list","decl_list","statement",
+"statement_list","block_statement","declarator","formal_arg","decl_specs",
+"decl_spec","typename","cv_quals","cv_qual","opt_scope","formal_arg_list",
+"nonempty_formal_arg_list","$$1","$$2","$$3","$$4","$$5","$$6","$$7","$$8",
+"$$9","$$10","$$11","$$12","illegal-symbol",
+};
+static const char *const demo_rule[] = {
+"$accept : input",
+"opt_scope :",
+"opt_scope : CLCL",
+"opt_scope : opt_scope ID CLCL",
+"typename : opt_scope ID",
+"$$1 :",
+"input : $$1 decl_list",
+"decl_list :",
+"$$2 :",
+"decl_list : decl_list $$2 decl",
+"$$3 :",
+"decl : decl_specs $$2 $$3 declarator_list ';'",
+"$$4 :",
+"decl : decl_specs $$2 $$3 declarator $$4 block_statement",
+"decl_specs : decl_spec",
+"decl_specs : decl_specs $$2 decl_spec",
+"cv_quals :",
+"cv_quals : cv_quals cv_qual",
+"decl_spec : cv_qual",
+"decl_spec : typename",
+"decl_spec : EXTERN",
+"decl_spec : REGISTER",
+"decl_spec : STATIC",
+"cv_qual : CONST",
+"cv_qual : VOLATILE",
+"$$5 :",
+"$$6 :",
+"declarator_list : declarator_list ',' $$5 $$6 declarator",
+"declarator_list : declarator",
+"declarator :",
+"declarator : ID",
+"$$7 :",
+"$$8 :",
+"declarator : '(' $$7 $$8 declarator ')'",
+"declarator : '*' cv_quals $$5 $$6 declarator",
+"declarator : declarator '[' $$5 expr ']'",
+"declarator : declarator '(' $$5 formal_arg_list ')' cv_quals",
+"formal_arg_list :",
+"formal_arg_list : nonempty_formal_arg_list",
+"nonempty_formal_arg_list : nonempty_formal_arg_list ',' $$7 formal_arg",
+"nonempty_formal_arg_list : formal_arg",
+"formal_arg : decl_specs $$2 $$3 declarator",
+"expr : expr '+' $$7 expr",
+"expr : expr '-' $$7 expr",
+"expr : expr '*' $$7 expr",
+"expr : expr '%' $$7 expr",
+"expr : expr '/' $$7 expr",
+"expr : '*' $$2 expr",
+"expr : ID",
+"expr : CONSTANT",
+"statement : decl",
+"$$9 :",
+"statement : $$9 expr ';'",
+"$$10 :",
+"$$11 :",
+"statement : IF '(' $$7 expr ')' THEN $$10 statement ELSE $$11 statement",
+"statement : IF '(' $$7 expr ')' THEN $$10 statement",
+"$$12 :",
+"statement : $$12 block_statement",
+"statement_list :",
+"statement_list : statement_list $$2 statement",
+"block_statement : '{' $$2 statement_list '}'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 200 "btyacc_demo.y"
+
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+
+extern Scope *global_scope;
+
+extern Decl * lookup(Scope *scope, char *id);
+extern Scope * new_scope(Scope *outer_scope);
+extern Scope * start_fn_def(Scope *scope, Decl *fn_decl);
+extern void finish_fn_def(Decl *fn_decl, Code *block);
+extern Type * type_combine(Type *specs, Type *spec);
+extern Type * bare_extern(void);
+extern Type * bare_register(void);
+extern Type * bare_static(void);
+extern Type * bare_const(void);
+extern Type * bare_volatile(void);
+extern Decl * declare(Scope *scope, char *id, Type *type);
+extern Decl * make_pointer(Decl *decl, Type *type);
+extern Decl * make_array(Type *type, Expr *expr);
+extern Decl * build_function(Decl *decl, Decl_List *dlist, Type *type);
+extern Decl_List * append_dlist(Decl_List *dlist, Decl *decl);
+extern Decl_List * build_dlist(Decl *decl);
+extern Expr * build_expr(Expr *left, enum Operator op, Expr *right);
+extern Expr * var_expr(Scope *scope, char *id);
+extern Code * build_expr_code(Expr *expr);
+extern Code * build_if(Expr *cond_expr, Code *then_stmt, Code *else_stmt);
+extern Code * code_append(Code *stmt_list, Code *stmt);
+#line 638 "btyacc_demo.tab.c"
+
+/* Release memory associated with symbol. */
+#if ! defined YYDESTRUCT_IS_DECLARED
+static void
+YYDESTRUCT_DECL()
+{
+ switch (psymb)
+ {
+ case 43:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 655 "btyacc_demo.tab.c"
+ case 45:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 664 "btyacc_demo.tab.c"
+ case 42:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 673 "btyacc_demo.tab.c"
+ case 47:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 682 "btyacc_demo.tab.c"
+ case 37:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 691 "btyacc_demo.tab.c"
+ case 257:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 700 "btyacc_demo.tab.c"
+ case 258:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 709 "btyacc_demo.tab.c"
+ case 40:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 718 "btyacc_demo.tab.c"
+ case 91:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 727 "btyacc_demo.tab.c"
+ case 46:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 736 "btyacc_demo.tab.c"
+ case 259:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).id); }
+ break;
+#line 745 "btyacc_demo.tab.c"
+ case 260:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).expr); }
+ break;
+#line 754 "btyacc_demo.tab.c"
+ case 261:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 763 "btyacc_demo.tab.c"
+ case 262:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 772 "btyacc_demo.tab.c"
+ case 263:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 781 "btyacc_demo.tab.c"
+ case 264:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 790 "btyacc_demo.tab.c"
+ case 265:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 799 "btyacc_demo.tab.c"
+ case 266:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 808 "btyacc_demo.tab.c"
+ case 267:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 817 "btyacc_demo.tab.c"
+ case 268:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 826 "btyacc_demo.tab.c"
+ case 269:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 835 "btyacc_demo.tab.c"
+ case 59:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 844 "btyacc_demo.tab.c"
+ case 44:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 853 "btyacc_demo.tab.c"
+ case 41:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 862 "btyacc_demo.tab.c"
+ case 93:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 871 "btyacc_demo.tab.c"
+ case 123:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 880 "btyacc_demo.tab.c"
+ case 125:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 889 "btyacc_demo.tab.c"
+ case 270:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 898 "btyacc_demo.tab.c"
+ case 271:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 907 "btyacc_demo.tab.c"
+ case 272:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).expr); }
+ break;
+#line 916 "btyacc_demo.tab.c"
+ case 273:
+#line 67 "btyacc_demo.y"
+ { /* 'msg' is a 'char *' indicating the context of destructor invocation*/
+ printf("%s accessed by symbol \"decl\" (case s.b. 273) @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).decl->scope); free((*val).decl->type); }
+ break;
+#line 926 "btyacc_demo.tab.c"
+ case 274:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 935 "btyacc_demo.tab.c"
+ case 275:
+#line 83 "btyacc_demo.y"
+ { printf("%s accessed by symbol with no type @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ /* in this example, we don't know what to do here */ }
+ break;
+#line 944 "btyacc_demo.tab.c"
+ case 276:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).code); }
+ break;
+#line 953 "btyacc_demo.tab.c"
+ case 277:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).code); }
+ break;
+#line 962 "btyacc_demo.tab.c"
+ case 278:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).code); }
+ break;
+#line 971 "btyacc_demo.tab.c"
+ case 279:
+#line 73 "btyacc_demo.y"
+ { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).decl); }
+ break;
+#line 980 "btyacc_demo.tab.c"
+ case 280:
+#line 73 "btyacc_demo.y"
+ { printf("%s accessed by symbol with type <decl> (case s.b. 279 & 280) @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).decl); }
+ break;
+#line 989 "btyacc_demo.tab.c"
+ case 281:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 998 "btyacc_demo.tab.c"
+ case 282:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 1007 "btyacc_demo.tab.c"
+ case 283:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 1016 "btyacc_demo.tab.c"
+ case 284:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 1025 "btyacc_demo.tab.c"
+ case 285:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 1034 "btyacc_demo.tab.c"
+ case 286:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1043 "btyacc_demo.tab.c"
+ case 287:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).dlist); }
+ break;
+#line 1052 "btyacc_demo.tab.c"
+ case 288:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).dlist); }
+ break;
+#line 1061 "btyacc_demo.tab.c"
+ case 289:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1070 "btyacc_demo.tab.c"
+ case 290:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1079 "btyacc_demo.tab.c"
+ case 291:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 1088 "btyacc_demo.tab.c"
+ case 292:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1097 "btyacc_demo.tab.c"
+ case 293:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1106 "btyacc_demo.tab.c"
+ case 294:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 1115 "btyacc_demo.tab.c"
+ case 295:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1124 "btyacc_demo.tab.c"
+ case 296:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).type); }
+ break;
+#line 1133 "btyacc_demo.tab.c"
+ case 297:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1142 "btyacc_demo.tab.c"
+ case 298:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1151 "btyacc_demo.tab.c"
+ case 299:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1160 "btyacc_demo.tab.c"
+ case 300:
+#line 78 "btyacc_demo.y"
+ { printf("%s accessed by symbol of any type other than <decl> @ position[%d,%d..%d,%d]\n",
+ msg,
+ (*loc).first_line, (*loc).first_column,
+ (*loc).last_line, (*loc).last_column);
+ free((*val).scope); }
+ break;
+#line 1169 "btyacc_demo.tab.c"
+ }
+}
+#define YYDESTRUCT_IS_DECLARED 1
+#endif
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 93 "btyacc_demo.y"
+{ yyval.scope = yystack.l_mark[0].scope; }
+break;
+case 2:
+#line 94 "btyacc_demo.y"
+{ yyval.scope = global_scope; }
+break;
+case 3:
+#line 95 "btyacc_demo.y"
+{ Decl *d = lookup(yystack.l_mark[-2].scope, yystack.l_mark[-1].id);
+ if (!d || !d->scope) YYERROR;
+ yyval.scope = d->scope; }
+break;
+case 4:
+#line 101 "btyacc_demo.y"
+{ Decl *d = lookup(yystack.l_mark[-1].scope, yystack.l_mark[0].id);
+ if (d == NULL || d->istype() == 0) YYERROR;
+ yyval.type = d->type; }
+break;
+case 5:
+#line 106 "btyacc_demo.y"
+yyval.scope = global_scope = new_scope(0);
+break;
+case 8:
+#line 107 "btyacc_demo.y"
+yyval.scope = yystack.l_mark[-1].scope;
+break;
+case 10:
+#line 109 "btyacc_demo.y"
+yyval.type = yystack.l_mark[-1].type;
+break;
+case 11:
+#line 109 "btyacc_demo.y"
+{YYVALID;}
+break;
+case 12:
+#line 110 "btyacc_demo.y"
+yyval.scope = start_fn_def(yystack.l_mark[-4].scope, yystack.l_mark[0].decl);
+break;
+case 13:
+ if (!yytrial)
+#line 111 "btyacc_demo.y"
+ { /* demonstrate use of @$ & @N, although this is just the
+ default computation and so is not necessary */
+ yyloc.first_line = yystack.p_mark[-5].first_line;
+ yyloc.first_column = yystack.p_mark[-5].first_column;
+ yyloc.last_line = yystack.p_mark[0].last_line;
+ yyloc.last_column = yystack.p_mark[0].last_column;
+ finish_fn_def(yystack.l_mark[-2].decl, yystack.l_mark[0].code); }
+break;
+case 14:
+#line 121 "btyacc_demo.y"
+{ yyval.type = yystack.l_mark[0].type; }
+break;
+case 15:
+#line 122 "btyacc_demo.y"
+{ yyval.type = type_combine(yystack.l_mark[-2].type, yystack.l_mark[0].type); }
+break;
+case 16:
+#line 125 "btyacc_demo.y"
+{ yyval.type = 0; }
+break;
+case 17:
+#line 126 "btyacc_demo.y"
+{ yyval.type = type_combine(yystack.l_mark[-1].type, yystack.l_mark[0].type); }
+break;
+case 18:
+#line 130 "btyacc_demo.y"
+{ yyval.type = yystack.l_mark[0].type; }
+break;
+case 19:
+#line 131 "btyacc_demo.y"
+{ yyval.type = yystack.l_mark[0].type; }
+break;
+case 20:
+#line 132 "btyacc_demo.y"
+{ yyval.type = bare_extern(); }
+break;
+case 21:
+#line 133 "btyacc_demo.y"
+{ yyval.type = bare_register(); }
+break;
+case 22:
+#line 134 "btyacc_demo.y"
+{ yyval.type = bare_static(); }
+break;
+case 23:
+#line 138 "btyacc_demo.y"
+{ yyval.type = bare_const(); }
+break;
+case 24:
+#line 139 "btyacc_demo.y"
+{ yyval.type = bare_volatile(); }
+break;
+case 25:
+#line 143 "btyacc_demo.y"
+yyval.scope = yystack.l_mark[-3].scope;
+break;
+case 26:
+#line 143 "btyacc_demo.y"
+yyval.type = yystack.l_mark[-3].type;
+break;
+case 29:
+#line 148 "btyacc_demo.y"
+{ if (!yystack.l_mark[0].type) YYERROR; } if (!yytrial)
+#line 149 "btyacc_demo.y"
+{ yyval.decl = declare(yystack.l_mark[-1].scope, 0, yystack.l_mark[0].type); }
+break;
+case 30:
+ if (!yytrial)
+#line 150 "btyacc_demo.y"
+ { yyval.decl = declare(yystack.l_mark[-2].scope, yystack.l_mark[0].id, yystack.l_mark[-1].type); }
+break;
+case 31:
+#line 151 "btyacc_demo.y"
+yyval.scope = yystack.l_mark[-2].scope;
+break;
+case 32:
+#line 151 "btyacc_demo.y"
+yyval.type = yystack.l_mark[-2].type;
+break;
+case 33:
+ if (!yytrial)
+#line 151 "btyacc_demo.y"
+ { yyval.decl = yystack.l_mark[-1].decl; }
+break;
+case 34:
+ if (!yytrial)
+#line 153 "btyacc_demo.y"
+ { yyval.decl = make_pointer(yystack.l_mark[0].decl, yystack.l_mark[-3].type); }
+break;
+case 35:
+ if (!yytrial)
+#line 155 "btyacc_demo.y"
+ { yyval.decl = make_array(yystack.l_mark[-4].decl->type, yystack.l_mark[-1].expr); }
+break;
+case 36:
+ if (!yytrial)
+#line 157 "btyacc_demo.y"
+ { yyval.decl = build_function(yystack.l_mark[-5].decl, yystack.l_mark[-2].dlist, yystack.l_mark[0].type); }
+break;
+case 37:
+ if (!yytrial)
+#line 160 "btyacc_demo.y"
+ { yyval.dlist = 0; }
+break;
+case 38:
+ if (!yytrial)
+#line 161 "btyacc_demo.y"
+ { yyval.dlist = yystack.l_mark[0].dlist; }
+break;
+case 39:
+ if (!yytrial)
+#line 164 "btyacc_demo.y"
+ { yyval.dlist = append_dlist(yystack.l_mark[-3].dlist, yystack.l_mark[0].decl); }
+break;
+case 40:
+ if (!yytrial)
+#line 165 "btyacc_demo.y"
+ { yyval.dlist = build_dlist(yystack.l_mark[0].decl); }
+break;
+case 41:
+ if (!yytrial)
+#line 168 "btyacc_demo.y"
+ { yyval.decl = yystack.l_mark[0].decl; }
+break;
+case 42:
+ if (!yytrial)
+#line 172 "btyacc_demo.y"
+ { yyval.expr = build_expr(yystack.l_mark[-3].expr, ADD, yystack.l_mark[0].expr); }
+break;
+case 43:
+ if (!yytrial)
+#line 173 "btyacc_demo.y"
+ { yyval.expr = build_expr(yystack.l_mark[-3].expr, SUB, yystack.l_mark[0].expr); }
+break;
+case 44:
+ if (!yytrial)
+#line 174 "btyacc_demo.y"
+ { yyval.expr = build_expr(yystack.l_mark[-3].expr, MUL, yystack.l_mark[0].expr); }
+break;
+case 45:
+ if (!yytrial)
+#line 175 "btyacc_demo.y"
+ { yyval.expr = build_expr(yystack.l_mark[-3].expr, MOD, yystack.l_mark[0].expr); }
+break;
+case 46:
+ if (!yytrial)
+#line 176 "btyacc_demo.y"
+ { yyval.expr = build_expr(yystack.l_mark[-3].expr, DIV, yystack.l_mark[0].expr); }
+break;
+case 47:
+ if (!yytrial)
+#line 177 "btyacc_demo.y"
+ { yyval.expr = build_expr(0, DEREF, yystack.l_mark[0].expr); }
+break;
+case 48:
+ if (!yytrial)
+#line 178 "btyacc_demo.y"
+ { yyval.expr = var_expr(yystack.l_mark[-1].scope, yystack.l_mark[0].id); }
+break;
+case 49:
+ if (!yytrial)
+#line 179 "btyacc_demo.y"
+ { yyval.expr = yystack.l_mark[0].expr; }
+break;
+case 50:
+ if (!yytrial)
+#line 183 "btyacc_demo.y"
+ { yyval.code = 0; }
+break;
+case 51:
+#line 184 "btyacc_demo.y"
+yyval.scope = yystack.l_mark[0].scope;
+break;
+case 52:
+#line 184 "btyacc_demo.y"
+{YYVALID;} if (!yytrial)
+#line 184 "btyacc_demo.y"
+{ yyval.code = build_expr_code(yystack.l_mark[-1].expr); }
+break;
+case 53:
+#line 185 "btyacc_demo.y"
+yyval.scope = yystack.l_mark[-6].scope;
+break;
+case 54:
+#line 185 "btyacc_demo.y"
+yyval.scope = yystack.l_mark[-9].scope;
+break;
+case 55:
+#line 185 "btyacc_demo.y"
+{YYVALID;} if (!yytrial)
+#line 186 "btyacc_demo.y"
+{ yyval.code = build_if(yystack.l_mark[-7].expr, yystack.l_mark[-3].code, yystack.l_mark[0].code); }
+break;
+case 56:
+#line 187 "btyacc_demo.y"
+{YYVALID;} if (!yytrial)
+#line 188 "btyacc_demo.y"
+{ yyval.code = build_if(yystack.l_mark[-4].expr, yystack.l_mark[0].code, 0); }
+break;
+case 57:
+#line 189 "btyacc_demo.y"
+yyval.scope = new_scope(yystack.l_mark[0].scope);
+break;
+case 58:
+#line 189 "btyacc_demo.y"
+{YYVALID;} if (!yytrial)
+#line 189 "btyacc_demo.y"
+{ yyval.code = yystack.l_mark[0].code; }
+break;
+case 59:
+ if (!yytrial)
+#line 192 "btyacc_demo.y"
+ { yyval.code = 0; }
+break;
+case 60:
+ if (!yytrial)
+#line 193 "btyacc_demo.y"
+ { yyval.code = code_append(yystack.l_mark[-2].code, yystack.l_mark[0].code); }
+break;
+case 61:
+ if (!yytrial)
+#line 197 "btyacc_demo.y"
+ { yyval.code = yystack.l_mark[-1].code; }
+break;
+#line 2097 "btyacc_demo.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/btyacc_demo.tab.h b/contrib/byacc/test/btyacc/btyacc_demo.tab.h
new file mode 100644
index 000000000000..33139ebebd39
--- /dev/null
+++ b/contrib/byacc/test/btyacc/btyacc_demo.tab.h
@@ -0,0 +1,36 @@
+#ifndef _demo__defines_h_
+#define _demo__defines_h_
+
+#define PREFIX 257
+#define POSTFIX 258
+#define ID 259
+#define CONSTANT 260
+#define EXTERN 261
+#define REGISTER 262
+#define STATIC 263
+#define CONST 264
+#define VOLATILE 265
+#define IF 266
+#define THEN 267
+#define ELSE 268
+#define CLCL 269
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union {
+ Scope *scope;
+ Expr *expr;
+ Expr_List *elist;
+ Type *type;
+ Decl *decl;
+ Decl_List *dlist;
+ Code *code;
+ char *id;
+ } YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE demo_lval;
+
+#endif /* _demo__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/calc.error b/contrib/byacc/test/btyacc/calc.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc.error
diff --git a/contrib/byacc/test/btyacc/calc.output b/contrib/byacc/test/btyacc/calc.output
new file mode 100644
index 000000000000..c689eec0535a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc.output
@@ -0,0 +1,485 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr '+' expr
+ 8 | expr '-' expr
+ 9 | expr '*' expr
+ 10 | expr '/' expr
+ 11 | expr '%' expr
+ 12 | expr '&' expr
+ 13 | expr '|' expr
+ 14 | '-' expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ DIGIT shift 3
+ LETTER shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 4
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 11
+ '|' reduce 15
+ '&' reduce 15
+ '+' reduce 15
+ '-' reduce 15
+ '*' reduce 15
+ '/' reduce 15
+ '%' reduce 15
+ '\n' reduce 15
+
+
+state 5
+ expr : '-' . expr (14)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 13
+ number goto 9
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ '|' reduce 16
+ '&' reduce 16
+ '+' reduce 16
+ '-' reduce 16
+ '*' reduce 16
+ '/' reduce 16
+ '%' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ stat : LETTER '=' . expr (5)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 12
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+state 13
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : '-' expr . (14)
+
+ . reduce 14
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr '|' . expr (13)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr '&' . expr (12)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr '+' . expr (7)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr '-' . expr (8)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr '*' . expr (9)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr '/' . expr (10)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '%' . expr (11)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+state 26
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+state 27
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr '&' expr . (12)
+ expr : expr . '|' expr (13)
+
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 12
+ '&' reduce 12
+ '\n' reduce 12
+ ')' reduce 12
+
+
+state 28
+ expr : expr . '+' expr (7)
+ expr : expr '+' expr . (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 7
+ '&' reduce 7
+ '+' reduce 7
+ '-' reduce 7
+ '\n' reduce 7
+ ')' reduce 7
+
+
+state 29
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr '-' expr . (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 8
+ '&' reduce 8
+ '+' reduce 8
+ '-' reduce 8
+ '\n' reduce 8
+ ')' reduce 8
+
+
+state 30
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr '*' expr . (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 9
+
+
+state 31
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr '/' expr . (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 10
+
+
+state 32
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr '%' expr . (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 11
+
+
+16 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DIGIT
+ 3 258 LETTER
+ 4 124 '|'
+ 5 38 '&'
+ 6 43 '+'
+ 7 45 '-'
+ 8 42 '*'
+ 9 47 '/'
+ 10 37 '%'
+ 11 259 UMINUS
+ 12 10 '\n'
+ 13 61 '='
+ 14 40 '('
+ 15 41 ')'
+ 16 260 $accept
+ 17 261 list
+ 18 262 stat
+ 19 263 expr
+ 20 264 number
diff --git a/contrib/byacc/test/btyacc/calc.tab.c b/contrib/byacc/test/btyacc/calc.tab.c
new file mode 100644
index 000000000000..ceb2ed101be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc.tab.c
@@ -0,0 +1,1431 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse calc_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex calc_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror calc_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar calc_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval calc_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval calc_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug calc_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs calc_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag calc_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs calc_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen calc_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred calc_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos calc_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto calc_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex calc_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex calc_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex calc_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable calc_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck calc_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname calc_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule calc_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex calc_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable calc_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "calc_"
+
+#define YYPURE 0
+
+#line 2 "calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+extern int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "calc.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT calc_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT calc_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT calc_defred[] = { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const YYINT calc_stos[] = { 0,
+ 261, 256, 257, 258, 45, 40, 262, 263, 264, 10,
+ 61, 258, 263, 263, 10, 124, 38, 43, 45, 42,
+ 47, 37, 257, 263, 41, 263, 263, 263, 263, 263,
+ 263, 263,
+};
+static const YYINT calc_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT calc_sindex[] = { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const YYINT calc_rindex[] = { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT calc_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT calc_gindex[] = { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const YYINT calc_table[] = { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const YYINT calc_check[] = { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#define YYUNDFTOKEN 265
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const calc_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number",
+"illegal-symbol",
+};
+static const char *const calc_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 66 "calc.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 480 "calc.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 28 "calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 32 "calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 34 "calc.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 38 "calc.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 40 "calc.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 42 "calc.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 44 "calc.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 46 "calc.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 48 "calc.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 50 "calc.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 52 "calc.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 54 "calc.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 56 "calc.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 61 "calc.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 63 "calc.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1197 "calc.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/calc.tab.h b/contrib/byacc/test/btyacc/calc.tab.h
new file mode 100644
index 000000000000..48f8993b83f6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc.tab.h
@@ -0,0 +1,8 @@
+#ifndef _calc__defines_h_
+#define _calc__defines_h_
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+
+#endif /* _calc__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/calc1.error b/contrib/byacc/test/btyacc/calc1.error
new file mode 100644
index 000000000000..9c1f7152c30e
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc1.error
@@ -0,0 +1,2 @@
+YACC: 2 rules never reduced
+YACC: 18 shift/reduce conflicts, 26 reduce/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/calc1.output b/contrib/byacc/test/btyacc/calc1.output
new file mode 100644
index 000000000000..d6a869f6d353
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc1.output
@@ -0,0 +1,900 @@
+ 0 $accept : line $end
+
+ 1 lines :
+ 2 | lines line
+
+ 3 line : dexp '\n'
+ 4 | vexp '\n'
+ 5 | DREG '=' dexp '\n'
+ 6 | VREG '=' vexp '\n'
+ 7 | error '\n'
+
+ 8 dexp : CONST
+ 9 | DREG
+ 10 | dexp '+' dexp
+ 11 | dexp '-' dexp
+ 12 | dexp '*' dexp
+ 13 | dexp '/' dexp
+ 14 | '-' dexp
+ 15 | '(' dexp ')'
+
+ 16 vexp : dexp
+ 17 | '(' dexp ',' dexp ')'
+ 18 | VREG
+ 19 | vexp '+' vexp
+ 20 | dexp '+' vexp
+ 21 | vexp '-' vexp
+ 22 | dexp '-' vexp
+ 23 | vexp '*' vexp
+ 24 | dexp '*' vexp
+ 25 | vexp '/' vexp
+ 26 | dexp '/' vexp
+ 27 | '-' vexp
+ 28 | '(' vexp ')'
+
+state 0
+ $accept : . line $end (0)
+
+ error shift 1
+ DREG shift 2
+ VREG shift 3
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ line goto 7
+ dexp goto 8
+ vexp goto 9
+
+
+state 1
+ line : error . '\n' (7)
+
+ '\n' shift 10
+ . error
+
+
+state 2
+ line : DREG . '=' dexp '\n' (5)
+ dexp : DREG . (9)
+
+ '=' shift 11
+ '+' reduce 9
+ '-' reduce 9
+ '*' reduce 9
+ '/' reduce 9
+ '\n' reduce 9
+
+
+state 3
+ line : VREG . '=' vexp '\n' (6)
+ vexp : VREG . (18)
+
+ '=' shift 12
+ '+' reduce 18
+ '-' reduce 18
+ '*' reduce 18
+ '/' reduce 18
+ '\n' reduce 18
+
+
+state 4
+ dexp : CONST . (8)
+
+ . reduce 8
+
+
+state 5
+ dexp : '-' . dexp (14)
+ vexp : '-' . vexp (27)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 15
+ vexp goto 16
+
+
+state 6
+ dexp : '(' . dexp ')' (15)
+ vexp : '(' . dexp ',' dexp ')' (17)
+ vexp : '(' . vexp ')' (28)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 17
+ vexp goto 18
+
+
+state 7
+ $accept : line . $end (0)
+
+ $end accept
+
+
+8: shift/reduce conflict (shift 19, reduce 16) on '+'
+8: shift/reduce conflict (shift 20, reduce 16) on '-'
+8: shift/reduce conflict (shift 21, reduce 16) on '*'
+8: shift/reduce conflict (shift 22, reduce 16) on '/'
+8: shift/reduce conflict (shift 23, reduce 16) on '\n'
+state 8
+ line : dexp . '\n' (3)
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' shift 19
+ '-' shift 20
+ '*' shift 21
+ '/' shift 22
+ '\n' shift 23
+
+
+state 9
+ line : vexp . '\n' (4)
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ '\n' shift 28
+ . error
+
+
+state 10
+ line : error '\n' . (7)
+
+ . reduce 7
+
+
+state 11
+ line : DREG '=' . dexp '\n' (5)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 31
+
+
+state 12
+ line : VREG '=' . vexp '\n' (6)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 33
+
+
+state 13
+ dexp : DREG . (9)
+
+ . reduce 9
+
+
+state 14
+ vexp : VREG . (18)
+
+ . reduce 18
+
+
+15: reduce/reduce conflict (reduce 14, reduce 16) on '+'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '-'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '*'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '/'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '\n'
+15: reduce/reduce conflict (reduce 14, reduce 16) on ')'
+state 15
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '-' dexp . (14)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ . reduce 14
+
+
+state 16
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : '-' vexp . (27)
+
+ . reduce 27
+
+
+17: shift/reduce conflict (shift 19, reduce 16) on '+'
+17: shift/reduce conflict (shift 20, reduce 16) on '-'
+17: shift/reduce conflict (shift 21, reduce 16) on '*'
+17: shift/reduce conflict (shift 22, reduce 16) on '/'
+17: shift/reduce conflict (shift 34, reduce 16) on ')'
+state 17
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '(' dexp . ')' (15)
+ vexp : dexp . (16)
+ vexp : '(' dexp . ',' dexp ')' (17)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' shift 19
+ '-' shift 20
+ '*' shift 21
+ '/' shift 22
+ ')' shift 34
+ ',' shift 35
+
+
+state 18
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : '(' vexp . ')' (28)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ ')' shift 36
+ . error
+
+
+state 19
+ dexp : dexp '+' . dexp (10)
+ vexp : dexp '+' . vexp (20)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 37
+ vexp goto 38
+
+
+state 20
+ dexp : dexp '-' . dexp (11)
+ vexp : dexp '-' . vexp (22)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 39
+ vexp goto 40
+
+
+state 21
+ dexp : dexp '*' . dexp (12)
+ vexp : dexp '*' . vexp (24)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 41
+ vexp goto 42
+
+
+state 22
+ dexp : dexp '/' . dexp (13)
+ vexp : dexp '/' . vexp (26)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 43
+ vexp goto 44
+
+
+state 23
+ line : dexp '\n' . (3)
+
+ . reduce 3
+
+
+state 24
+ vexp : vexp '+' . vexp (19)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 45
+
+
+state 25
+ vexp : vexp '-' . vexp (21)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 46
+
+
+state 26
+ vexp : vexp '*' . vexp (23)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 47
+
+
+state 27
+ vexp : vexp '/' . vexp (25)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 48
+
+
+state 28
+ line : vexp '\n' . (4)
+
+ . reduce 4
+
+
+state 29
+ dexp : '-' . dexp (14)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 49
+
+
+state 30
+ dexp : '(' . dexp ')' (15)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 50
+
+
+state 31
+ line : DREG '=' dexp . '\n' (5)
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ '\n' shift 55
+ . error
+
+
+32: shift/reduce conflict (shift 19, reduce 16) on '+'
+32: shift/reduce conflict (shift 20, reduce 16) on '-'
+32: shift/reduce conflict (shift 21, reduce 16) on '*'
+32: shift/reduce conflict (shift 22, reduce 16) on '/'
+state 32
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' shift 19
+ '-' shift 20
+ '*' shift 21
+ '/' shift 22
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 33
+ line : VREG '=' vexp . '\n' (6)
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ '\n' shift 56
+ . error
+
+
+state 34
+ dexp : '(' dexp ')' . (15)
+
+ . reduce 15
+
+
+state 35
+ vexp : '(' dexp ',' . dexp ')' (17)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 57
+
+
+state 36
+ vexp : '(' vexp ')' . (28)
+
+ . reduce 28
+
+
+37: reduce/reduce conflict (reduce 10, reduce 16) on '+'
+37: reduce/reduce conflict (reduce 10, reduce 16) on '-'
+37: shift/reduce conflict (shift 21, reduce 16) on '*'
+37: shift/reduce conflict (shift 22, reduce 16) on '/'
+37: reduce/reduce conflict (reduce 10, reduce 16) on '\n'
+37: reduce/reduce conflict (reduce 10, reduce 16) on ')'
+state 37
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp '+' dexp . (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '*' shift 21
+ '/' shift 22
+ '+' reduce 10
+ '-' reduce 10
+ '\n' reduce 10
+ ')' reduce 10
+ ',' reduce 10
+
+
+state 38
+ vexp : vexp . '+' vexp (19)
+ vexp : dexp '+' vexp . (20)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 20
+ '-' reduce 20
+ '\n' reduce 20
+ ')' reduce 20
+
+
+39: reduce/reduce conflict (reduce 11, reduce 16) on '+'
+39: reduce/reduce conflict (reduce 11, reduce 16) on '-'
+39: shift/reduce conflict (shift 21, reduce 16) on '*'
+39: shift/reduce conflict (shift 22, reduce 16) on '/'
+39: reduce/reduce conflict (reduce 11, reduce 16) on '\n'
+39: reduce/reduce conflict (reduce 11, reduce 16) on ')'
+state 39
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp '-' dexp . (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '*' shift 21
+ '/' shift 22
+ '+' reduce 11
+ '-' reduce 11
+ '\n' reduce 11
+ ')' reduce 11
+ ',' reduce 11
+
+
+state 40
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : dexp '-' vexp . (22)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 22
+ '-' reduce 22
+ '\n' reduce 22
+ ')' reduce 22
+
+
+41: reduce/reduce conflict (reduce 12, reduce 16) on '+'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '-'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '*'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '/'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '\n'
+41: reduce/reduce conflict (reduce 12, reduce 16) on ')'
+state 41
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp '*' dexp . (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ . reduce 12
+
+
+state 42
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : dexp '*' vexp . (24)
+ vexp : vexp . '/' vexp (25)
+
+ . reduce 24
+
+
+43: reduce/reduce conflict (reduce 13, reduce 16) on '+'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '-'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '*'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '/'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '\n'
+43: reduce/reduce conflict (reduce 13, reduce 16) on ')'
+state 43
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : dexp '/' dexp . (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ . reduce 13
+
+
+state 44
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : dexp '/' vexp . (26)
+
+ . reduce 26
+
+
+state 45
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp '+' vexp . (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 19
+ '-' reduce 19
+ '\n' reduce 19
+ ')' reduce 19
+
+
+state 46
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp '-' vexp . (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 21
+ '-' reduce 21
+ '\n' reduce 21
+ ')' reduce 21
+
+
+state 47
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp '*' vexp . (23)
+ vexp : vexp . '/' vexp (25)
+
+ . reduce 23
+
+
+state 48
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : vexp '/' vexp . (25)
+
+ . reduce 25
+
+
+state 49
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '-' dexp . (14)
+
+ . reduce 14
+
+
+state 50
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '(' dexp . ')' (15)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ ')' shift 34
+ . error
+
+
+state 51
+ dexp : dexp '+' . dexp (10)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 58
+
+
+state 52
+ dexp : dexp '-' . dexp (11)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 59
+
+
+state 53
+ dexp : dexp '*' . dexp (12)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 60
+
+
+state 54
+ dexp : dexp '/' . dexp (13)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 61
+
+
+state 55
+ line : DREG '=' dexp '\n' . (5)
+
+ . reduce 5
+
+
+state 56
+ line : VREG '=' vexp '\n' . (6)
+
+ . reduce 6
+
+
+state 57
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : '(' dexp ',' dexp . ')' (17)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ ')' shift 62
+ . error
+
+
+state 58
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp '+' dexp . (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '*' shift 53
+ '/' shift 54
+ '+' reduce 10
+ '-' reduce 10
+ '\n' reduce 10
+ ')' reduce 10
+
+
+state 59
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp '-' dexp . (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '*' shift 53
+ '/' shift 54
+ '+' reduce 11
+ '-' reduce 11
+ '\n' reduce 11
+ ')' reduce 11
+
+
+state 60
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp '*' dexp . (12)
+ dexp : dexp . '/' dexp (13)
+
+ . reduce 12
+
+
+state 61
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : dexp '/' dexp . (13)
+
+ . reduce 13
+
+
+state 62
+ vexp : '(' dexp ',' dexp ')' . (17)
+
+ . reduce 17
+
+
+Rules never reduced:
+ lines : (1)
+ lines : lines line (2)
+
+
+State 8 contains 5 shift/reduce conflicts.
+State 15 contains 6 reduce/reduce conflicts.
+State 17 contains 5 shift/reduce conflicts.
+State 32 contains 4 shift/reduce conflicts.
+State 37 contains 2 shift/reduce conflicts, 4 reduce/reduce conflicts.
+State 39 contains 2 shift/reduce conflicts, 4 reduce/reduce conflicts.
+State 41 contains 6 reduce/reduce conflicts.
+State 43 contains 6 reduce/reduce conflicts.
+
+
+15 terminals, 5 nonterminals
+29 grammar rules, 63 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DREG
+ 3 258 VREG
+ 4 259 CONST
+ 5 43 '+'
+ 6 45 '-'
+ 7 42 '*'
+ 8 47 '/'
+ 9 260 UMINUS
+ 10 10 '\n'
+ 11 61 '='
+ 12 40 '('
+ 13 41 ')'
+ 14 44 ','
+ 15 261 $accept
+ 16 262 line
+ 17 263 dexp
+ 18 264 vexp
+ 19 265 lines
diff --git a/contrib/byacc/test/btyacc/calc1.tab.c b/contrib/byacc/test/btyacc/calc1.tab.c
new file mode 100644
index 000000000000..fd86a907aefd
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc1.tab.c
@@ -0,0 +1,1677 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse calc1_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex calc1_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror calc1_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar calc1_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval calc1_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval calc1_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug calc1_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs calc1_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag calc1_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs calc1_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen calc1_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred calc1_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos calc1_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto calc1_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex calc1_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex calc1_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex calc1_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable calc1_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck calc1_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname calc1_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule calc1_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex calc1_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable calc1_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "calc1_"
+
+#define YYPURE 0
+
+#line 2 "calc1.y"
+
+/* http://dinosaur.compilertools.net/yacc/index.html */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+
+typedef struct interval
+{
+ double lo, hi;
+}
+INTERVAL;
+
+INTERVAL vmul(double, double, INTERVAL);
+INTERVAL vdiv(double, double, INTERVAL);
+
+extern int yylex(void);
+static void yyerror(const char *s);
+
+int dcheck(INTERVAL);
+
+double dreg[26];
+INTERVAL vreg[26];
+
+#line 31 "calc1.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ int ival;
+ double dval;
+ INTERVAL vval;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 161 "calc1.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DREG 257
+#define VREG 258
+#define CONST 259
+#define UMINUS 260
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT calc1_lhs[] = { -1,
+ 3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+};
+static const YYINT calc1_len[] = { 2,
+ 0, 2, 2, 2, 4, 4, 2, 1, 1, 3,
+ 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 3,
+};
+static const YYINT calc1_defred[] = { 0,
+ 0, 0, 0, 8, 0, 0, 0, 0, 0, 7,
+ 0, 0, 9, 18, 14, 27, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 0, 4, 0, 0,
+ 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
+ 12, 24, 13, 26, 0, 0, 23, 25, 14, 0,
+ 0, 0, 0, 0, 5, 6, 0, 0, 0, 12,
+ 13, 17,
+};
+static const YYINT calc1_stos[] = { 0,
+ 256, 257, 258, 259, 45, 40, 262, 263, 264, 10,
+ 61, 61, 257, 258, 263, 264, 263, 264, 43, 45,
+ 42, 47, 10, 43, 45, 42, 47, 10, 45, 40,
+ 263, 263, 264, 41, 44, 41, 263, 264, 263, 264,
+ 263, 264, 263, 264, 264, 264, 264, 264, 263, 263,
+ 43, 45, 42, 47, 10, 10, 263, 263, 263, 263,
+ 263, 41,
+};
+static const YYINT calc1_dgoto[] = { 7,
+ 32, 9, 0,
+};
+static const YYINT calc1_sindex[] = { -40,
+ -8, -48, -47, 0, -37, -37, 0, 2, 17, 0,
+ -34, -37, 0, 0, 0, 0, -25, 90, -37, -37,
+ -37, -37, 0, -37, -37, -37, -37, 0, -34, -34,
+ 25, 125, 31, 0, -34, 0, -11, 37, -11, 37,
+ 0, 0, 0, 0, 37, 37, 0, 0, 0, 111,
+ -34, -34, -34, -34, 0, 0, 118, 69, 69, 0,
+ 0, 0,
+};
+static const YYINT calc1_rindex[] = { 0,
+ 0, 38, 44, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -9, 0, 0, 0, 0, 51, -3, 56, 61,
+ 0, 0, 0, 0, 67, 72, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 78, 83, 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT calc1_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT calc1_gindex[] = { 0,
+ 4, 124, 0,
+};
+#define YYTABLESIZE 225
+static const YYINT calc1_table[] = { 6,
+ 16, 10, 6, 8, 5, 30, 20, 5, 15, 17,
+ 29, 23, 11, 12, 31, 34, 21, 19, 35, 20,
+ 0, 22, 37, 39, 41, 43, 28, 0, 0, 0,
+ 21, 16, 49, 50, 55, 22, 0, 20, 57, 20,
+ 56, 20, 0, 21, 19, 0, 20, 9, 22, 0,
+ 0, 0, 0, 18, 58, 59, 60, 61, 26, 24,
+ 10, 25, 0, 27, 0, 11, 53, 51, 0, 52,
+ 22, 54, 26, 24, 0, 25, 19, 27, 26, 9,
+ 9, 21, 9, 27, 9, 18, 18, 10, 18, 0,
+ 18, 10, 11, 10, 10, 10, 11, 0, 11, 11,
+ 11, 22, 0, 22, 0, 22, 0, 19, 0, 19,
+ 53, 19, 21, 0, 21, 54, 21, 0, 10, 0,
+ 10, 0, 10, 11, 0, 11, 0, 11, 16, 18,
+ 36, 26, 24, 0, 25, 33, 27, 0, 0, 0,
+ 0, 0, 38, 40, 42, 44, 0, 45, 46, 47,
+ 48, 34, 53, 51, 0, 52, 0, 54, 62, 53,
+ 51, 0, 52, 0, 54, 0, 21, 19, 0, 20,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 3, 4, 13,
+ 14, 4, 13, 0, 4,
+};
+static const YYINT calc1_check[] = { 40,
+ 10, 10, 40, 0, 45, 40, 10, 45, 5, 6,
+ 45, 10, 61, 61, 11, 41, 42, 43, 44, 45,
+ -1, 47, 19, 20, 21, 22, 10, -1, -1, -1,
+ 42, 41, 29, 30, 10, 47, -1, 41, 35, 43,
+ 10, 45, -1, 42, 43, -1, 45, 10, 47, -1,
+ -1, -1, -1, 10, 51, 52, 53, 54, 42, 43,
+ 10, 45, -1, 47, -1, 10, 42, 43, -1, 45,
+ 10, 47, 42, 43, -1, 45, 10, 47, 42, 42,
+ 43, 10, 45, 47, 47, 42, 43, 10, 45, -1,
+ 47, 41, 10, 43, 44, 45, 41, -1, 43, 44,
+ 45, 41, -1, 43, -1, 45, -1, 41, -1, 43,
+ 42, 45, 41, -1, 43, 47, 45, -1, 41, -1,
+ 43, -1, 45, 41, -1, 43, -1, 45, 5, 6,
+ 41, 42, 43, -1, 45, 12, 47, -1, -1, -1,
+ -1, -1, 19, 20, 21, 22, -1, 24, 25, 26,
+ 27, 41, 42, 43, -1, 45, -1, 47, 41, 42,
+ 43, -1, 45, -1, 47, -1, 42, 43, -1, 45,
+ -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
+ 258, 259, 257, -1, 259,
+};
+#define YYFINAL 7
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 260
+#define YYUNDFTOKEN 266
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const calc1_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,
+0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+"error","DREG","VREG","CONST","UMINUS","$accept","line","dexp","vexp","lines",
+"illegal-symbol",
+};
+static const char *const calc1_rule[] = {
+"$accept : line",
+"lines :",
+"lines : lines line",
+"line : dexp '\\n'",
+"line : vexp '\\n'",
+"line : DREG '=' dexp '\\n'",
+"line : VREG '=' vexp '\\n'",
+"line : error '\\n'",
+"dexp : CONST",
+"dexp : DREG",
+"dexp : dexp '+' dexp",
+"dexp : dexp '-' dexp",
+"dexp : dexp '*' dexp",
+"dexp : dexp '/' dexp",
+"dexp : '-' dexp",
+"dexp : '(' dexp ')'",
+"vexp : dexp",
+"vexp : '(' dexp ',' dexp ')'",
+"vexp : VREG",
+"vexp : vexp '+' vexp",
+"vexp : dexp '+' vexp",
+"vexp : vexp '-' vexp",
+"vexp : dexp '-' vexp",
+"vexp : vexp '*' vexp",
+"vexp : dexp '*' vexp",
+"vexp : vexp '/' vexp",
+"vexp : dexp '/' vexp",
+"vexp : '-' vexp",
+"vexp : '(' vexp ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 176 "calc1.y"
+ /* beginning of subroutines section */
+
+#define BSZ 50 /* buffer size for floating point numbers */
+
+ /* lexical analysis */
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ int c;
+
+ while ((c = getchar()) == ' ')
+ { /* skip over blanks */
+ }
+
+ if (isupper(c))
+ {
+ yylval.ival = c - 'A';
+ return (VREG);
+ }
+ if (islower(c))
+ {
+ yylval.ival = c - 'a';
+ return (DREG);
+ }
+
+ if (isdigit(c) || c == '.')
+ {
+ /* gobble up digits, points, exponents */
+ char buf[BSZ + 1], *cp = buf;
+ int dot = 0, expr = 0;
+
+ for (; (cp - buf) < BSZ; ++cp, c = getchar())
+ {
+
+ *cp = (char) c;
+ if (isdigit(c))
+ continue;
+ if (c == '.')
+ {
+ if (dot++ || expr)
+ return ('.'); /* will cause syntax error */
+ continue;
+ }
+
+ if (c == 'e')
+ {
+ if (expr++)
+ return ('e'); /* will cause syntax error */
+ continue;
+ }
+
+ /* end of number */
+ break;
+ }
+ *cp = '\0';
+
+ if ((cp - buf) >= BSZ)
+ printf("constant too long: truncated\n");
+ else
+ ungetc(c, stdin); /* push back last char read */
+ yylval.dval = atof(buf);
+ return (CONST);
+ }
+ return (c);
+}
+
+static INTERVAL
+hilo(double a, double b, double c, double d)
+{
+ /* returns the smallest interval containing a, b, c, and d */
+ /* used by *, / routines */
+ INTERVAL v;
+
+ if (a > b)
+ {
+ v.hi = a;
+ v.lo = b;
+ }
+ else
+ {
+ v.hi = b;
+ v.lo = a;
+ }
+
+ if (c > d)
+ {
+ if (c > v.hi)
+ v.hi = c;
+ if (d < v.lo)
+ v.lo = d;
+ }
+ else
+ {
+ if (d > v.hi)
+ v.hi = d;
+ if (c < v.lo)
+ v.lo = c;
+ }
+ return (v);
+}
+
+INTERVAL
+vmul(double a, double b, INTERVAL v)
+{
+ return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
+}
+
+int
+dcheck(INTERVAL v)
+{
+ if (v.hi >= 0. && v.lo <= 0.)
+ {
+ printf("divisor interval contains 0.\n");
+ return (1);
+ }
+ return (0);
+}
+
+INTERVAL
+vdiv(double a, double b, INTERVAL v)
+{
+ return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
+}
+#line 623 "calc1.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 57 "calc1.y"
+ {
+ (void) printf("%15.8f\n", yystack.l_mark[-1].dval);
+ }
+break;
+case 4:
+#line 61 "calc1.y"
+ {
+ (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
+ }
+break;
+case 5:
+#line 65 "calc1.y"
+ {
+ dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
+ }
+break;
+case 6:
+#line 69 "calc1.y"
+ {
+ vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
+ }
+break;
+case 7:
+#line 73 "calc1.y"
+ {
+ yyerrok;
+ }
+break;
+case 9:
+#line 80 "calc1.y"
+ {
+ yyval.dval = dreg[yystack.l_mark[0].ival];
+ }
+break;
+case 10:
+#line 84 "calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
+ }
+break;
+case 11:
+#line 88 "calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
+ }
+break;
+case 12:
+#line 92 "calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
+ }
+break;
+case 13:
+#line 96 "calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
+ }
+break;
+case 14:
+#line 100 "calc1.y"
+ {
+ yyval.dval = -yystack.l_mark[0].dval;
+ }
+break;
+case 15:
+#line 104 "calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-1].dval;
+ }
+break;
+case 16:
+#line 110 "calc1.y"
+ {
+ yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
+ }
+break;
+case 17:
+#line 114 "calc1.y"
+ {
+ yyval.vval.lo = yystack.l_mark[-3].dval;
+ yyval.vval.hi = yystack.l_mark[-1].dval;
+ if ( yyval.vval.lo > yyval.vval.hi )
+ {
+ (void) printf("interval out of order\n");
+ YYERROR;
+ }
+ }
+break;
+case 18:
+#line 124 "calc1.y"
+ {
+ yyval.vval = vreg[yystack.l_mark[0].ival];
+ }
+break;
+case 19:
+#line 128 "calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 20:
+#line 133 "calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 21:
+#line 138 "calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 22:
+#line 143 "calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 23:
+#line 148 "calc1.y"
+ {
+ yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 24:
+#line 152 "calc1.y"
+ {
+ yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
+ }
+break;
+case 25:
+#line 156 "calc1.y"
+ {
+ if (dcheck(yystack.l_mark[0].vval)) YYERROR;
+ yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 26:
+#line 161 "calc1.y"
+ {
+ if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
+ yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
+ }
+break;
+case 27:
+#line 166 "calc1.y"
+ {
+ yyval.vval.hi = -yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = -yystack.l_mark[0].vval.hi;
+ }
+break;
+case 28:
+#line 171 "calc1.y"
+ {
+ yyval.vval = yystack.l_mark[-1].vval;
+ }
+break;
+#line 1443 "calc1.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/calc1.tab.h b/contrib/byacc/test/btyacc/calc1.tab.h
new file mode 100644
index 000000000000..1802350b0d2a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc1.tab.h
@@ -0,0 +1,23 @@
+#ifndef _calc1__defines_h_
+#define _calc1__defines_h_
+
+#define DREG 257
+#define VREG 258
+#define CONST 259
+#define UMINUS 260
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ int ival;
+ double dval;
+ INTERVAL vval;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE calc1_lval;
+
+#endif /* _calc1__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/calc2.error b/contrib/byacc/test/btyacc/calc2.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc2.error
diff --git a/contrib/byacc/test/btyacc/calc2.output b/contrib/byacc/test/btyacc/calc2.output
new file mode 100644
index 000000000000..c689eec0535a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc2.output
@@ -0,0 +1,485 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr '+' expr
+ 8 | expr '-' expr
+ 9 | expr '*' expr
+ 10 | expr '/' expr
+ 11 | expr '%' expr
+ 12 | expr '&' expr
+ 13 | expr '|' expr
+ 14 | '-' expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ DIGIT shift 3
+ LETTER shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 4
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 11
+ '|' reduce 15
+ '&' reduce 15
+ '+' reduce 15
+ '-' reduce 15
+ '*' reduce 15
+ '/' reduce 15
+ '%' reduce 15
+ '\n' reduce 15
+
+
+state 5
+ expr : '-' . expr (14)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 13
+ number goto 9
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ '|' reduce 16
+ '&' reduce 16
+ '+' reduce 16
+ '-' reduce 16
+ '*' reduce 16
+ '/' reduce 16
+ '%' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ stat : LETTER '=' . expr (5)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 12
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+state 13
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : '-' expr . (14)
+
+ . reduce 14
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr '|' . expr (13)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr '&' . expr (12)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr '+' . expr (7)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr '-' . expr (8)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr '*' . expr (9)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr '/' . expr (10)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '%' . expr (11)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+state 26
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+state 27
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr '&' expr . (12)
+ expr : expr . '|' expr (13)
+
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 12
+ '&' reduce 12
+ '\n' reduce 12
+ ')' reduce 12
+
+
+state 28
+ expr : expr . '+' expr (7)
+ expr : expr '+' expr . (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 7
+ '&' reduce 7
+ '+' reduce 7
+ '-' reduce 7
+ '\n' reduce 7
+ ')' reduce 7
+
+
+state 29
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr '-' expr . (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 8
+ '&' reduce 8
+ '+' reduce 8
+ '-' reduce 8
+ '\n' reduce 8
+ ')' reduce 8
+
+
+state 30
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr '*' expr . (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 9
+
+
+state 31
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr '/' expr . (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 10
+
+
+state 32
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr '%' expr . (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 11
+
+
+16 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DIGIT
+ 3 258 LETTER
+ 4 124 '|'
+ 5 38 '&'
+ 6 43 '+'
+ 7 45 '-'
+ 8 42 '*'
+ 9 47 '/'
+ 10 37 '%'
+ 11 259 UMINUS
+ 12 10 '\n'
+ 13 61 '='
+ 14 40 '('
+ 15 41 ')'
+ 16 260 $accept
+ 17 261 list
+ 18 262 stat
+ 19 263 expr
+ 20 264 number
diff --git a/contrib/byacc/test/btyacc/calc2.tab.c b/contrib/byacc/test/btyacc/calc2.tab.c
new file mode 100644
index 000000000000..73e295aae997
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc2.tab.c
@@ -0,0 +1,1444 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse calc2_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex calc2_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror calc2_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar calc2_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval calc2_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval calc2_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug calc2_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs calc2_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag calc2_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs calc2_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen calc2_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred calc2_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos calc2_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto calc2_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex calc2_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex calc2_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex calc2_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable calc2_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck calc2_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname calc2_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule calc2_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex calc2_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable calc2_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "calc2_"
+
+#define YYPURE 0
+
+#line 7 "calc2.y"
+# include <stdio.h>
+# include <ctype.h>
+
+#ifdef YYBISON
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 133 "calc2.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(int regs[26], int * base)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(int * base)
+# define YYLEX yylex(base)
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(regs, base, msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT calc2_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT calc2_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT calc2_defred[] = { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const YYINT calc2_stos[] = { 0,
+ 261, 256, 257, 258, 45, 40, 262, 263, 264, 10,
+ 61, 258, 263, 263, 10, 124, 38, 43, 45, 42,
+ 47, 37, 257, 263, 41, 263, 263, 263, 263, 263,
+ 263, 263,
+};
+static const YYINT calc2_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT calc2_sindex[] = { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const YYINT calc2_rindex[] = { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT calc2_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT calc2_gindex[] = { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const YYINT calc2_table[] = { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const YYINT calc2_check[] = { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#define YYUNDFTOKEN 265
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const calc2_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number",
+"illegal-symbol",
+};
+static const char *const calc2_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "calc2.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ int regs[26];
+ int base = 10;
+
+ while(!feof(stdin)) {
+ yyparse(regs, &base);
+ }
+ return 0;
+}
+
+#define UNUSED(x) ((void)(x))
+
+static void
+YYERROR_DECL()
+{
+ UNUSED(regs); /* %parse-param regs is not actually used here */
+ UNUSED(base); /* %parse-param base is not actually used here */
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = (c - '0') % (*base);
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 493 "calc2.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "calc2.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "calc2.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "calc2.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "calc2.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "calc2.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "calc2.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "calc2.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "calc2.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "calc2.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "calc2.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "calc2.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "calc2.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "calc2.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "calc2.y"
+ { yyval = yystack.l_mark[0]; (*base) = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "calc2.y"
+ { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1210 "calc2.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/calc2.tab.h b/contrib/byacc/test/btyacc/calc2.tab.h
new file mode 100644
index 000000000000..3f0ce8e79722
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc2.tab.h
@@ -0,0 +1,8 @@
+#ifndef _calc2__defines_h_
+#define _calc2__defines_h_
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+
+#endif /* _calc2__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/calc3.error b/contrib/byacc/test/btyacc/calc3.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc3.error
diff --git a/contrib/byacc/test/btyacc/calc3.output b/contrib/byacc/test/btyacc/calc3.output
new file mode 100644
index 000000000000..c689eec0535a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc3.output
@@ -0,0 +1,485 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr '+' expr
+ 8 | expr '-' expr
+ 9 | expr '*' expr
+ 10 | expr '/' expr
+ 11 | expr '%' expr
+ 12 | expr '&' expr
+ 13 | expr '|' expr
+ 14 | '-' expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ DIGIT shift 3
+ LETTER shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 4
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 11
+ '|' reduce 15
+ '&' reduce 15
+ '+' reduce 15
+ '-' reduce 15
+ '*' reduce 15
+ '/' reduce 15
+ '%' reduce 15
+ '\n' reduce 15
+
+
+state 5
+ expr : '-' . expr (14)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 13
+ number goto 9
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ '|' reduce 16
+ '&' reduce 16
+ '+' reduce 16
+ '-' reduce 16
+ '*' reduce 16
+ '/' reduce 16
+ '%' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ stat : LETTER '=' . expr (5)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 12
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+state 13
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : '-' expr . (14)
+
+ . reduce 14
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr '|' . expr (13)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr '&' . expr (12)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr '+' . expr (7)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr '-' . expr (8)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr '*' . expr (9)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr '/' . expr (10)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '%' . expr (11)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+state 26
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+state 27
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr '&' expr . (12)
+ expr : expr . '|' expr (13)
+
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 12
+ '&' reduce 12
+ '\n' reduce 12
+ ')' reduce 12
+
+
+state 28
+ expr : expr . '+' expr (7)
+ expr : expr '+' expr . (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 7
+ '&' reduce 7
+ '+' reduce 7
+ '-' reduce 7
+ '\n' reduce 7
+ ')' reduce 7
+
+
+state 29
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr '-' expr . (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 8
+ '&' reduce 8
+ '+' reduce 8
+ '-' reduce 8
+ '\n' reduce 8
+ ')' reduce 8
+
+
+state 30
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr '*' expr . (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 9
+
+
+state 31
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr '/' expr . (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 10
+
+
+state 32
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr '%' expr . (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 11
+
+
+16 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DIGIT
+ 3 258 LETTER
+ 4 124 '|'
+ 5 38 '&'
+ 6 43 '+'
+ 7 45 '-'
+ 8 42 '*'
+ 9 47 '/'
+ 10 37 '%'
+ 11 259 UMINUS
+ 12 10 '\n'
+ 13 61 '='
+ 14 40 '('
+ 15 41 ')'
+ 16 260 $accept
+ 17 261 list
+ 18 262 stat
+ 19 263 expr
+ 20 264 number
diff --git a/contrib/byacc/test/btyacc/calc3.tab.c b/contrib/byacc/test/btyacc/calc3.tab.c
new file mode 100644
index 000000000000..f1e4bc592587
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc3.tab.c
@@ -0,0 +1,1449 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse calc3_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex calc3_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror calc3_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar calc3_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval calc3_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval calc3_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug calc3_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs calc3_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag calc3_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs calc3_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen calc3_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred calc3_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos calc3_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto calc3_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex calc3_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex calc3_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex calc3_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable calc3_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck calc3_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname calc3_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule calc3_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex calc3_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable calc3_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "calc3_"
+
+#define YYPURE 1
+
+#line 9 "calc3.y"
+# include <stdio.h>
+# include <ctype.h>
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 134 "calc3.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(int regs[26], int * base)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
+# define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base)
+# define YYLEX yylex(&yylval, base)
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(regs, base, msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT calc3_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT calc3_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT calc3_defred[] = { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const YYINT calc3_stos[] = { 0,
+ 261, 256, 257, 258, 45, 40, 262, 263, 264, 10,
+ 61, 258, 263, 263, 10, 124, 38, 43, 45, 42,
+ 47, 37, 257, 263, 41, 263, 263, 263, 263, 263,
+ 263, 263,
+};
+static const YYINT calc3_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT calc3_sindex[] = { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const YYINT calc3_rindex[] = { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT calc3_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT calc3_gindex[] = { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const YYINT calc3_table[] = { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const YYINT calc3_check[] = { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#define YYUNDFTOKEN 265
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const calc3_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number",
+"illegal-symbol",
+};
+static const char *const calc3_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+#line 76 "calc3.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ int regs[26];
+ int base = 10;
+
+ while(!feof(stdin)) {
+ yyparse(regs, &base);
+ }
+ return 0;
+}
+
+#define UNUSED(x) ((void)(x))
+
+static void
+YYERROR_DECL()
+{
+ UNUSED(regs); /* %parse-param regs is not actually used here */
+ UNUSED(base); /* %parse-param base is not actually used here */
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ *yylval = (c - 'a');
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ *yylval = (c - '0') % (*base);
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 448 "calc3.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yyerrflag;
+ int yychar;
+ YYSTYPE yyval;
+ YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyloc; /* position returned by actions */
+ YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+ /* variables for the parser stack */
+ YYSTACKDATA yystack;
+#if YYBTYACC
+
+ /* Current parser state */
+ static YYParseState *yyps = 0;
+
+ /* yypath != NULL: do the full parse, starting at *yypath parser state. */
+ static YYParseState *yypath = 0;
+
+ /* Base of the lexical value queue */
+ static YYSTYPE *yylvals = 0;
+
+ /* Current position at lexical value queue */
+ static YYSTYPE *yylvp = 0;
+
+ /* End position of lexical value queue */
+ static YYSTYPE *yylve = 0;
+
+ /* The last allocated position at the lexical value queue */
+ static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* Base of the lexical position queue */
+ static YYLTYPE *yylpsns = 0;
+
+ /* Current position at lexical position queue */
+ static YYLTYPE *yylpp = 0;
+
+ /* End position of lexical position queue */
+ static YYLTYPE *yylpe = 0;
+
+ /* The last allocated position at the lexical position queue */
+ static YYLTYPE *yylplim = 0;
+#endif
+
+ /* Current position at lexical token queue */
+ static short *yylexp = 0;
+
+ static short *yylexemes = 0;
+#endif /* YYBTYACC */
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 38 "calc3.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 42 "calc3.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 44 "calc3.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 48 "calc3.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 50 "calc3.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 52 "calc3.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 54 "calc3.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 56 "calc3.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 58 "calc3.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 60 "calc3.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 62 "calc3.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 64 "calc3.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 66 "calc3.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 71 "calc3.y"
+ { yyval = yystack.l_mark[0]; (*base) = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 73 "calc3.y"
+ { yyval = (*base) * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1215 "calc3.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/calc3.tab.h b/contrib/byacc/test/btyacc/calc3.tab.h
new file mode 100644
index 000000000000..95fbe0b8dc02
--- /dev/null
+++ b/contrib/byacc/test/btyacc/calc3.tab.h
@@ -0,0 +1,8 @@
+#ifndef _calc3__defines_h_
+#define _calc3__defines_h_
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+
+#endif /* _calc3__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/code_calc.code.c b/contrib/byacc/test/btyacc/code_calc.code.c
new file mode 100644
index 000000000000..e69ccede6f57
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_calc.code.c
@@ -0,0 +1,1328 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse calc_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex calc_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror calc_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar calc_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval calc_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval calc_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug calc_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs calc_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag calc_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs calc_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen calc_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred calc_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos calc_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto calc_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex calc_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex calc_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex calc_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable calc_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck calc_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname calc_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule calc_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex calc_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable calc_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "calc_"
+
+#define YYPURE 0
+
+#line 2 "code_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *s);
+#endif
+
+#line 133 "code_calc.code.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+#define YYTABLESIZE 220
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#define YYUNDFTOKEN 265
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+
+extern int YYPARSE_DECL();
+typedef short YYINT;
+extern const YYINT yylhs[];
+extern const YYINT yylen[];
+extern const YYINT yydefred[];
+extern const YYINT yystos[];
+extern const YYINT yydgoto[];
+extern const YYINT yysindex[];
+extern const YYINT yyrindex[];
+#if YYBTYACC
+extern const YYINT yycindex[];
+#endif /* YYBTYACC */
+extern const YYINT yygindex[];
+extern const YYINT yytable[];
+extern const YYINT yycheck[];
+#if YYBTYACC
+extern const YYINT yyctable[];
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+extern const char *const yyname[];
+extern const char *const yyrule[];
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 68 "code_calc.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 377 "code_calc.code.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 30 "code_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 34 "code_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 36 "code_calc.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 40 "code_calc.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 42 "code_calc.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 44 "code_calc.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 46 "code_calc.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 48 "code_calc.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 50 "code_calc.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 52 "code_calc.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 54 "code_calc.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 56 "code_calc.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 58 "code_calc.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 63 "code_calc.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 65 "code_calc.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1094 "code_calc.code.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/code_calc.error b/contrib/byacc/test/btyacc/code_calc.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_calc.error
diff --git a/contrib/byacc/test/btyacc/code_calc.output b/contrib/byacc/test/btyacc/code_calc.output
new file mode 100644
index 000000000000..c689eec0535a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_calc.output
@@ -0,0 +1,485 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr '+' expr
+ 8 | expr '-' expr
+ 9 | expr '*' expr
+ 10 | expr '/' expr
+ 11 | expr '%' expr
+ 12 | expr '&' expr
+ 13 | expr '|' expr
+ 14 | '-' expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ DIGIT shift 3
+ LETTER shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 4
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 11
+ '|' reduce 15
+ '&' reduce 15
+ '+' reduce 15
+ '-' reduce 15
+ '*' reduce 15
+ '/' reduce 15
+ '%' reduce 15
+ '\n' reduce 15
+
+
+state 5
+ expr : '-' . expr (14)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 13
+ number goto 9
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ '|' reduce 16
+ '&' reduce 16
+ '+' reduce 16
+ '-' reduce 16
+ '*' reduce 16
+ '/' reduce 16
+ '%' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ stat : LETTER '=' . expr (5)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 12
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+state 13
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : '-' expr . (14)
+
+ . reduce 14
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr '|' . expr (13)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr '&' . expr (12)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr '+' . expr (7)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr '-' . expr (8)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr '*' . expr (9)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr '/' . expr (10)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '%' . expr (11)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+state 26
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+state 27
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr '&' expr . (12)
+ expr : expr . '|' expr (13)
+
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 12
+ '&' reduce 12
+ '\n' reduce 12
+ ')' reduce 12
+
+
+state 28
+ expr : expr . '+' expr (7)
+ expr : expr '+' expr . (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 7
+ '&' reduce 7
+ '+' reduce 7
+ '-' reduce 7
+ '\n' reduce 7
+ ')' reduce 7
+
+
+state 29
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr '-' expr . (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 8
+ '&' reduce 8
+ '+' reduce 8
+ '-' reduce 8
+ '\n' reduce 8
+ ')' reduce 8
+
+
+state 30
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr '*' expr . (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 9
+
+
+state 31
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr '/' expr . (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 10
+
+
+state 32
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr '%' expr . (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 11
+
+
+16 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DIGIT
+ 3 258 LETTER
+ 4 124 '|'
+ 5 38 '&'
+ 6 43 '+'
+ 7 45 '-'
+ 8 42 '*'
+ 9 47 '/'
+ 10 37 '%'
+ 11 259 UMINUS
+ 12 10 '\n'
+ 13 61 '='
+ 14 40 '('
+ 15 41 ')'
+ 16 260 $accept
+ 17 261 list
+ 18 262 stat
+ 19 263 expr
+ 20 264 number
diff --git a/contrib/byacc/test/btyacc/code_calc.tab.c b/contrib/byacc/test/btyacc/code_calc.tab.c
new file mode 100644
index 000000000000..9ac746a508e9
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_calc.tab.c
@@ -0,0 +1,137 @@
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+typedef short YYINT;
+const YYINT calc_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+const YYINT calc_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+const YYINT calc_defred[] = { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+const YYINT calc_stos[] = { 0,
+ 261, 256, 257, 258, 45, 40, 262, 263, 264, 10,
+ 61, 258, 263, 263, 10, 124, 38, 43, 45, 42,
+ 47, 37, 257, 263, 41, 263, 263, 263, 263, 263,
+ 263, 263,
+};
+const YYINT calc_dgoto[] = { 1,
+ 7, 8, 9,
+};
+const YYINT calc_sindex[] = { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+const YYINT calc_rindex[] = { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+#if YYBTYACC
+const YYINT calc_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+const YYINT calc_gindex[] = { 0,
+ 0, 65, 0,
+};
+const YYINT calc_table[] = { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+const YYINT calc_check[] = { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#if YYDEBUG
+const char *const calc_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number",
+"illegal-symbol",
+};
+const char *const calc_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
diff --git a/contrib/byacc/test/btyacc/code_calc.tab.h b/contrib/byacc/test/btyacc/code_calc.tab.h
new file mode 100644
index 000000000000..48f8993b83f6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_calc.tab.h
@@ -0,0 +1,8 @@
+#ifndef _calc__defines_h_
+#define _calc__defines_h_
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+
+#endif /* _calc__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/code_debug.c b/contrib/byacc/test/btyacc/code_debug.c
new file mode 100644
index 000000000000..bf002572304b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_debug.c
@@ -0,0 +1,1125 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+#line 20 "code_debug.c"
+#include "rename_debug.i"
+#include "rename_debug.h"
+typedef short YYINT;
+static const YYINT yylhs[] = { -1,
+ 0,
+};
+static const YYINT yylen[] = { 2,
+ 1,
+};
+static const YYINT yydefred[] = { 0,
+ 1, 0,
+};
+static const YYINT yystos[] = { 0,
+ 256, 258,
+};
+static const YYINT yydgoto[] = { 2,
+};
+static const YYINT yysindex[] = { -256,
+ 0, 0,
+};
+static const YYINT yyrindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT yycindex[] = { 0,
+ 0, 0,
+};
+#endif
+static const YYINT yygindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT yytable[] = { 1,
+};
+static const YYINT yycheck[] = { 256,
+};
+#if YYBTYACC
+static const YYINT yyctable[] = { 0,
+};
+#endif
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 1
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const yyname[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
+};
+static const char *const yyrule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 12 "code_debug.y"
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 236 "code_debug.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/code_debug.error b/contrib/byacc/test/btyacc/code_debug.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_debug.error
diff --git a/contrib/byacc/test/btyacc/code_debug.h b/contrib/byacc/test/btyacc/code_debug.h
new file mode 100644
index 000000000000..ba44e7d75a77
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_debug.h
@@ -0,0 +1,6 @@
+#ifndef _yy_defines_h_
+#define _yy_defines_h_
+
+#define YYERRCODE 256
+
+#endif /* _yy_defines_h_ */
diff --git a/contrib/byacc/test/btyacc/code_debug.i b/contrib/byacc/test/btyacc/code_debug.i
new file mode 100644
index 000000000000..b8f2144e197f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_debug.i
@@ -0,0 +1,60 @@
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "code_debug.y"
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+extern int yydebug;
+extern int yynerrs;
+
+extern int yyerrflag;
+extern int yychar;
+extern YYSTYPE yyval;
+extern YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+extern YYLTYPE yyloc; /* position returned by actions */
+extern YYLTYPE yylloc; /* position from the lexer */
+#endif
diff --git a/contrib/byacc/test/btyacc/code_debug.output b/contrib/byacc/test/btyacc/code_debug.output
new file mode 100644
index 000000000000..1e56c214a6cc
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_debug.output
@@ -0,0 +1,34 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+2 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 $accept
+ 3 258 S
diff --git a/contrib/byacc/test/btyacc/code_error.code.c b/contrib/byacc/test/btyacc/code_error.code.c
new file mode 100644
index 000000000000..5fceee5075ae
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_error.code.c
@@ -0,0 +1,1239 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse error_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex error_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror error_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar error_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval error_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval error_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug error_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs error_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag error_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs error_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen error_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred error_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos error_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto error_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex error_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex error_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex error_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable error_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck error_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname error_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule error_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex error_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable error_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "error_"
+
+#define YYPURE 0
+
+#line 2 "code_error.y"
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+#line 128 "code_error.code.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+#define YYERRCODE 256
+#define YYTABLESIZE 0
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+
+extern int YYPARSE_DECL();
+typedef short YYINT;
+extern const YYINT yylhs[];
+extern const YYINT yylen[];
+extern const YYINT yydefred[];
+extern const YYINT yystos[];
+extern const YYINT yydgoto[];
+extern const YYINT yysindex[];
+extern const YYINT yyrindex[];
+#if YYBTYACC
+extern const YYINT yycindex[];
+#endif /* YYBTYACC */
+extern const YYINT yygindex[];
+extern const YYINT yytable[];
+extern const YYINT yycheck[];
+#if YYBTYACC
+extern const YYINT yyctable[];
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+extern const char *const yyname[];
+extern const char *const yyrule[];
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 12 "code_error.y"
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 349 "code_error.code.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/code_error.error b/contrib/byacc/test/btyacc/code_error.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_error.error
diff --git a/contrib/byacc/test/btyacc/code_error.output b/contrib/byacc/test/btyacc/code_error.output
new file mode 100644
index 000000000000..1e56c214a6cc
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_error.output
@@ -0,0 +1,34 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+2 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 $accept
+ 3 258 S
diff --git a/contrib/byacc/test/btyacc/code_error.tab.c b/contrib/byacc/test/btyacc/code_error.tab.c
new file mode 100644
index 000000000000..3a66ac6ad6e7
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_error.tab.c
@@ -0,0 +1,55 @@
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+typedef short YYINT;
+const YYINT error_lhs[] = { -1,
+ 0,
+};
+const YYINT error_len[] = { 2,
+ 1,
+};
+const YYINT error_defred[] = { 0,
+ 1, 0,
+};
+const YYINT error_stos[] = { 0,
+ 256, 258,
+};
+const YYINT error_dgoto[] = { 2,
+};
+const YYINT error_sindex[] = { -256,
+ 0, 0,
+};
+const YYINT error_rindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+const YYINT error_cindex[] = { 0,
+ 0, 0,
+};
+#endif
+const YYINT error_gindex[] = { 0,
+};
+const YYINT error_table[] = { 1,
+};
+const YYINT error_check[] = { 256,
+};
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#if YYDEBUG
+const char *const error_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
+};
+const char *const error_rule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
diff --git a/contrib/byacc/test/btyacc/code_error.tab.h b/contrib/byacc/test/btyacc/code_error.tab.h
new file mode 100644
index 000000000000..f9e5ad278cc4
--- /dev/null
+++ b/contrib/byacc/test/btyacc/code_error.tab.h
@@ -0,0 +1,5 @@
+#ifndef _error__defines_h_
+#define _error__defines_h_
+
+
+#endif /* _error__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/empty.error b/contrib/byacc/test/btyacc/empty.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/empty.error
diff --git a/contrib/byacc/test/btyacc/empty.output b/contrib/byacc/test/btyacc/empty.output
new file mode 100644
index 000000000000..bb2b6a9e348c
--- /dev/null
+++ b/contrib/byacc/test/btyacc/empty.output
@@ -0,0 +1,28 @@
+ 0 $accept : start $end
+
+ 1 start :
+
+state 0
+ $accept : . start $end (0)
+ start : . (1)
+
+ . reduce 1
+
+ start goto 1
+
+
+state 1
+ $accept : start . $end (0)
+
+ $end accept
+
+
+2 terminals, 2 nonterminals
+2 grammar rules, 2 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 $accept
+ 3 258 start
diff --git a/contrib/byacc/test/btyacc/empty.tab.c b/contrib/byacc/test/btyacc/empty.tab.c
new file mode 100644
index 000000000000..cb487f743871
--- /dev/null
+++ b/contrib/byacc/test/btyacc/empty.tab.c
@@ -0,0 +1,1254 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse empty_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex empty_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror empty_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar empty_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval empty_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval empty_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug empty_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs empty_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag empty_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs empty_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen empty_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred empty_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos empty_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto empty_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex empty_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex empty_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex empty_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable empty_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck empty_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname empty_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule empty_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex empty_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable empty_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "empty_"
+
+#define YYPURE 0
+
+#line 2 "empty.y"
+#ifdef YYBISON
+#define YYLEX_DECL() yylex(void)
+#define YYERROR_DECL() yyerror(const char *s)
+static int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+#line 128 "empty.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT empty_lhs[] = { -1,
+ 0,
+};
+static const YYINT empty_len[] = { 2,
+ 0,
+};
+static const YYINT empty_defred[] = { 1,
+ 0,
+};
+static const YYINT empty_stos[] = { 0,
+ 258,
+};
+static const YYINT empty_dgoto[] = { 1,
+};
+static const YYINT empty_sindex[] = { 0,
+ 0,
+};
+static const YYINT empty_rindex[] = { 0,
+ 0,
+};
+#if YYBTYACC
+static const YYINT empty_cindex[] = { 0,
+ 0,
+};
+#endif
+static const YYINT empty_gindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT empty_table[] = { 0,
+};
+static const YYINT empty_check[] = { -1,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const empty_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","start",
+"illegal-symbol",
+};
+static const char *const empty_rule[] = {
+"$accept : start",
+"start :",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 13 "empty.y"
+
+#include <stdio.h>
+
+static int
+YYLEX_DECL() {
+ return -1;
+}
+
+static void
+YYERROR_DECL() {
+ printf("%s\n",s);
+}
+#line 364 "empty.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/empty.tab.h b/contrib/byacc/test/btyacc/empty.tab.h
new file mode 100644
index 000000000000..14683cfeab20
--- /dev/null
+++ b/contrib/byacc/test/btyacc/empty.tab.h
@@ -0,0 +1,5 @@
+#ifndef _empty__defines_h_
+#define _empty__defines_h_
+
+
+#endif /* _empty__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_inherit1.error b/contrib/byacc/test/btyacc/err_inherit1.error
new file mode 100644
index 000000000000..1d662b649485
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit1.error
@@ -0,0 +1,3 @@
+YACC: e - line 64 of "./test/err_inherit1.y", unterminated argument list
+namelist($c, $t
+ ^
diff --git a/contrib/byacc/test/btyacc/err_inherit1.output b/contrib/byacc/test/btyacc/err_inherit1.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit1.output
diff --git a/contrib/byacc/test/btyacc/err_inherit1.tab.c b/contrib/byacc/test/btyacc/err_inherit1.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit1.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_inherit1.tab.h b/contrib/byacc/test/btyacc/err_inherit1.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit1.tab.h
diff --git a/contrib/byacc/test/btyacc/err_inherit2.error b/contrib/byacc/test/btyacc/err_inherit2.error
new file mode 100644
index 000000000000..a3fa54a4ff73
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit2.error
@@ -0,0 +1,5 @@
+YACC: w - line 64 of "./test/err_inherit2.y", number of arguments of namelist doesn't agree with previous declaration
+YACC: w - line 64 of "./test/err_inherit2.y", type of argument 1 to namelist doesn't agree with previous declaration
+YACC: e - line 64 of "./test/err_inherit2.y", bad formal argument list
+namelist($<tval>c, $t, extra): namelist NAME
+ ^
diff --git a/contrib/byacc/test/btyacc/err_inherit2.output b/contrib/byacc/test/btyacc/err_inherit2.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit2.output
diff --git a/contrib/byacc/test/btyacc/err_inherit2.tab.c b/contrib/byacc/test/btyacc/err_inherit2.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit2.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_inherit2.tab.h b/contrib/byacc/test/btyacc/err_inherit2.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit2.tab.h
diff --git a/contrib/byacc/test/btyacc/err_inherit3.error b/contrib/byacc/test/btyacc/err_inherit3.error
new file mode 100644
index 000000000000..6e27dd0504c5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit3.error
@@ -0,0 +1,23 @@
+YACC: w - line 64 of "./test/err_inherit3.y", number of arguments of namelist doesn't agree with previous declaration
+YACC: w - line 64 of "./test/err_inherit3.y", wrong number of arguments for namelist
+namelist: namelist($c) NAME
+ ^
+YACC: w - line 64 of "./test/err_inherit3.y", unknown argument $c
+YACC: w - line 64 of "./test/err_inherit3.y", untyped argument $c
+YACC: w - line 65 of "./test/err_inherit3.y", unknown argument $t
+ { $$->s = mksymbol($<tval>t, $<cval>c, $2);
+ ^
+YACC: w - line 65 of "./test/err_inherit3.y", unknown argument $c
+ { $$->s = mksymbol($<tval>t, $<cval>c, $2);
+ ^
+YACC: w - line 69 of "./test/err_inherit3.y", unknown argument $t
+ { $$->s = mksymbol($t, $c, $1);
+ ^
+YACC: w - line 69 of "./test/err_inherit3.y", untyped argument $t
+YACC: w - line 69 of "./test/err_inherit3.y", unknown argument $c
+ { $$->s = mksymbol($t, $c, $1);
+ ^
+YACC: w - line 69 of "./test/err_inherit3.y", untyped argument $c
+YACC: w - line 0 of "./test/err_inherit3.y", start symbol declaration requires arguments
+YACC: 1 rule never reduced
+YACC: 3 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/err_inherit3.output b/contrib/byacc/test/btyacc/err_inherit3.output
new file mode 100644
index 000000000000..16ea531b89db
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit3.output
@@ -0,0 +1,229 @@
+ 0 $accept : declaration $end
+
+ 1 $$1 :
+
+ 2 $$2 :
+
+ 3 declaration : class type $$1 $$2 namelist
+
+ 4 $$3 :
+
+ 5 declaration : type $$3 locnamelist
+
+ 6 class : GLOBAL
+ 7 | LOCAL
+
+ 8 type : REAL
+ 9 | INTEGER
+
+ 10 $$4 :
+
+ 11 namelist : $$4 namelist NAME
+ 12 | NAME
+
+ 13 $$5 :
+
+ 14 locnamelist : $$5 $$2 namelist
+
+state 0
+ $accept : . declaration $end (0)
+
+ GLOBAL shift 1
+ LOCAL shift 2
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ declaration goto 5
+ class goto 6
+ type goto 7
+
+
+state 1
+ class : GLOBAL . (6)
+
+ . reduce 6
+
+
+state 2
+ class : LOCAL . (7)
+
+ . reduce 7
+
+
+state 3
+ type : REAL . (8)
+
+ . reduce 8
+
+
+state 4
+ type : INTEGER . (9)
+
+ . reduce 9
+
+
+state 5
+ $accept : declaration . $end (0)
+
+ $end accept
+
+
+state 6
+ declaration : class . type $$1 $$2 namelist (3)
+
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ type goto 8
+
+
+state 7
+ declaration : type . $$3 locnamelist (5)
+ $$3 : . (4)
+
+ . reduce 4
+
+ $$3 goto 9
+
+
+state 8
+ declaration : class type . $$1 $$2 namelist (3)
+ $$1 : . (1)
+
+ . reduce 1
+
+ $$1 goto 10
+
+
+state 9
+ declaration : type $$3 . locnamelist (5)
+ $$5 : . (13)
+
+ . reduce 13
+
+ locnamelist goto 11
+ $$5 goto 12
+
+
+state 10
+ declaration : class type $$1 . $$2 namelist (3)
+ $$2 : . (2)
+
+ . reduce 2
+
+ $$2 goto 13
+
+
+state 11
+ declaration : type $$3 locnamelist . (5)
+
+ . reduce 5
+
+
+state 12
+ locnamelist : $$5 . $$2 namelist (14)
+ $$2 : . (2)
+
+ . reduce 2
+
+ $$2 goto 14
+
+
+13: shift/reduce conflict (shift 15, reduce 10) on NAME
+state 13
+ declaration : class type $$1 $$2 . namelist (3)
+ $$4 : . (10)
+
+ NAME shift 15
+
+ namelist goto 16
+ $$4 goto 17
+
+
+14: shift/reduce conflict (shift 15, reduce 10) on NAME
+state 14
+ locnamelist : $$5 $$2 . namelist (14)
+ $$4 : . (10)
+
+ NAME shift 15
+
+ namelist goto 18
+ $$4 goto 17
+
+
+state 15
+ namelist : NAME . (12)
+
+ . reduce 12
+
+
+state 16
+ declaration : class type $$1 $$2 namelist . (3)
+
+ . reduce 3
+
+
+17: shift/reduce conflict (shift 15, reduce 10) on NAME
+state 17
+ namelist : $$4 . namelist NAME (11)
+ $$4 : . (10)
+
+ NAME shift 15
+
+ namelist goto 19
+ $$4 goto 17
+
+
+state 18
+ locnamelist : $$5 $$2 namelist . (14)
+
+ . reduce 14
+
+
+state 19
+ namelist : $$4 namelist . NAME (11)
+
+ NAME shift 20
+ . error
+
+
+state 20
+ namelist : $$4 namelist NAME . (11)
+
+ . reduce 11
+
+
+Rules never reduced:
+ $$4 : (10)
+
+
+State 13 contains 1 shift/reduce conflict.
+State 14 contains 1 shift/reduce conflict.
+State 17 contains 1 shift/reduce conflict.
+
+
+7 terminals, 11 nonterminals
+15 grammar rules, 21 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 GLOBAL
+ 3 258 LOCAL
+ 4 259 REAL
+ 5 260 INTEGER
+ 6 261 NAME
+ 7 262 $accept
+ 8 263 declaration
+ 9 264 namelist
+ 10 265 locnamelist
+ 11 266 class
+ 12 267 type
+ 13 268 $$1
+ 14 269 $$2
+ 15 270 $$3
+ 16 271 $$4
+ 17 272 $$5
diff --git a/contrib/byacc/test/btyacc/err_inherit3.tab.c b/contrib/byacc/test/btyacc/err_inherit3.tab.c
new file mode 100644
index 000000000000..58b317710b46
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit3.tab.c
@@ -0,0 +1,1414 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse err_inherit3_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex err_inherit3_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror err_inherit3_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar err_inherit3_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval err_inherit3_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval err_inherit3_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug err_inherit3_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs err_inherit3_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag err_inherit3_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs err_inherit3_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen err_inherit3_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred err_inherit3_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos err_inherit3_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto err_inherit3_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex err_inherit3_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex err_inherit3_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex err_inherit3_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable err_inherit3_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck err_inherit3_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname err_inherit3_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule err_inherit3_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex err_inherit3_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable err_inherit3_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "err_inherit3_"
+
+#define YYPURE 0
+
+#line 2 "err_inherit3.y"
+#include <stdlib.h>
+
+typedef enum {cGLOBAL, cLOCAL} class;
+typedef enum {tREAL, tINTEGER} type;
+typedef char * name;
+
+struct symbol { class c; type t; name id; };
+typedef struct symbol symbol;
+
+struct namelist { symbol *s; struct namelist *next; };
+typedef struct namelist namelist;
+
+extern symbol *mksymbol(type t, class c, name id);
+
+#ifdef YYBISON
+#define YYLEX_DECL() yylex(void)
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#line 39 "err_inherit3.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 155 "err_inherit3.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+#ifndef YYDESTRUCT_DECL
+#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val)
+#endif
+#ifndef YYDESTRUCT_CALL
+#define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT err_inherit3_lhs[] = { -1,
+ 5, 6, 0, 7, 0, 3, 3, 4, 4, 8,
+ 1, 1, 9, 2,
+};
+static const YYINT err_inherit3_len[] = { 2,
+ 0, 0, 5, 0, 3, 1, 1, 1, 1, 0,
+ 3, 1, 0, 3,
+};
+static const YYINT err_inherit3_defred[] = { 0,
+ 6, 7, 8, 9, 0, 0, 4, 1, 13, 2,
+ 5, 2, 0, 0, 12, 3, 0, 14, 0, 11,
+};
+static const YYINT err_inherit3_stos[] = { 0,
+ 257, 258, 259, 260, 263, 266, 267, 267, 270, 268,
+ 265, 272, 269, 269, 261, 264, 271, 264, 264, 261,
+};
+static const YYINT err_inherit3_dgoto[] = { 5,
+ 16, 11, 6, 7, 10, 13, 9, 17, 12,
+};
+static const YYINT err_inherit3_sindex[] = { -257,
+ 0, 0, 0, 0, 0, -254, 0, 0, 0, 0,
+ 0, 0, -253, -253, 0, 0, -253, 0, -252, 0,
+};
+static const YYINT err_inherit3_rindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+#if YYBTYACC
+static const YYINT err_inherit3_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+#endif
+static const YYINT err_inherit3_gindex[] = { 0,
+ -10, 0, 0, 4, 0, -1, 0, 0, 0,
+};
+#define YYTABLESIZE 11
+static const YYINT err_inherit3_table[] = { 1,
+ 2, 3, 4, 18, 3, 4, 19, 15, 20, 8,
+ 14,
+};
+static const YYINT err_inherit3_check[] = { 257,
+ 258, 259, 260, 14, 259, 260, 17, 261, 261, 6,
+ 12,
+};
+#define YYFINAL 5
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 261
+#define YYUNDFTOKEN 273
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const err_inherit3_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
+"NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
+"$$2","$$3","$$4","$$5","illegal-symbol",
+};
+static const char *const err_inherit3_rule[] = {
+"$accept : declaration",
+"$$1 :",
+"$$2 :",
+"declaration : class type $$1 $$2 namelist",
+"$$3 :",
+"declaration : type $$3 locnamelist",
+"class : GLOBAL",
+"class : LOCAL",
+"type : REAL",
+"type : INTEGER",
+"$$4 :",
+"namelist : $$4 namelist NAME",
+"namelist : NAME",
+"$$5 :",
+"locnamelist : $$5 $$2 namelist",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 78 "err_inherit3.y"
+
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+#line 415 "err_inherit3.tab.c"
+
+/* Release memory associated with symbol. */
+#if ! defined YYDESTRUCT_IS_DECLARED
+static void
+YYDESTRUCT_DECL()
+{
+ switch (psymb)
+ {
+ case 263:
+#line 30 "err_inherit3.y"
+ {
+ namelist *p = (*val).nlist;
+ while (p != NULL)
+ { namelist *pp = p;
+ p = p->next;
+ free(pp->s); free(pp);
+ }
+ }
+ break;
+#line 435 "err_inherit3.tab.c"
+ case 264:
+#line 30 "err_inherit3.y"
+ {
+ namelist *p = (*val).nlist;
+ while (p != NULL)
+ { namelist *pp = p;
+ p = p->next;
+ free(pp->s); free(pp);
+ }
+ }
+ break;
+#line 447 "err_inherit3.tab.c"
+ case 265:
+#line 30 "err_inherit3.y"
+ {
+ namelist *p = (*val).nlist;
+ while (p != NULL)
+ { namelist *pp = p;
+ p = p->next;
+ free(pp->s); free(pp);
+ }
+ }
+ break;
+#line 459 "err_inherit3.tab.c"
+ }
+}
+#define YYDESTRUCT_IS_DECLARED 1
+#endif
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 50 "err_inherit3.y"
+yyval.cval = yystack.l_mark[-1].cval;
+break;
+case 2:
+#line 50 "err_inherit3.y"
+yyval.tval = yystack.l_mark[-1].tval;
+break;
+case 3:
+#line 51 "err_inherit3.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 4:
+#line 52 "err_inherit3.y"
+yyval.tval = yystack.l_mark[0].tval;
+break;
+case 5:
+#line 53 "err_inherit3.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 6:
+#line 56 "err_inherit3.y"
+ { yyval.cval = cGLOBAL; }
+break;
+case 7:
+#line 57 "err_inherit3.y"
+ { yyval.cval = cLOCAL; }
+break;
+case 8:
+#line 60 "err_inherit3.y"
+ { yyval.tval = tREAL; }
+break;
+case 9:
+#line 61 "err_inherit3.y"
+ { yyval.tval = tINTEGER; }
+break;
+case 10:
+#line 64 "err_inherit3.y"
+yyval.cval = yystack.l_mark[-2];
+break;
+case 11:
+#line 65 "err_inherit3.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-5].tval, yystack.l_mark[-5].cval, yystack.l_mark[0].id);
+ yyval.nlist->next = yystack.l_mark[-1].nlist;
+ }
+break;
+case 12:
+#line 69 "err_inherit3.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-3], yystack.l_mark[-3], yystack.l_mark[0].id);
+ yyval.nlist->next = NULL;
+ }
+break;
+case 13:
+#line 74 "err_inherit3.y"
+yyval.cval = cLOCAL;
+break;
+case 14:
+#line 75 "err_inherit3.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+#line 1180 "err_inherit3.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/err_inherit3.tab.h b/contrib/byacc/test/btyacc/err_inherit3.tab.h
new file mode 100644
index 000000000000..5fa781de315b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit3.tab.h
@@ -0,0 +1,25 @@
+#ifndef _err_inherit3__defines_h_
+#define _err_inherit3__defines_h_
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE err_inherit3_lval;
+
+#endif /* _err_inherit3__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_inherit4.error b/contrib/byacc/test/btyacc/err_inherit4.error
new file mode 100644
index 000000000000..00eb9890a533
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit4.error
@@ -0,0 +1,13 @@
+YACC: w - line 32 of "./test/err_inherit4.y", destructor redeclared
+%destructor {
+ ^
+YACC: w - line 77 of "./test/err_inherit4.y", wrong number of default arguments for namelist
+ { $$ = $1; @$ = @2; }
+ ^
+YACC: w - line 77 of "./test/err_inherit4.y", wrong type for default argument 2 to namelist
+ { $$ = $1; @$ = @2; }
+ ^
+YACC: w - line 77 of "./test/err_inherit4.y", wrong type for default argument 1 to namelist
+ { $$ = $1; @$ = @2; }
+ ^
+YACC: w - line 77 of "./test/err_inherit4.y", @2 references beyond the end of the current rule
diff --git a/contrib/byacc/test/btyacc/err_inherit4.output b/contrib/byacc/test/btyacc/err_inherit4.output
new file mode 100644
index 000000000000..f52c287694b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit4.output
@@ -0,0 +1,178 @@
+ 0 $accept : declaration $end
+
+ 1 $$1 :
+
+ 2 $$2 :
+
+ 3 declaration : class type $$1 $$2 namelist
+
+ 4 $$3 :
+
+ 5 declaration : type $$3 locnamelist
+
+ 6 class : GLOBAL
+ 7 | LOCAL
+
+ 8 type : REAL
+ 9 | INTEGER
+
+ 10 namelist : namelist NAME
+ 11 | NAME
+
+ 12 locnamelist : namelist
+
+state 0
+ $accept : . declaration $end (0)
+
+ GLOBAL shift 1
+ LOCAL shift 2
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ declaration goto 5
+ class goto 6
+ type goto 7
+
+
+state 1
+ class : GLOBAL . (6)
+
+ . reduce 6
+
+
+state 2
+ class : LOCAL . (7)
+
+ . reduce 7
+
+
+state 3
+ type : REAL . (8)
+
+ . reduce 8
+
+
+state 4
+ type : INTEGER . (9)
+
+ . reduce 9
+
+
+state 5
+ $accept : declaration . $end (0)
+
+ $end accept
+
+
+state 6
+ declaration : class . type $$1 $$2 namelist (3)
+
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ type goto 8
+
+
+state 7
+ declaration : type . $$3 locnamelist (5)
+ $$3 : . (4)
+
+ . reduce 4
+
+ $$3 goto 9
+
+
+state 8
+ declaration : class type . $$1 $$2 namelist (3)
+ $$1 : . (1)
+
+ . reduce 1
+
+ $$1 goto 10
+
+
+state 9
+ declaration : type $$3 . locnamelist (5)
+
+ NAME shift 11
+ . error
+
+ namelist goto 12
+ locnamelist goto 13
+
+
+state 10
+ declaration : class type $$1 . $$2 namelist (3)
+ $$2 : . (2)
+
+ . reduce 2
+
+ $$2 goto 14
+
+
+state 11
+ namelist : NAME . (11)
+
+ . reduce 11
+
+
+state 12
+ namelist : namelist . NAME (10)
+ locnamelist : namelist . (12)
+
+ NAME shift 15
+ $end reduce 12
+
+
+state 13
+ declaration : type $$3 locnamelist . (5)
+
+ . reduce 5
+
+
+state 14
+ declaration : class type $$1 $$2 . namelist (3)
+
+ NAME shift 11
+ . error
+
+ namelist goto 16
+
+
+state 15
+ namelist : namelist NAME . (10)
+
+ . reduce 10
+
+
+state 16
+ declaration : class type $$1 $$2 namelist . (3)
+ namelist : namelist . NAME (10)
+
+ NAME shift 15
+ $end reduce 3
+
+
+7 terminals, 9 nonterminals
+13 grammar rules, 17 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 GLOBAL
+ 3 258 LOCAL
+ 4 259 REAL
+ 5 260 INTEGER
+ 6 261 NAME
+ 7 262 $accept
+ 8 263 declaration
+ 9 264 namelist
+ 10 265 locnamelist
+ 11 266 class
+ 12 267 type
+ 13 268 $$1
+ 14 269 $$2
+ 15 270 $$3
diff --git a/contrib/byacc/test/btyacc/err_inherit4.tab.c b/contrib/byacc/test/btyacc/err_inherit4.tab.c
new file mode 100644
index 000000000000..dfbb1724fbba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit4.tab.c
@@ -0,0 +1,1403 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse err_inherit4_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex err_inherit4_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror err_inherit4_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar err_inherit4_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval err_inherit4_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval err_inherit4_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug err_inherit4_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs err_inherit4_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag err_inherit4_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs err_inherit4_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen err_inherit4_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred err_inherit4_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos err_inherit4_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto err_inherit4_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex err_inherit4_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex err_inherit4_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex err_inherit4_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable err_inherit4_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck err_inherit4_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname err_inherit4_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule err_inherit4_rule
+#endif /* yyrule */
+
+#ifndef yyloc
+#define yyloc err_inherit4_loc
+#endif /* yyloc */
+
+#ifndef yylloc
+#define yylloc err_inherit4_lloc
+#endif /* yylloc */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex err_inherit4_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable err_inherit4_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "err_inherit4_"
+
+#define YYPURE 0
+
+#line 3 "err_inherit4.y"
+#include <stdlib.h>
+
+typedef enum {cGLOBAL, cLOCAL} class;
+typedef enum {tREAL, tINTEGER} type;
+typedef char * name;
+
+struct symbol { class c; type t; name id; };
+typedef struct symbol symbol;
+
+struct namelist { symbol *s; struct namelist *next; };
+typedef struct namelist namelist;
+
+extern symbol *mksymbol(type t, class c, name id);
+
+#ifdef YYBISON
+#define YYLEX_DECL() yylex(void)
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#line 41 "err_inherit4.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 163 "err_inherit4.tab.c"
+
+#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
+/* Default: YYLTYPE is the text position type. */
+typedef struct YYLTYPE
+{
+ int first_line;
+ int first_column;
+ int last_line;
+ int last_column;
+} YYLTYPE;
+#define YYLTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(YYLTYPE loc, const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(yylloc, msg)
+#endif
+
+#ifndef YYDESTRUCT_DECL
+#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val, YYLTYPE *loc)
+#endif
+#ifndef YYDESTRUCT_CALL
+#define YYDESTRUCT_CALL(msg, psymb, val, loc) yydestruct(msg, psymb, val, loc)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT err_inherit4_lhs[] = { -1,
+ 5, 6, 0, 7, 0, 3, 3, 4, 4, 1,
+ 1, 2,
+};
+static const YYINT err_inherit4_len[] = { 2,
+ 0, 0, 5, 0, 3, 1, 1, 1, 1, 2,
+ 1, 1,
+};
+static const YYINT err_inherit4_defred[] = { 0,
+ 6, 7, 8, 9, 0, 0, 4, 1, 0, 2,
+ 11, 0, 5, 0, 10, 0,
+};
+static const YYINT err_inherit4_stos[] = { 0,
+ 257, 258, 259, 260, 263, 266, 267, 267, 270, 268,
+ 261, 264, 265, 269, 261, 264,
+};
+static const YYINT err_inherit4_dgoto[] = { 5,
+ 12, 13, 6, 7, 10, 14, 9,
+};
+static const YYINT err_inherit4_sindex[] = { -257,
+ 0, 0, 0, 0, 0, -255, 0, 0, -254, 0,
+ 0, -253, 0, -254, 0, -253,
+};
+static const YYINT err_inherit4_rindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 6, 0, 0, 0, 9,
+};
+#if YYBTYACC
+static const YYINT err_inherit4_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0,
+};
+#endif
+static const YYINT err_inherit4_gindex[] = { 0,
+ -4, 0, 0, 5, 0, 0, 0,
+};
+#define YYTABLESIZE 11
+static const YYINT err_inherit4_table[] = { 1,
+ 2, 3, 4, 3, 4, 12, 11, 15, 3, 16,
+ 8,
+};
+static const YYINT err_inherit4_check[] = { 257,
+ 258, 259, 260, 259, 260, 0, 261, 261, 0, 14,
+ 6,
+};
+#define YYFINAL 5
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 261
+#define YYUNDFTOKEN 271
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const err_inherit4_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
+"NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
+"$$2","$$3","illegal-symbol",
+};
+static const char *const err_inherit4_rule[] = {
+"$accept : declaration",
+"$$1 :",
+"$$2 :",
+"declaration : class type $$1 $$2 namelist",
+"$$3 :",
+"declaration : type $$3 locnamelist",
+"class : GLOBAL",
+"class : LOCAL",
+"type : REAL",
+"type : INTEGER",
+"namelist : namelist NAME",
+"namelist : NAME",
+"locnamelist : namelist",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 80 "err_inherit4.y"
+
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+#line 433 "err_inherit4.tab.c"
+
+/* Release memory associated with symbol. */
+#if ! defined YYDESTRUCT_IS_DECLARED
+static void
+YYDESTRUCT_DECL()
+{
+ switch (psymb)
+ {
+ case 263:
+#line 28 "err_inherit4.y"
+ { }
+ break;
+#line 446 "err_inherit4.tab.c"
+ case 264:
+#line 28 "err_inherit4.y"
+ { }
+ break;
+#line 451 "err_inherit4.tab.c"
+ case 265:
+#line 28 "err_inherit4.y"
+ { }
+ break;
+#line 456 "err_inherit4.tab.c"
+ }
+}
+#define YYDESTRUCT_IS_DECLARED 1
+#endif
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 52 "err_inherit4.y"
+yyval.cval = yystack.l_mark[-1].cval;
+break;
+case 2:
+#line 52 "err_inherit4.y"
+yyval.tval = yystack.l_mark[-1].tval;
+break;
+case 3:
+#line 53 "err_inherit4.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 4:
+#line 54 "err_inherit4.y"
+yyval.tval = yystack.l_mark[0].tval;
+break;
+case 5:
+#line 55 "err_inherit4.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 6:
+#line 58 "err_inherit4.y"
+ { yyval.cval = cGLOBAL; }
+break;
+case 7:
+#line 59 "err_inherit4.y"
+ { yyval.cval = cLOCAL; }
+break;
+case 8:
+#line 62 "err_inherit4.y"
+ { yyval.tval = tREAL; }
+break;
+case 9:
+#line 63 "err_inherit4.y"
+ { yyval.tval = tINTEGER; }
+break;
+case 10:
+#line 67 "err_inherit4.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
+ yyval.nlist->next = yystack.l_mark[-1].nlist;
+ }
+break;
+case 11:
+#line 71 "err_inherit4.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
+ yyval.nlist->next = NULL;
+ }
+break;
+case 12:
+#line 77 "err_inherit4.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; yyloc = yystack.p_mark[1]; }
+break;
+#line 1169 "err_inherit4.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/err_inherit4.tab.h b/contrib/byacc/test/btyacc/err_inherit4.tab.h
new file mode 100644
index 000000000000..5561fd858d22
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit4.tab.h
@@ -0,0 +1,25 @@
+#ifndef _err_inherit4__defines_h_
+#define _err_inherit4__defines_h_
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE err_inherit4_lval;
+
+#endif /* _err_inherit4__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_inherit5.error b/contrib/byacc/test/btyacc/err_inherit5.error
new file mode 100644
index 000000000000..edc58c984c59
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit5.error
@@ -0,0 +1 @@
+YACC: e - line 74 of "./test/err_inherit5.y", illegal @$ or @N reference
diff --git a/contrib/byacc/test/btyacc/err_inherit5.output b/contrib/byacc/test/btyacc/err_inherit5.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit5.output
diff --git a/contrib/byacc/test/btyacc/err_inherit5.tab.c b/contrib/byacc/test/btyacc/err_inherit5.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit5.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_inherit5.tab.h b/contrib/byacc/test/btyacc/err_inherit5.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_inherit5.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax1.error b/contrib/byacc/test/btyacc/err_syntax1.error
new file mode 100644
index 000000000000..e3a341d4ee3d
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax1.error
@@ -0,0 +1,3 @@
+YACC: e - line 1 of "./test/err_syntax1.y", syntax error
+ ?% {
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax1.output b/contrib/byacc/test/btyacc/err_syntax1.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax1.output
diff --git a/contrib/byacc/test/btyacc/err_syntax1.tab.c b/contrib/byacc/test/btyacc/err_syntax1.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax1.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax1.tab.h b/contrib/byacc/test/btyacc/err_syntax1.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax1.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax10.error b/contrib/byacc/test/btyacc/err_syntax10.error
new file mode 100644
index 000000000000..ceb876ec6037
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax10.error
@@ -0,0 +1,3 @@
+YACC: w - line 7 of "./test/err_syntax10.y", the type of '(' has been redeclared
+YACC: w - line 7 of "./test/err_syntax10.y", the type of '*' has been redeclared
+YACC: w - line 7 of "./test/err_syntax10.y", the type of '&' has been redeclared
diff --git a/contrib/byacc/test/btyacc/err_syntax10.output b/contrib/byacc/test/btyacc/err_syntax10.output
new file mode 100644
index 000000000000..3d9210a70ed3
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax10.output
@@ -0,0 +1,37 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+5 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 40 '('
+ 3 42 '*'
+ 4 38 '&'
+ 5 257 $accept
+ 6 258 S
diff --git a/contrib/byacc/test/btyacc/err_syntax10.tab.c b/contrib/byacc/test/btyacc/err_syntax10.tab.c
new file mode 100644
index 000000000000..5c8645320379
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax10.tab.c
@@ -0,0 +1,1253 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse err_syntax10_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex err_syntax10_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror err_syntax10_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar err_syntax10_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval err_syntax10_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval err_syntax10_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug err_syntax10_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs err_syntax10_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag err_syntax10_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs err_syntax10_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen err_syntax10_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred err_syntax10_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos err_syntax10_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto err_syntax10_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex err_syntax10_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex err_syntax10_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex err_syntax10_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable err_syntax10_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck err_syntax10_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname err_syntax10_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule err_syntax10_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex err_syntax10_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable err_syntax10_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "err_syntax10_"
+
+#define YYPURE 0
+
+#line 2 "err_syntax10.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 124 "err_syntax10.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT err_syntax10_lhs[] = { -1,
+ 0,
+};
+static const YYINT err_syntax10_len[] = { 2,
+ 1,
+};
+static const YYINT err_syntax10_defred[] = { 0,
+ 1, 0,
+};
+static const YYINT err_syntax10_stos[] = { 0,
+ 256, 258,
+};
+static const YYINT err_syntax10_dgoto[] = { 2,
+};
+static const YYINT err_syntax10_sindex[] = { -256,
+ 0, 0,
+};
+static const YYINT err_syntax10_rindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT err_syntax10_cindex[] = { 0,
+ 0, 0,
+};
+#endif
+static const YYINT err_syntax10_gindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT err_syntax10_table[] = { 1,
+};
+static const YYINT err_syntax10_check[] = { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const err_syntax10_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,"'&'",0,"'('",0,"'*'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S",
+"illegal-symbol",
+};
+static const char *const err_syntax10_rule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 12 "err_syntax10.y"
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 363 "err_syntax10.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/err_syntax10.tab.h b/contrib/byacc/test/btyacc/err_syntax10.tab.h
new file mode 100644
index 000000000000..b9f412593fd9
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax10.tab.h
@@ -0,0 +1,5 @@
+#ifndef _err_syntax10__defines_h_
+#define _err_syntax10__defines_h_
+
+
+#endif /* _err_syntax10__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_syntax11.error b/contrib/byacc/test/btyacc/err_syntax11.error
new file mode 100644
index 000000000000..df0aee4fb588
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax11.error
@@ -0,0 +1 @@
+YACC: w - line 7 of "./test/err_syntax11.y", the precedence of '|' has been redeclared
diff --git a/contrib/byacc/test/btyacc/err_syntax11.output b/contrib/byacc/test/btyacc/err_syntax11.output
new file mode 100644
index 000000000000..bc5e66d9886f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax11.output
@@ -0,0 +1,35 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+3 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 124 '|'
+ 3 257 $accept
+ 4 258 S
diff --git a/contrib/byacc/test/btyacc/err_syntax11.tab.c b/contrib/byacc/test/btyacc/err_syntax11.tab.c
new file mode 100644
index 000000000000..dfd0e9a4d247
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax11.tab.c
@@ -0,0 +1,1259 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse err_syntax11_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex err_syntax11_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror err_syntax11_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar err_syntax11_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval err_syntax11_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval err_syntax11_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug err_syntax11_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs err_syntax11_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag err_syntax11_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs err_syntax11_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen err_syntax11_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred err_syntax11_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos err_syntax11_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto err_syntax11_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex err_syntax11_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex err_syntax11_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex err_syntax11_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable err_syntax11_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck err_syntax11_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname err_syntax11_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule err_syntax11_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex err_syntax11_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable err_syntax11_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "err_syntax11_"
+
+#define YYPURE 0
+
+#line 2 "err_syntax11.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 124 "err_syntax11.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT err_syntax11_lhs[] = { -1,
+ 0,
+};
+static const YYINT err_syntax11_len[] = { 2,
+ 1,
+};
+static const YYINT err_syntax11_defred[] = { 0,
+ 1, 0,
+};
+static const YYINT err_syntax11_stos[] = { 0,
+ 256, 258,
+};
+static const YYINT err_syntax11_dgoto[] = { 2,
+};
+static const YYINT err_syntax11_sindex[] = { -256,
+ 0, 0,
+};
+static const YYINT err_syntax11_rindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT err_syntax11_cindex[] = { 0,
+ 0, 0,
+};
+#endif
+static const YYINT err_syntax11_gindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT err_syntax11_table[] = { 1,
+};
+static const YYINT err_syntax11_check[] = { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const err_syntax11_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S",
+"illegal-symbol",
+};
+static const char *const err_syntax11_rule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 12 "err_syntax11.y"
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 369 "err_syntax11.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/err_syntax11.tab.h b/contrib/byacc/test/btyacc/err_syntax11.tab.h
new file mode 100644
index 000000000000..bfe5d07a7df4
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax11.tab.h
@@ -0,0 +1,5 @@
+#ifndef _err_syntax11__defines_h_
+#define _err_syntax11__defines_h_
+
+
+#endif /* _err_syntax11__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_syntax12.error b/contrib/byacc/test/btyacc/err_syntax12.error
new file mode 100644
index 000000000000..9399e82e1d76
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax12.error
@@ -0,0 +1 @@
+YACC: w - line 7 of "./test/err_syntax12.y", the value of text has been redeclared
diff --git a/contrib/byacc/test/btyacc/err_syntax12.output b/contrib/byacc/test/btyacc/err_syntax12.output
new file mode 100644
index 000000000000..6e792d6dfdee
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax12.output
@@ -0,0 +1,35 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+3 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 456 text
+ 3 457 $accept
+ 4 458 S
diff --git a/contrib/byacc/test/btyacc/err_syntax12.tab.c b/contrib/byacc/test/btyacc/err_syntax12.tab.c
new file mode 100644
index 000000000000..86c01c254f85
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax12.tab.c
@@ -0,0 +1,1265 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse err_syntax12_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex err_syntax12_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror err_syntax12_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar err_syntax12_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval err_syntax12_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval err_syntax12_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug err_syntax12_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs err_syntax12_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag err_syntax12_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs err_syntax12_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen err_syntax12_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred err_syntax12_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos err_syntax12_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto err_syntax12_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex err_syntax12_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex err_syntax12_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex err_syntax12_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable err_syntax12_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck err_syntax12_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname err_syntax12_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule err_syntax12_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex err_syntax12_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable err_syntax12_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "err_syntax12_"
+
+#define YYPURE 0
+
+#line 2 "err_syntax12.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 124 "err_syntax12.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define text 456
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT err_syntax12_lhs[] = { -1,
+ 0,
+};
+static const YYINT err_syntax12_len[] = { 2,
+ 1,
+};
+static const YYINT err_syntax12_defred[] = { 0,
+ 1, 0,
+};
+static const YYINT err_syntax12_stos[] = { 0,
+ 256, 458,
+};
+static const YYINT err_syntax12_dgoto[] = { 2,
+};
+static const YYINT err_syntax12_sindex[] = { -256,
+ 0, 0,
+};
+static const YYINT err_syntax12_rindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT err_syntax12_cindex[] = { 0,
+ 0, 0,
+};
+#endif
+static const YYINT err_syntax12_gindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT err_syntax12_table[] = { 1,
+};
+static const YYINT err_syntax12_check[] = { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 456
+#define YYUNDFTOKEN 459
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const err_syntax12_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"text","$accept","S",
+"illegal-symbol",
+};
+static const char *const err_syntax12_rule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 12 "err_syntax12.y"
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 375 "err_syntax12.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/err_syntax12.tab.h b/contrib/byacc/test/btyacc/err_syntax12.tab.h
new file mode 100644
index 000000000000..6fda3d1e9681
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax12.tab.h
@@ -0,0 +1,6 @@
+#ifndef _err_syntax12__defines_h_
+#define _err_syntax12__defines_h_
+
+#define text 456
+
+#endif /* _err_syntax12__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_syntax13.error b/contrib/byacc/test/btyacc/err_syntax13.error
new file mode 100644
index 000000000000..dd062569c1dc
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax13.error
@@ -0,0 +1 @@
+YACC: e - line 7 of "./test/err_syntax13.y", the start symbol text is a token
diff --git a/contrib/byacc/test/btyacc/err_syntax13.output b/contrib/byacc/test/btyacc/err_syntax13.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax13.output
diff --git a/contrib/byacc/test/btyacc/err_syntax13.tab.c b/contrib/byacc/test/btyacc/err_syntax13.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax13.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax13.tab.h b/contrib/byacc/test/btyacc/err_syntax13.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax13.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax14.error b/contrib/byacc/test/btyacc/err_syntax14.error
new file mode 100644
index 000000000000..787a21760b3d
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax14.error
@@ -0,0 +1,2 @@
+YACC: w - line 7 of "./test/err_syntax14.y", the start symbol has been redeclared
+YACC: e - the start symbol text2 is undefined
diff --git a/contrib/byacc/test/btyacc/err_syntax14.output b/contrib/byacc/test/btyacc/err_syntax14.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax14.output
diff --git a/contrib/byacc/test/btyacc/err_syntax14.tab.c b/contrib/byacc/test/btyacc/err_syntax14.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax14.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax14.tab.h b/contrib/byacc/test/btyacc/err_syntax14.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax14.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax15.error b/contrib/byacc/test/btyacc/err_syntax15.error
new file mode 100644
index 000000000000..63600f1bd126
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax15.error
@@ -0,0 +1 @@
+YACC: e - line 9 of "./test/err_syntax15.y", no grammar has been specified
diff --git a/contrib/byacc/test/btyacc/err_syntax15.output b/contrib/byacc/test/btyacc/err_syntax15.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax15.output
diff --git a/contrib/byacc/test/btyacc/err_syntax15.tab.c b/contrib/byacc/test/btyacc/err_syntax15.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax15.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax15.tab.h b/contrib/byacc/test/btyacc/err_syntax15.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax15.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax16.error b/contrib/byacc/test/btyacc/err_syntax16.error
new file mode 100644
index 000000000000..b8dd094b9409
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax16.error
@@ -0,0 +1 @@
+YACC: e - line 14 of "./test/err_syntax16.y", a token appears on the lhs of a production
diff --git a/contrib/byacc/test/btyacc/err_syntax16.output b/contrib/byacc/test/btyacc/err_syntax16.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax16.output
diff --git a/contrib/byacc/test/btyacc/err_syntax16.tab.c b/contrib/byacc/test/btyacc/err_syntax16.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax16.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax16.tab.h b/contrib/byacc/test/btyacc/err_syntax16.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax16.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax17.error b/contrib/byacc/test/btyacc/err_syntax17.error
new file mode 100644
index 000000000000..24032f613202
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax17.error
@@ -0,0 +1,3 @@
+YACC: e - line 8 of "./test/err_syntax17.y", unterminated action
+S: { error
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax17.output b/contrib/byacc/test/btyacc/err_syntax17.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax17.output
diff --git a/contrib/byacc/test/btyacc/err_syntax17.tab.c b/contrib/byacc/test/btyacc/err_syntax17.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax17.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax17.tab.h b/contrib/byacc/test/btyacc/err_syntax17.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax17.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax18.error b/contrib/byacc/test/btyacc/err_syntax18.error
new file mode 100644
index 000000000000..305b4cf45e3c
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax18.error
@@ -0,0 +1 @@
+YACC: w - line 9 of "./test/err_syntax18.y", $4 references beyond the end of the current rule
diff --git a/contrib/byacc/test/btyacc/err_syntax18.output b/contrib/byacc/test/btyacc/err_syntax18.output
new file mode 100644
index 000000000000..216fb71b6f91
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax18.output
@@ -0,0 +1,52 @@
+ 0 $accept : expr $end
+
+ 1 expr : '(' expr ')'
+
+state 0
+ $accept : . expr $end (0)
+
+ '(' shift 1
+ . error
+
+ expr goto 2
+
+
+state 1
+ expr : '(' . expr ')' (1)
+
+ '(' shift 1
+ . error
+
+ expr goto 3
+
+
+state 2
+ $accept : expr . $end (0)
+
+ $end accept
+
+
+state 3
+ expr : '(' expr . ')' (1)
+
+ ')' shift 4
+ . error
+
+
+state 4
+ expr : '(' expr ')' . (1)
+
+ . reduce 1
+
+
+4 terminals, 2 nonterminals
+2 grammar rules, 5 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 40 '('
+ 3 41 ')'
+ 4 257 $accept
+ 5 258 expr
diff --git a/contrib/byacc/test/btyacc/err_syntax18.tab.c b/contrib/byacc/test/btyacc/err_syntax18.tab.c
new file mode 100644
index 000000000000..2a8a10948b63
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax18.tab.c
@@ -0,0 +1,1266 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse err_syntax18_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex err_syntax18_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror err_syntax18_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar err_syntax18_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval err_syntax18_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval err_syntax18_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug err_syntax18_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs err_syntax18_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag err_syntax18_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs err_syntax18_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen err_syntax18_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred err_syntax18_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos err_syntax18_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto err_syntax18_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex err_syntax18_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex err_syntax18_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex err_syntax18_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable err_syntax18_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck err_syntax18_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname err_syntax18_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule err_syntax18_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex err_syntax18_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable err_syntax18_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "err_syntax18_"
+
+#define YYPURE 0
+
+#line 2 "err_syntax18.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 124 "err_syntax18.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT err_syntax18_lhs[] = { -1,
+ 0,
+};
+static const YYINT err_syntax18_len[] = { 2,
+ 3,
+};
+static const YYINT err_syntax18_defred[] = { 0,
+ 0, 0, 0, 1,
+};
+static const YYINT err_syntax18_stos[] = { 0,
+ 40, 258, 258, 41,
+};
+static const YYINT err_syntax18_dgoto[] = { 2,
+};
+static const YYINT err_syntax18_sindex[] = { -40,
+ -40, 0, -39, 0,
+};
+static const YYINT err_syntax18_rindex[] = { 0,
+ 0, 0, 0, 0,
+};
+#if YYBTYACC
+static const YYINT err_syntax18_cindex[] = { 0,
+ 0, 0, 0, 0,
+};
+#endif
+static const YYINT err_syntax18_gindex[] = { 2,
+};
+#define YYTABLESIZE 3
+static const YYINT err_syntax18_table[] = { 1,
+ 0, 4, 3,
+};
+static const YYINT err_syntax18_check[] = { 40,
+ -1, 41, 1,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const err_syntax18_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","expr",
+"illegal-symbol",
+};
+static const char *const err_syntax18_rule[] = {
+"$accept : expr",
+"expr : '(' expr ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 13 "err_syntax18.y"
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 371 "err_syntax18.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 9 "err_syntax18.y"
+ { yyval = yystack.l_mark[1]; }
+break;
+#line 1032 "err_syntax18.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/err_syntax18.tab.h b/contrib/byacc/test/btyacc/err_syntax18.tab.h
new file mode 100644
index 000000000000..f08352a9b174
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax18.tab.h
@@ -0,0 +1,5 @@
+#ifndef _err_syntax18__defines_h_
+#define _err_syntax18__defines_h_
+
+
+#endif /* _err_syntax18__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_syntax19.error b/contrib/byacc/test/btyacc/err_syntax19.error
new file mode 100644
index 000000000000..895c8fe16264
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax19.error
@@ -0,0 +1,3 @@
+YACC: e - line 9 of "./test/err_syntax19.y", illegal $-name
+ { $$ = $<oops>; }
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax19.output b/contrib/byacc/test/btyacc/err_syntax19.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax19.output
diff --git a/contrib/byacc/test/btyacc/err_syntax19.tab.c b/contrib/byacc/test/btyacc/err_syntax19.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax19.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax19.tab.h b/contrib/byacc/test/btyacc/err_syntax19.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax19.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax2.error b/contrib/byacc/test/btyacc/err_syntax2.error
new file mode 100644
index 000000000000..fefda9fcf445
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax2.error
@@ -0,0 +1,3 @@
+YACC: e - line 1 of "./test/err_syntax2.y", unmatched /*
+%{ /*
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax2.output b/contrib/byacc/test/btyacc/err_syntax2.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax2.output
diff --git a/contrib/byacc/test/btyacc/err_syntax2.tab.c b/contrib/byacc/test/btyacc/err_syntax2.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax2.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax2.tab.h b/contrib/byacc/test/btyacc/err_syntax2.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax2.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax20.error b/contrib/byacc/test/btyacc/err_syntax20.error
new file mode 100644
index 000000000000..76dac8152de8
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax20.error
@@ -0,0 +1 @@
+YACC: w - the symbol recur is undefined
diff --git a/contrib/byacc/test/btyacc/err_syntax20.output b/contrib/byacc/test/btyacc/err_syntax20.output
new file mode 100644
index 000000000000..f0378d42e95d
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax20.output
@@ -0,0 +1,51 @@
+ 0 $accept : expr $end
+
+ 1 expr : '(' recur ')'
+
+state 0
+ $accept : . expr $end (0)
+
+ '(' shift 1
+ . error
+
+ expr goto 2
+
+
+state 1
+ expr : '(' . recur ')' (1)
+
+ recur shift 3
+ . error
+
+
+state 2
+ $accept : expr . $end (0)
+
+ $end accept
+
+
+state 3
+ expr : '(' recur . ')' (1)
+
+ ')' shift 4
+ . error
+
+
+state 4
+ expr : '(' recur ')' . (1)
+
+ . reduce 1
+
+
+5 terminals, 2 nonterminals
+2 grammar rules, 5 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 recur
+ 3 40 '('
+ 4 41 ')'
+ 5 258 $accept
+ 6 259 expr
diff --git a/contrib/byacc/test/btyacc/err_syntax20.tab.c b/contrib/byacc/test/btyacc/err_syntax20.tab.c
new file mode 100644
index 000000000000..80ec2ed821d8
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax20.tab.c
@@ -0,0 +1,1261 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse err_syntax20_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex err_syntax20_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror err_syntax20_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar err_syntax20_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval err_syntax20_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval err_syntax20_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug err_syntax20_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs err_syntax20_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag err_syntax20_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs err_syntax20_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen err_syntax20_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred err_syntax20_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos err_syntax20_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto err_syntax20_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex err_syntax20_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex err_syntax20_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex err_syntax20_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable err_syntax20_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck err_syntax20_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname err_syntax20_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule err_syntax20_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex err_syntax20_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable err_syntax20_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "err_syntax20_"
+
+#define YYPURE 0
+
+#line 2 "err_syntax20.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 124 "err_syntax20.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define recur 257
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT err_syntax20_lhs[] = { -1,
+ 0,
+};
+static const YYINT err_syntax20_len[] = { 2,
+ 3,
+};
+static const YYINT err_syntax20_defred[] = { 0,
+ 0, 0, 0, 1,
+};
+static const YYINT err_syntax20_stos[] = { 0,
+ 40, 259, 257, 41,
+};
+static const YYINT err_syntax20_dgoto[] = { 2,
+};
+static const YYINT err_syntax20_sindex[] = { -40,
+ -256, 0, -39, 0,
+};
+static const YYINT err_syntax20_rindex[] = { 0,
+ 0, 0, 0, 0,
+};
+#if YYBTYACC
+static const YYINT err_syntax20_cindex[] = { 0,
+ 0, 0, 0, 0,
+};
+#endif
+static const YYINT err_syntax20_gindex[] = { 0,
+};
+#define YYTABLESIZE 2
+static const YYINT err_syntax20_table[] = { 1,
+ 3, 4,
+};
+static const YYINT err_syntax20_check[] = { 40,
+ 257, 41,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 257
+#define YYUNDFTOKEN 260
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const err_syntax20_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'('","')'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","recur","$accept","expr",
+"illegal-symbol",
+};
+static const char *const err_syntax20_rule[] = {
+"$accept : expr",
+"expr : '(' recur ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 16 "err_syntax20.y"
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 366 "err_syntax20.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 12 "err_syntax20.y"
+ { yystack.l_mark[-1].rechk = 3; }
+break;
+#line 1027 "err_syntax20.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/err_syntax20.tab.h b/contrib/byacc/test/btyacc/err_syntax20.tab.h
new file mode 100644
index 000000000000..fb019706fb2e
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax20.tab.h
@@ -0,0 +1,6 @@
+#ifndef _err_syntax20__defines_h_
+#define _err_syntax20__defines_h_
+
+#define recur 257
+
+#endif /* _err_syntax20__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/err_syntax21.error b/contrib/byacc/test/btyacc/err_syntax21.error
new file mode 100644
index 000000000000..162d82d0c96d
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax21.error
@@ -0,0 +1 @@
+YACC: e - line 12 of "./test/err_syntax21.y", $0 is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax21.output b/contrib/byacc/test/btyacc/err_syntax21.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax21.output
diff --git a/contrib/byacc/test/btyacc/err_syntax21.tab.c b/contrib/byacc/test/btyacc/err_syntax21.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax21.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax21.tab.h b/contrib/byacc/test/btyacc/err_syntax21.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax21.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax22.error b/contrib/byacc/test/btyacc/err_syntax22.error
new file mode 100644
index 000000000000..9c71619c4e25
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax22.error
@@ -0,0 +1 @@
+YACC: e - line 17 of "./test/err_syntax22.y", $2 (recur) is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax22.output b/contrib/byacc/test/btyacc/err_syntax22.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax22.output
diff --git a/contrib/byacc/test/btyacc/err_syntax22.tab.c b/contrib/byacc/test/btyacc/err_syntax22.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax22.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax22.tab.h b/contrib/byacc/test/btyacc/err_syntax22.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax22.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax23.error b/contrib/byacc/test/btyacc/err_syntax23.error
new file mode 100644
index 000000000000..bcde6e7fac40
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax23.error
@@ -0,0 +1 @@
+YACC: e - line 18 of "./test/err_syntax23.y", $$ is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax23.output b/contrib/byacc/test/btyacc/err_syntax23.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax23.output
diff --git a/contrib/byacc/test/btyacc/err_syntax23.tab.c b/contrib/byacc/test/btyacc/err_syntax23.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax23.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax23.tab.h b/contrib/byacc/test/btyacc/err_syntax23.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax23.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax24.error b/contrib/byacc/test/btyacc/err_syntax24.error
new file mode 100644
index 000000000000..bdd3aeda0db3
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax24.error
@@ -0,0 +1,2 @@
+YACC: w - line 21 of "./test/err_syntax24.y", the default action assigns an undefined value to $$
+YACC: e - line 22 of "./test/err_syntax24.y", $$ is untyped
diff --git a/contrib/byacc/test/btyacc/err_syntax24.output b/contrib/byacc/test/btyacc/err_syntax24.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax24.output
diff --git a/contrib/byacc/test/btyacc/err_syntax24.tab.c b/contrib/byacc/test/btyacc/err_syntax24.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax24.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax24.tab.h b/contrib/byacc/test/btyacc/err_syntax24.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax24.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax25.error b/contrib/byacc/test/btyacc/err_syntax25.error
new file mode 100644
index 000000000000..ea45a70310de
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax25.error
@@ -0,0 +1,3 @@
+YACC: e - line 11 of "./test/err_syntax25.y", too many %union declarations
+%union {
+^
diff --git a/contrib/byacc/test/btyacc/err_syntax25.output b/contrib/byacc/test/btyacc/err_syntax25.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax25.output
diff --git a/contrib/byacc/test/btyacc/err_syntax25.tab.c b/contrib/byacc/test/btyacc/err_syntax25.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax25.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax25.tab.h b/contrib/byacc/test/btyacc/err_syntax25.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax25.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax26.error b/contrib/byacc/test/btyacc/err_syntax26.error
new file mode 100644
index 000000000000..cddd5741bf7a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax26.error
@@ -0,0 +1 @@
+YACC: e - line 6 of "./test/err_syntax26.y", unexpected end-of-file
diff --git a/contrib/byacc/test/btyacc/err_syntax26.output b/contrib/byacc/test/btyacc/err_syntax26.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax26.output
diff --git a/contrib/byacc/test/btyacc/err_syntax26.tab.c b/contrib/byacc/test/btyacc/err_syntax26.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax26.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax26.tab.h b/contrib/byacc/test/btyacc/err_syntax26.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax26.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax27.error b/contrib/byacc/test/btyacc/err_syntax27.error
new file mode 100644
index 000000000000..4737f99b9a37
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax27.error
@@ -0,0 +1 @@
+YACC: e - line 3 of "./test/err_syntax27.y", missing '}'
diff --git a/contrib/byacc/test/btyacc/err_syntax27.output b/contrib/byacc/test/btyacc/err_syntax27.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax27.output
diff --git a/contrib/byacc/test/btyacc/err_syntax27.tab.c b/contrib/byacc/test/btyacc/err_syntax27.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax27.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax27.tab.h b/contrib/byacc/test/btyacc/err_syntax27.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax27.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax3.error b/contrib/byacc/test/btyacc/err_syntax3.error
new file mode 100644
index 000000000000..6926214f5e7b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax3.error
@@ -0,0 +1,3 @@
+YACC: e - line 6 of "./test/err_syntax3.y", unterminated string
+%token <text> '(' '*' '&
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax3.output b/contrib/byacc/test/btyacc/err_syntax3.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax3.output
diff --git a/contrib/byacc/test/btyacc/err_syntax3.tab.c b/contrib/byacc/test/btyacc/err_syntax3.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax3.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax3.tab.h b/contrib/byacc/test/btyacc/err_syntax3.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax3.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax4.error b/contrib/byacc/test/btyacc/err_syntax4.error
new file mode 100644
index 000000000000..72b683ee7d4b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax4.error
@@ -0,0 +1,3 @@
+YACC: e - line 1 of "./test/err_syntax4.y", unmatched %{
+%{
+^
diff --git a/contrib/byacc/test/btyacc/err_syntax4.output b/contrib/byacc/test/btyacc/err_syntax4.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax4.output
diff --git a/contrib/byacc/test/btyacc/err_syntax4.tab.c b/contrib/byacc/test/btyacc/err_syntax4.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax4.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax4.tab.h b/contrib/byacc/test/btyacc/err_syntax4.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax4.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax5.error b/contrib/byacc/test/btyacc/err_syntax5.error
new file mode 100644
index 000000000000..fd3bf0df6b9f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax5.error
@@ -0,0 +1,3 @@
+YACC: e - line 6 of "./test/err_syntax5.y", unterminated %union declaration
+%union {
+^
diff --git a/contrib/byacc/test/btyacc/err_syntax5.output b/contrib/byacc/test/btyacc/err_syntax5.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax5.output
diff --git a/contrib/byacc/test/btyacc/err_syntax5.tab.c b/contrib/byacc/test/btyacc/err_syntax5.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax5.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax5.tab.h b/contrib/byacc/test/btyacc/err_syntax5.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax5.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax6.error b/contrib/byacc/test/btyacc/err_syntax6.error
new file mode 100644
index 000000000000..ae83bd2a3735
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax6.error
@@ -0,0 +1,3 @@
+YACC: e - line 6 of "./test/err_syntax6.y", illegal tag
+%token <text) '(' '*' '&
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax6.output b/contrib/byacc/test/btyacc/err_syntax6.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax6.output
diff --git a/contrib/byacc/test/btyacc/err_syntax6.tab.c b/contrib/byacc/test/btyacc/err_syntax6.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax6.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax6.tab.h b/contrib/byacc/test/btyacc/err_syntax6.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax6.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax7.error b/contrib/byacc/test/btyacc/err_syntax7.error
new file mode 100644
index 000000000000..fb6342288f52
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7.error
@@ -0,0 +1,3 @@
+YACC: e - line 6 of "./test/err_syntax7.y", illegal character
+%token <text> '\777'
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax7.output b/contrib/byacc/test/btyacc/err_syntax7.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7.output
diff --git a/contrib/byacc/test/btyacc/err_syntax7.tab.c b/contrib/byacc/test/btyacc/err_syntax7.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax7.tab.h b/contrib/byacc/test/btyacc/err_syntax7.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax7a.error b/contrib/byacc/test/btyacc/err_syntax7a.error
new file mode 100644
index 000000000000..f6adba64ddc1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7a.error
@@ -0,0 +1,3 @@
+YACC: e - line 6 of "./test/err_syntax7a.y", illegal character
+%token <text> '\xfff'
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax7a.output b/contrib/byacc/test/btyacc/err_syntax7a.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7a.output
diff --git a/contrib/byacc/test/btyacc/err_syntax7a.tab.c b/contrib/byacc/test/btyacc/err_syntax7a.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7a.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax7a.tab.h b/contrib/byacc/test/btyacc/err_syntax7a.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7a.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax7b.error b/contrib/byacc/test/btyacc/err_syntax7b.error
new file mode 100644
index 000000000000..f3e512fd1a71
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7b.error
@@ -0,0 +1,3 @@
+YACC: e - line 6 of "./test/err_syntax7b.y", illegal character
+%token <text> '\x.'
+ ^
diff --git a/contrib/byacc/test/btyacc/err_syntax7b.output b/contrib/byacc/test/btyacc/err_syntax7b.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7b.output
diff --git a/contrib/byacc/test/btyacc/err_syntax7b.tab.c b/contrib/byacc/test/btyacc/err_syntax7b.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7b.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax7b.tab.h b/contrib/byacc/test/btyacc/err_syntax7b.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax7b.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax8.error b/contrib/byacc/test/btyacc/err_syntax8.error
new file mode 100644
index 000000000000..53a3a328d05e
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8.error
@@ -0,0 +1 @@
+YACC: e - line 6 of "./test/err_syntax8.y", illegal use of reserved symbol .
diff --git a/contrib/byacc/test/btyacc/err_syntax8.output b/contrib/byacc/test/btyacc/err_syntax8.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8.output
diff --git a/contrib/byacc/test/btyacc/err_syntax8.tab.c b/contrib/byacc/test/btyacc/err_syntax8.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax8.tab.h b/contrib/byacc/test/btyacc/err_syntax8.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax8a.error b/contrib/byacc/test/btyacc/err_syntax8a.error
new file mode 100644
index 000000000000..3135551633f0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8a.error
@@ -0,0 +1 @@
+YACC: e - line 6 of "./test/err_syntax8a.y", illegal use of reserved symbol $$123
diff --git a/contrib/byacc/test/btyacc/err_syntax8a.output b/contrib/byacc/test/btyacc/err_syntax8a.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8a.output
diff --git a/contrib/byacc/test/btyacc/err_syntax8a.tab.c b/contrib/byacc/test/btyacc/err_syntax8a.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8a.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax8a.tab.h b/contrib/byacc/test/btyacc/err_syntax8a.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax8a.tab.h
diff --git a/contrib/byacc/test/btyacc/err_syntax9.error b/contrib/byacc/test/btyacc/err_syntax9.error
new file mode 100644
index 000000000000..43696bd1f4c3
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax9.error
@@ -0,0 +1 @@
+YACC: e - line 7 of "./test/err_syntax9.y", the start symbol text cannot be declared to be a token
diff --git a/contrib/byacc/test/btyacc/err_syntax9.output b/contrib/byacc/test/btyacc/err_syntax9.output
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax9.output
diff --git a/contrib/byacc/test/btyacc/err_syntax9.tab.c b/contrib/byacc/test/btyacc/err_syntax9.tab.c
new file mode 100644
index 000000000000..6c35f23329b5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax9.tab.c
@@ -0,0 +1,15 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
diff --git a/contrib/byacc/test/btyacc/err_syntax9.tab.h b/contrib/byacc/test/btyacc/err_syntax9.tab.h
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/err_syntax9.tab.h
diff --git a/contrib/byacc/test/btyacc/error.error b/contrib/byacc/test/btyacc/error.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/error.error
diff --git a/contrib/byacc/test/btyacc/error.output b/contrib/byacc/test/btyacc/error.output
new file mode 100644
index 000000000000..1e56c214a6cc
--- /dev/null
+++ b/contrib/byacc/test/btyacc/error.output
@@ -0,0 +1,34 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+2 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 $accept
+ 3 258 S
diff --git a/contrib/byacc/test/btyacc/error.tab.c b/contrib/byacc/test/btyacc/error.tab.c
new file mode 100644
index 000000000000..17cd75cad269
--- /dev/null
+++ b/contrib/byacc/test/btyacc/error.tab.c
@@ -0,0 +1,1258 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse error_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex error_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror error_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar error_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval error_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval error_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug error_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs error_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag error_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs error_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen error_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred error_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos error_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto error_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex error_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex error_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex error_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable error_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck error_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname error_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule error_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex error_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable error_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "error_"
+
+#define YYPURE 0
+
+#line 2 "error.y"
+int yylex(void);
+static void yyerror(const char *);
+#line 124 "error.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT error_lhs[] = { -1,
+ 0,
+};
+static const YYINT error_len[] = { 2,
+ 1,
+};
+static const YYINT error_defred[] = { 0,
+ 1, 0,
+};
+static const YYINT error_stos[] = { 0,
+ 256, 258,
+};
+static const YYINT error_dgoto[] = { 2,
+};
+static const YYINT error_sindex[] = { -256,
+ 0, 0,
+};
+static const YYINT error_rindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT error_cindex[] = { 0,
+ 0, 0,
+};
+#endif
+static const YYINT error_gindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT error_table[] = { 1,
+};
+static const YYINT error_check[] = { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const error_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
+};
+static const char *const error_rule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 8 "error.y"
+
+#include <stdio.h>
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 368 "error.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/error.tab.h b/contrib/byacc/test/btyacc/error.tab.h
new file mode 100644
index 000000000000..f9e5ad278cc4
--- /dev/null
+++ b/contrib/byacc/test/btyacc/error.tab.h
@@ -0,0 +1,5 @@
+#ifndef _error__defines_h_
+#define _error__defines_h_
+
+
+#endif /* _error__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/grammar.dot b/contrib/byacc/test/btyacc/grammar.dot
new file mode 100644
index 000000000000..1988e12ddd6b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/grammar.dot
@@ -0,0 +1,906 @@
+digraph test-grammar {
+ edge [fontsize=10];
+ node [shape=box,fontsize=10];
+ orientation=landscape;
+ rankdir=LR;
+ /*
+ margin=0.2;
+ page="8.27,11.69"; // for A4 printing
+ ratio=auto;
+ */
+
+ q0 [label="0:\l $accept -> . program $end\l program -> . { $end }\l program -> . translation_unit\l translation_unit -> . external_declaration\l translation_unit -> . translation_unit external_declaration\l external_declaration -> . declaration\l external_declaration -> . function_definition\l external_declaration -> . ';'\l external_declaration -> . linkage_specification\l external_declaration -> . T_ASM T_ASMARG ';'\l external_declaration -> . error T_MATCHRBRACE\l external_declaration -> . error ';'\l linkage_specification -> . T_EXTERN T_STRING_LITERAL braces\l linkage_specification -> . T_EXTERN T_STRING_LITERAL declaration\l declaration -> . decl_specifiers ';'\l declaration -> . decl_specifiers init_declarator_list ';'\l declaration -> . any_typedef decl_specifiers $$1 opt_declarator_list ';'\l any_typedef -> . T_EXTENSION T_TYPEDEF\l any_typedef -> . T_TYPEDEF\l function_definition -> . decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE\l function_definition -> . declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q1 [label="1:\l external_declaration -> error . T_MATCHRBRACE\l external_declaration -> error . ';'\l"];
+ q2 [label="2:\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> '(' . declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q3 [label="3:\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l pointer -> '*' . opt_type_qualifiers\l pointer -> '*' . opt_type_qualifiers pointer\l opt_type_qualifiers -> . { ')' ',' T_BRACKETS T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l opt_type_qualifiers -> . type_qualifier_list\l type_qualifier_list -> . type_qualifier\l type_qualifier_list -> . type_qualifier_list type_qualifier\l"];
+ q4 [label="4:\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l identifier_or_ref -> '&' . any_id\l"];
+ q5 [label="5:\l any_id -> T_IDENTIFIER . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q6 [label="6:\l type_specifier -> T_TYPEDEF_NAME . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l any_id -> T_TYPEDEF_NAME . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q7 [label="7:\l type_qualifier -> T_DEFINE_NAME . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q8 [label="8:\l storage_class -> T_AUTO . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q9 [label="9:\l linkage_specification -> T_EXTERN . T_STRING_LITERAL braces\l linkage_specification -> T_EXTERN . T_STRING_LITERAL declaration\l storage_class -> T_EXTERN . { ';' T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q10 [label="10:\l storage_class -> T_REGISTER . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q11 [label="11:\l storage_class -> T_STATIC . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q12 [label="12:\l any_typedef -> T_TYPEDEF . { T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l"];
+ q13 [label="13:\l storage_class -> T_INLINE . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q14 [label="14:\l any_typedef -> T_EXTENSION . T_TYPEDEF\l storage_class -> T_EXTENSION . { ';' T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q15 [label="15:\l type_specifier -> T_CHAR . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q16 [label="16:\l type_specifier -> T_DOUBLE . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q17 [label="17:\l type_specifier -> T_FLOAT . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q18 [label="18:\l type_specifier -> T_INT . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q19 [label="19:\l type_specifier -> T_VOID . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q20 [label="20:\l type_specifier -> T_LONG . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q21 [label="21:\l type_specifier -> T_SHORT . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q22 [label="22:\l type_specifier -> T_SIGNED . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q23 [label="23:\l type_specifier -> T_UNSIGNED . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q24 [label="24:\l enumeration -> T_ENUM . { T_LBRACE T_TYPEDEF_NAME T_IDENTIFIER }\l"];
+ q25 [label="25:\l struct_or_union -> T_STRUCT . { T_LBRACE T_TYPEDEF_NAME T_IDENTIFIER }\l"];
+ q26 [label="26:\l struct_or_union -> T_UNION . { T_LBRACE T_TYPEDEF_NAME T_IDENTIFIER }\l"];
+ q27 [label="27:\l type_specifier -> T_Bool . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q28 [label="28:\l type_specifier -> T_Complex . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q29 [label="29:\l type_specifier -> T_Imaginary . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q30 [label="30:\l type_qualifier -> T_TYPE_QUALIFIER . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q31 [label="31:\l external_declaration -> T_ASM . T_ASMARG ';'\l"];
+ q32 [label="32:\l external_declaration -> ';' . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q33 [label="33:\l $accept -> program . $end\l"];
+ q34 [label="34:\l declaration -> decl_specifiers . ';'\l declaration -> decl_specifiers . init_declarator_list ';'\l function_definition -> decl_specifiers . declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE\l decl_specifiers -> decl_specifiers . decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l init_declarator_list -> . init_declarator\l init_declarator_list -> . init_declarator_list ',' init_declarator\l init_declarator -> . declarator\l init_declarator -> . declarator '=' $$5 T_INITIALIZER\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q35 [label="35:\l decl_specifiers -> decl_specifier . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q36 [label="36:\l decl_specifier -> storage_class . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q37 [label="37:\l decl_specifier -> type_specifier . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q38 [label="38:\l decl_specifier -> type_qualifier . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q39 [label="39:\l type_specifier -> struct_or_union_specifier . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q40 [label="40:\l type_specifier -> enum_specifier . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q41 [label="41:\l $$4 -> . { T_VA_DCL T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l function_definition -> declarator . $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE\l"];
+ q42 [label="42:\l declarator -> direct_declarator . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l direct_declarator -> direct_declarator . T_BRACKETS\l direct_declarator -> direct_declarator . '(' parameter_type_list ')'\l direct_declarator -> direct_declarator . '(' opt_identifier_list ')'\l"];
+ q43 [label="43:\l braces -> . T_LBRACE T_MATCHRBRACE\l struct_or_union_specifier -> struct_or_union . any_id braces\l struct_or_union_specifier -> struct_or_union . braces\l struct_or_union_specifier -> struct_or_union . any_id\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l"];
+ q44 [label="44:\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> pointer . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q45 [label="45:\l identifier_or_ref -> any_id . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q46 [label="46:\l direct_declarator -> identifier_or_ref . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q47 [label="47:\l braces -> . T_LBRACE T_MATCHRBRACE\l enum_specifier -> enumeration . any_id braces\l enum_specifier -> enumeration . braces\l enum_specifier -> enumeration . any_id\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l"];
+ q48 [label="48:\l program -> translation_unit . { $end }\l translation_unit -> translation_unit . external_declaration\l external_declaration -> . declaration\l external_declaration -> . function_definition\l external_declaration -> . ';'\l external_declaration -> . linkage_specification\l external_declaration -> . T_ASM T_ASMARG ';'\l external_declaration -> . error T_MATCHRBRACE\l external_declaration -> . error ';'\l linkage_specification -> . T_EXTERN T_STRING_LITERAL braces\l linkage_specification -> . T_EXTERN T_STRING_LITERAL declaration\l declaration -> . decl_specifiers ';'\l declaration -> . decl_specifiers init_declarator_list ';'\l declaration -> . any_typedef decl_specifiers $$1 opt_declarator_list ';'\l any_typedef -> . T_EXTENSION T_TYPEDEF\l any_typedef -> . T_TYPEDEF\l function_definition -> . decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE\l function_definition -> . declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q49 [label="49:\l translation_unit -> external_declaration . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q50 [label="50:\l external_declaration -> declaration . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q51 [label="51:\l external_declaration -> function_definition . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q52 [label="52:\l external_declaration -> linkage_specification . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q53 [label="53:\l declaration -> any_typedef . decl_specifiers $$1 opt_declarator_list ';'\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l"];
+ q54 [label="54:\l external_declaration -> error T_MATCHRBRACE . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q55 [label="55:\l external_declaration -> error ';' . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q56 [label="56:\l any_id -> T_TYPEDEF_NAME . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q57 [label="57:\l direct_declarator -> '(' declarator . ')'\l"];
+ q58 [label="58:\l type_qualifier_list -> type_qualifier . { ')' ',' T_BRACKETS T_TYPE_QUALIFIER T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q59 [label="59:\l pointer -> . '*' opt_type_qualifiers\l pointer -> '*' opt_type_qualifiers . { ')' ',' T_BRACKETS T_TYPEDEF_NAME T_IDENTIFIER '&' '(' }\l pointer -> . '*' opt_type_qualifiers pointer\l pointer -> '*' opt_type_qualifiers . pointer\l"];
+ q60 [label="60:\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l opt_type_qualifiers -> type_qualifier_list . { ')' ',' T_BRACKETS T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l type_qualifier_list -> type_qualifier_list . type_qualifier\l"];
+ q61 [label="61:\l identifier_or_ref -> '&' any_id . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q62 [label="62:\l braces -> . T_LBRACE T_MATCHRBRACE\l linkage_specification -> T_EXTERN T_STRING_LITERAL . braces\l linkage_specification -> T_EXTERN T_STRING_LITERAL . declaration\l declaration -> . decl_specifiers ';'\l declaration -> . decl_specifiers init_declarator_list ';'\l declaration -> . any_typedef decl_specifiers $$1 opt_declarator_list ';'\l any_typedef -> . T_EXTENSION T_TYPEDEF\l any_typedef -> . T_TYPEDEF\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l"];
+ q63 [label="63:\l any_typedef -> T_EXTENSION T_TYPEDEF . { T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l"];
+ q64 [label="64:\l external_declaration -> T_ASM T_ASMARG . ';'\l"];
+ q65 [label="65:\l storage_class -> T_EXTERN . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q66 [label="66:\l storage_class -> T_EXTENSION . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q67 [label="67:\l declaration -> decl_specifiers ';' . { ';' T_ASM T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q68 [label="68:\l decl_specifiers -> decl_specifiers decl_specifier . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q69 [label="69:\l declaration -> decl_specifiers init_declarator_list . ';'\l init_declarator_list -> init_declarator_list . ',' init_declarator\l"];
+ q70 [label="70:\l init_declarator_list -> init_declarator . { ',' ';' }\l"];
+ q71 [label="71:\l $$2 -> . { T_VA_DCL T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l function_definition -> decl_specifiers declarator . $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE\l init_declarator -> declarator . { ',' ';' }\l init_declarator -> declarator . '=' $$5 T_INITIALIZER\l"];
+ q72 [label="72:\l declaration -> . decl_specifiers ';'\l declaration -> . decl_specifiers init_declarator_list ';'\l declaration -> . any_typedef decl_specifiers $$1 opt_declarator_list ';'\l any_typedef -> . T_EXTENSION T_TYPEDEF\l any_typedef -> . T_TYPEDEF\l function_definition -> declarator $$4 . opt_declaration_list T_LBRACE T_MATCHRBRACE\l opt_declaration_list -> . { T_LBRACE }\l opt_declaration_list -> . T_VA_DCL\l opt_declaration_list -> . declaration_list\l declaration_list -> . declaration\l declaration_list -> . declaration_list declaration\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l"];
+ q73 [label="73:\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l direct_declarator -> direct_declarator '(' . parameter_type_list ')'\l direct_declarator -> direct_declarator '(' . opt_identifier_list ')'\l parameter_type_list -> . parameter_list\l parameter_type_list -> . parameter_list ',' T_ELLIPSIS\l parameter_list -> . parameter_declaration\l parameter_list -> . parameter_list ',' parameter_declaration\l parameter_declaration -> . decl_specifiers declarator\l parameter_declaration -> . decl_specifiers abs_declarator\l parameter_declaration -> . decl_specifiers\l opt_identifier_list -> . { ')' }\l opt_identifier_list -> . identifier_list\l identifier_list -> . any_id\l identifier_list -> . identifier_list ',' any_id\l"];
+ q74 [label="74:\l direct_declarator -> direct_declarator T_BRACKETS . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q75 [label="75:\l braces -> T_LBRACE . T_MATCHRBRACE\l"];
+ q76 [label="76:\l braces -> . T_LBRACE T_MATCHRBRACE\l struct_or_union_specifier -> struct_or_union any_id . braces\l struct_or_union_specifier -> struct_or_union any_id . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q77 [label="77:\l struct_or_union_specifier -> struct_or_union braces . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q78 [label="78:\l declarator -> pointer direct_declarator . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l direct_declarator -> direct_declarator . T_BRACKETS\l direct_declarator -> direct_declarator . '(' parameter_type_list ')'\l direct_declarator -> direct_declarator . '(' opt_identifier_list ')'\l"];
+ q79 [label="79:\l braces -> . T_LBRACE T_MATCHRBRACE\l enum_specifier -> enumeration any_id . braces\l enum_specifier -> enumeration any_id . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q80 [label="80:\l enum_specifier -> enumeration braces . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q81 [label="81:\l translation_unit -> translation_unit external_declaration . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q82 [label="82:\l type_specifier -> T_TYPEDEF_NAME . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q83 [label="83:\l $$1 -> . { ';' T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l declaration -> any_typedef decl_specifiers . $$1 opt_declarator_list ';'\l decl_specifiers -> decl_specifiers . decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l"];
+ q84 [label="84:\l direct_declarator -> '(' declarator ')' . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q85 [label="85:\l pointer -> '*' opt_type_qualifiers pointer . { ')' ',' T_BRACKETS T_TYPEDEF_NAME T_IDENTIFIER '&' '(' }\l"];
+ q86 [label="86:\l type_qualifier_list -> type_qualifier_list type_qualifier . { ')' ',' T_BRACKETS T_TYPE_QUALIFIER T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q87 [label="87:\l declaration -> decl_specifiers . ';'\l declaration -> decl_specifiers . init_declarator_list ';'\l decl_specifiers -> decl_specifiers . decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l init_declarator_list -> . init_declarator\l init_declarator_list -> . init_declarator_list ',' init_declarator\l init_declarator -> . declarator\l init_declarator -> . declarator '=' $$5 T_INITIALIZER\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q88 [label="88:\l linkage_specification -> T_EXTERN T_STRING_LITERAL declaration . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q89 [label="89:\l linkage_specification -> T_EXTERN T_STRING_LITERAL braces . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q90 [label="90:\l external_declaration -> T_ASM T_ASMARG ';' . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q91 [label="91:\l declaration -> decl_specifiers init_declarator_list ';' . { ';' T_ASM T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q92 [label="92:\l init_declarator_list -> init_declarator_list ',' . init_declarator\l init_declarator -> . declarator\l init_declarator -> . declarator '=' $$5 T_INITIALIZER\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q93 [label="93:\l $$5 -> . { T_INITIALIZER }\l init_declarator -> declarator '=' . $$5 T_INITIALIZER\l"];
+ q94 [label="94:\l declaration -> . decl_specifiers ';'\l declaration -> . decl_specifiers init_declarator_list ';'\l declaration -> . any_typedef decl_specifiers $$1 opt_declarator_list ';'\l any_typedef -> . T_EXTENSION T_TYPEDEF\l any_typedef -> . T_TYPEDEF\l function_definition -> decl_specifiers declarator $$2 . opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE\l opt_declaration_list -> . { T_LBRACE }\l opt_declaration_list -> . T_VA_DCL\l opt_declaration_list -> . declaration_list\l declaration_list -> . declaration\l declaration_list -> . declaration_list declaration\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l"];
+ q95 [label="95:\l opt_declaration_list -> T_VA_DCL . { T_LBRACE }\l"];
+ q96 [label="96:\l declaration_list -> declaration . { T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l"];
+ q97 [label="97:\l function_definition -> declarator $$4 opt_declaration_list . T_LBRACE T_MATCHRBRACE\l"];
+ q98 [label="98:\l declaration -> . decl_specifiers ';'\l declaration -> . decl_specifiers init_declarator_list ';'\l declaration -> . any_typedef decl_specifiers $$1 opt_declarator_list ';'\l any_typedef -> . T_EXTENSION T_TYPEDEF\l any_typedef -> . T_TYPEDEF\l opt_declaration_list -> declaration_list . { T_LBRACE }\l declaration_list -> declaration_list . declaration\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l"];
+ q99 [label="99:\l decl_specifiers -> decl_specifiers . decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l parameter_declaration -> decl_specifiers . declarator\l parameter_declaration -> decl_specifiers . abs_declarator\l parameter_declaration -> decl_specifiers . { ')' ',' }\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l abs_declarator -> . pointer\l abs_declarator -> . pointer direct_abs_declarator\l abs_declarator -> . direct_abs_declarator\l direct_abs_declarator -> . '(' abs_declarator ')'\l direct_abs_declarator -> . direct_abs_declarator T_BRACKETS\l direct_abs_declarator -> . T_BRACKETS\l direct_abs_declarator -> . direct_abs_declarator '(' parameter_type_list ')'\l direct_abs_declarator -> . direct_abs_declarator '(' ')'\l direct_abs_declarator -> . '(' parameter_type_list ')'\l direct_abs_declarator -> . '(' ')'\l"];
+ q100 [label="100:\l direct_declarator -> direct_declarator '(' parameter_type_list . ')'\l"];
+ q101 [label="101:\l parameter_type_list -> parameter_list . { ')' }\l parameter_type_list -> parameter_list . ',' T_ELLIPSIS\l parameter_list -> parameter_list . ',' parameter_declaration\l"];
+ q102 [label="102:\l parameter_list -> parameter_declaration . { ')' ',' }\l"];
+ q103 [label="103:\l direct_declarator -> direct_declarator '(' opt_identifier_list . ')'\l"];
+ q104 [label="104:\l opt_identifier_list -> identifier_list . { ')' }\l identifier_list -> identifier_list . ',' any_id\l"];
+ q105 [label="105:\l identifier_list -> any_id . { ')' ',' }\l"];
+ q106 [label="106:\l braces -> T_LBRACE T_MATCHRBRACE . { ')' ',' ';' T_ASM T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q107 [label="107:\l struct_or_union_specifier -> struct_or_union any_id braces . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q108 [label="108:\l enum_specifier -> enumeration any_id braces . { ')' ',' ';' T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' }\l"];
+ q109 [label="109:\l declaration -> any_typedef decl_specifiers $$1 . opt_declarator_list ';'\l opt_declarator_list -> . { ';' }\l opt_declarator_list -> . declarator_list\l declarator_list -> . declarator\l declarator_list -> . declarator_list ',' declarator\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q110 [label="110:\l init_declarator -> declarator . { ',' ';' }\l init_declarator -> declarator . '=' $$5 T_INITIALIZER\l"];
+ q111 [label="111:\l init_declarator_list -> init_declarator_list ',' init_declarator . { ',' ';' }\l"];
+ q112 [label="112:\l init_declarator -> declarator '=' $$5 . T_INITIALIZER\l"];
+ q113 [label="113:\l function_definition -> decl_specifiers declarator $$2 opt_declaration_list . T_LBRACE $$3 T_MATCHRBRACE\l"];
+ q114 [label="114:\l function_definition -> declarator $$4 opt_declaration_list T_LBRACE . T_MATCHRBRACE\l"];
+ q115 [label="115:\l declaration_list -> declaration_list declaration . { T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME }\l"];
+ q116 [label="116:\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> '(' . declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l parameter_type_list -> . parameter_list\l parameter_type_list -> . parameter_list ',' T_ELLIPSIS\l parameter_list -> . parameter_declaration\l parameter_list -> . parameter_list ',' parameter_declaration\l parameter_declaration -> . decl_specifiers declarator\l parameter_declaration -> . decl_specifiers abs_declarator\l parameter_declaration -> . decl_specifiers\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l abs_declarator -> . pointer\l abs_declarator -> . pointer direct_abs_declarator\l abs_declarator -> . direct_abs_declarator\l direct_abs_declarator -> . '(' abs_declarator ')'\l direct_abs_declarator -> '(' . abs_declarator ')'\l direct_abs_declarator -> . direct_abs_declarator T_BRACKETS\l direct_abs_declarator -> . T_BRACKETS\l direct_abs_declarator -> . direct_abs_declarator '(' parameter_type_list ')'\l direct_abs_declarator -> . direct_abs_declarator '(' ')'\l direct_abs_declarator -> . '(' parameter_type_list ')'\l direct_abs_declarator -> '(' . parameter_type_list ')'\l direct_abs_declarator -> . '(' ')'\l direct_abs_declarator -> '(' . ')'\l"];
+ q117 [label="117:\l direct_abs_declarator -> T_BRACKETS . { ')' ',' T_BRACKETS '(' }\l"];
+ q118 [label="118:\l parameter_declaration -> decl_specifiers declarator . { ')' ',' }\l"];
+ q119 [label="119:\l parameter_declaration -> decl_specifiers abs_declarator . { ')' ',' }\l"];
+ q120 [label="120:\l abs_declarator -> direct_abs_declarator . { ')' ',' }\l direct_abs_declarator -> direct_abs_declarator . T_BRACKETS\l direct_abs_declarator -> direct_abs_declarator . '(' parameter_type_list ')'\l direct_abs_declarator -> direct_abs_declarator . '(' ')'\l"];
+ q121 [label="121:\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> pointer . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l abs_declarator -> pointer . { ')' ',' }\l abs_declarator -> pointer . direct_abs_declarator\l direct_abs_declarator -> . '(' abs_declarator ')'\l direct_abs_declarator -> . direct_abs_declarator T_BRACKETS\l direct_abs_declarator -> . T_BRACKETS\l direct_abs_declarator -> . direct_abs_declarator '(' parameter_type_list ')'\l direct_abs_declarator -> . direct_abs_declarator '(' ')'\l direct_abs_declarator -> . '(' parameter_type_list ')'\l direct_abs_declarator -> . '(' ')'\l"];
+ q122 [label="122:\l direct_declarator -> direct_declarator '(' parameter_type_list ')' . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q123 [label="123:\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l parameter_type_list -> parameter_list ',' . T_ELLIPSIS\l parameter_list -> parameter_list ',' . parameter_declaration\l parameter_declaration -> . decl_specifiers declarator\l parameter_declaration -> . decl_specifiers abs_declarator\l parameter_declaration -> . decl_specifiers\l"];
+ q124 [label="124:\l direct_declarator -> direct_declarator '(' opt_identifier_list ')' . { ')' '=' ',' ';' T_VA_DCL T_LBRACE T_BRACKETS T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME '(' }\l"];
+ q125 [label="125:\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l identifier_list -> identifier_list ',' . any_id\l"];
+ q126 [label="126:\l declarator_list -> declarator . { ',' ';' }\l"];
+ q127 [label="127:\l declaration -> any_typedef decl_specifiers $$1 opt_declarator_list . ';'\l"];
+ q128 [label="128:\l opt_declarator_list -> declarator_list . { ';' }\l declarator_list -> declarator_list . ',' declarator\l"];
+ q129 [label="129:\l init_declarator -> declarator '=' $$5 T_INITIALIZER . { ',' ';' }\l"];
+ q130 [label="130:\l $$3 -> . { T_MATCHRBRACE }\l function_definition -> decl_specifiers declarator $$2 opt_declaration_list T_LBRACE . $$3 T_MATCHRBRACE\l"];
+ q131 [label="131:\l function_definition -> declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q132 [label="132:\l direct_abs_declarator -> '(' ')' . { ')' ',' T_BRACKETS '(' }\l"];
+ q133 [label="133:\l direct_abs_declarator -> '(' abs_declarator . ')'\l"];
+ q134 [label="134:\l direct_abs_declarator -> '(' parameter_type_list . ')'\l"];
+ q135 [label="135:\l decl_specifiers -> . decl_specifier\l decl_specifiers -> . decl_specifiers decl_specifier\l decl_specifier -> . storage_class\l decl_specifier -> . type_specifier\l decl_specifier -> . type_qualifier\l storage_class -> . T_AUTO\l storage_class -> . T_EXTERN\l storage_class -> . T_REGISTER\l storage_class -> . T_STATIC\l storage_class -> . T_INLINE\l storage_class -> . T_EXTENSION\l type_specifier -> . T_CHAR\l type_specifier -> . T_DOUBLE\l type_specifier -> . T_FLOAT\l type_specifier -> . T_INT\l type_specifier -> . T_LONG\l type_specifier -> . T_SHORT\l type_specifier -> . T_SIGNED\l type_specifier -> . T_UNSIGNED\l type_specifier -> . T_VOID\l type_specifier -> . T_Bool\l type_specifier -> . T_Complex\l type_specifier -> . T_Imaginary\l type_specifier -> . T_TYPEDEF_NAME\l type_specifier -> . struct_or_union_specifier\l type_specifier -> . enum_specifier\l type_qualifier -> . T_TYPE_QUALIFIER\l type_qualifier -> . T_DEFINE_NAME\l struct_or_union_specifier -> . struct_or_union any_id braces\l struct_or_union_specifier -> . struct_or_union braces\l struct_or_union_specifier -> . struct_or_union any_id\l struct_or_union -> . T_STRUCT\l struct_or_union -> . T_UNION\l enum_specifier -> . enumeration any_id braces\l enum_specifier -> . enumeration braces\l enum_specifier -> . enumeration any_id\l enumeration -> . T_ENUM\l parameter_type_list -> . parameter_list\l parameter_type_list -> . parameter_list ',' T_ELLIPSIS\l parameter_list -> . parameter_declaration\l parameter_list -> . parameter_list ',' parameter_declaration\l parameter_declaration -> . decl_specifiers declarator\l parameter_declaration -> . decl_specifiers abs_declarator\l parameter_declaration -> . decl_specifiers\l direct_abs_declarator -> direct_abs_declarator '(' . parameter_type_list ')'\l direct_abs_declarator -> direct_abs_declarator '(' . ')'\l"];
+ q136 [label="136:\l direct_abs_declarator -> direct_abs_declarator T_BRACKETS . { ')' ',' T_BRACKETS '(' }\l"];
+ q137 [label="137:\l abs_declarator -> pointer direct_abs_declarator . { ')' ',' }\l direct_abs_declarator -> direct_abs_declarator . T_BRACKETS\l direct_abs_declarator -> direct_abs_declarator . '(' parameter_type_list ')'\l direct_abs_declarator -> direct_abs_declarator . '(' ')'\l"];
+ q138 [label="138:\l parameter_type_list -> parameter_list ',' T_ELLIPSIS . { ')' }\l"];
+ q139 [label="139:\l parameter_list -> parameter_list ',' parameter_declaration . { ')' ',' }\l"];
+ q140 [label="140:\l identifier_list -> identifier_list ',' any_id . { ')' ',' }\l"];
+ q141 [label="141:\l declaration -> any_typedef decl_specifiers $$1 opt_declarator_list ';' . { ';' T_ASM T_LBRACE T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q142 [label="142:\l declarator_list -> declarator_list ',' . declarator\l any_id -> . T_IDENTIFIER\l any_id -> . T_TYPEDEF_NAME\l declarator -> . pointer direct_declarator\l declarator -> . direct_declarator\l direct_declarator -> . identifier_or_ref\l direct_declarator -> . '(' declarator ')'\l direct_declarator -> . direct_declarator T_BRACKETS\l direct_declarator -> . direct_declarator '(' parameter_type_list ')'\l direct_declarator -> . direct_declarator '(' opt_identifier_list ')'\l pointer -> . '*' opt_type_qualifiers\l pointer -> . '*' opt_type_qualifiers pointer\l identifier_or_ref -> . any_id\l identifier_or_ref -> . '&' any_id\l"];
+ q143 [label="143:\l function_definition -> decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 . T_MATCHRBRACE\l"];
+ q144 [label="144:\l direct_abs_declarator -> '(' abs_declarator ')' . { ')' ',' T_BRACKETS '(' }\l"];
+ q145 [label="145:\l direct_abs_declarator -> '(' parameter_type_list ')' . { ')' ',' T_BRACKETS '(' }\l"];
+ q146 [label="146:\l direct_abs_declarator -> direct_abs_declarator '(' ')' . { ')' ',' T_BRACKETS '(' }\l"];
+ q147 [label="147:\l direct_abs_declarator -> direct_abs_declarator '(' parameter_type_list . ')'\l"];
+ q148 [label="148:\l declarator_list -> declarator_list ',' declarator . { ',' ';' }\l"];
+ q149 [label="149:\l function_definition -> decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE . { ';' T_ASM T_TYPE_QUALIFIER T_Imaginary T_Complex T_Bool T_UNION T_STRUCT T_ENUM T_UNSIGNED T_SIGNED T_SHORT T_LONG T_VOID T_INT T_FLOAT T_DOUBLE T_CHAR T_EXTENSION T_INLINE T_TYPEDEF T_STATIC T_REGISTER T_EXTERN T_AUTO T_DEFINE_NAME T_TYPEDEF_NAME T_IDENTIFIER '&' '*' '(' error $end }\l"];
+ q150 [label="150:\l direct_abs_declarator -> direct_abs_declarator '(' parameter_type_list ')' . { ')' ',' T_BRACKETS '(' }\l"];
+
+ q0 -> q1 [label="error"];
+ q0 -> q2 [label="'('"];
+ q0 -> q3 [label="'*'"];
+ q0 -> q4 [label="'&'"];
+ q0 -> q5 [label="T_IDENTIFIER"];
+ q0 -> q6 [label="T_TYPEDEF_NAME"];
+ q0 -> q7 [label="T_DEFINE_NAME"];
+ q0 -> q8 [label="T_AUTO"];
+ q0 -> q9 [label="T_EXTERN"];
+ q0 -> q10 [label="T_REGISTER"];
+ q0 -> q11 [label="T_STATIC"];
+ q0 -> q12 [label="T_TYPEDEF"];
+ q0 -> q13 [label="T_INLINE"];
+ q0 -> q14 [label="T_EXTENSION"];
+ q0 -> q15 [label="T_CHAR"];
+ q0 -> q16 [label="T_DOUBLE"];
+ q0 -> q17 [label="T_FLOAT"];
+ q0 -> q18 [label="T_INT"];
+ q0 -> q19 [label="T_VOID"];
+ q0 -> q20 [label="T_LONG"];
+ q0 -> q21 [label="T_SHORT"];
+ q0 -> q22 [label="T_SIGNED"];
+ q0 -> q23 [label="T_UNSIGNED"];
+ q0 -> q24 [label="T_ENUM"];
+ q0 -> q25 [label="T_STRUCT"];
+ q0 -> q26 [label="T_UNION"];
+ q0 -> q27 [label="T_Bool"];
+ q0 -> q28 [label="T_Complex"];
+ q0 -> q29 [label="T_Imaginary"];
+ q0 -> q30 [label="T_TYPE_QUALIFIER"];
+ q0 -> q31 [label="T_ASM"];
+ q0 -> q32 [label="';'"];
+ q0 -> q33 [label="program"];
+ q0 -> q34 [label="decl_specifiers"];
+ q0 -> q35 [label="decl_specifier"];
+ q0 -> q36 [label="storage_class"];
+ q0 -> q37 [label="type_specifier"];
+ q0 -> q38 [label="type_qualifier"];
+ q0 -> q39 [label="struct_or_union_specifier"];
+ q0 -> q40 [label="enum_specifier"];
+ q0 -> q41 [label="declarator"];
+ q0 -> q42 [label="direct_declarator"];
+ q0 -> q43 [label="struct_or_union"];
+ q0 -> q44 [label="pointer"];
+ q0 -> q45 [label="any_id"];
+ q0 -> q46 [label="identifier_or_ref"];
+ q0 -> q47 [label="enumeration"];
+ q0 -> q48 [label="translation_unit"];
+ q0 -> q49 [label="external_declaration"];
+ q0 -> q50 [label="declaration"];
+ q0 -> q51 [label="function_definition"];
+ q0 -> q52 [label="linkage_specification"];
+ q0 -> q53 [label="any_typedef"];
+ q1 -> q54 [label="T_MATCHRBRACE"];
+ q1 -> q55 [label="';'"];
+ q2 -> q2 [label="'('"];
+ q2 -> q3 [label="'*'"];
+ q2 -> q4 [label="'&'"];
+ q2 -> q5 [label="T_IDENTIFIER"];
+ q2 -> q56 [label="T_TYPEDEF_NAME"];
+ q2 -> q57 [label="declarator"];
+ q2 -> q42 [label="direct_declarator"];
+ q2 -> q44 [label="pointer"];
+ q2 -> q45 [label="any_id"];
+ q2 -> q46 [label="identifier_or_ref"];
+ q3 -> q7 [label="T_DEFINE_NAME"];
+ q3 -> q30 [label="T_TYPE_QUALIFIER"];
+ q3 -> q58 [label="type_qualifier"];
+ q3 -> q59 [label="opt_type_qualifiers"];
+ q3 -> q60 [label="type_qualifier_list"];
+ q4 -> q5 [label="T_IDENTIFIER"];
+ q4 -> q56 [label="T_TYPEDEF_NAME"];
+ q4 -> q61 [label="any_id"];
+ q9 -> q62 [label="T_STRING_LITERAL"];
+ q14 -> q63 [label="T_TYPEDEF"];
+ q31 -> q64 [label="T_ASMARG"];
+ q34 -> q2 [label="'('"];
+ q34 -> q3 [label="'*'"];
+ q34 -> q4 [label="'&'"];
+ q34 -> q5 [label="T_IDENTIFIER"];
+ q34 -> q6 [label="T_TYPEDEF_NAME"];
+ q34 -> q7 [label="T_DEFINE_NAME"];
+ q34 -> q8 [label="T_AUTO"];
+ q34 -> q65 [label="T_EXTERN"];
+ q34 -> q10 [label="T_REGISTER"];
+ q34 -> q11 [label="T_STATIC"];
+ q34 -> q13 [label="T_INLINE"];
+ q34 -> q66 [label="T_EXTENSION"];
+ q34 -> q15 [label="T_CHAR"];
+ q34 -> q16 [label="T_DOUBLE"];
+ q34 -> q17 [label="T_FLOAT"];
+ q34 -> q18 [label="T_INT"];
+ q34 -> q19 [label="T_VOID"];
+ q34 -> q20 [label="T_LONG"];
+ q34 -> q21 [label="T_SHORT"];
+ q34 -> q22 [label="T_SIGNED"];
+ q34 -> q23 [label="T_UNSIGNED"];
+ q34 -> q24 [label="T_ENUM"];
+ q34 -> q25 [label="T_STRUCT"];
+ q34 -> q26 [label="T_UNION"];
+ q34 -> q27 [label="T_Bool"];
+ q34 -> q28 [label="T_Complex"];
+ q34 -> q29 [label="T_Imaginary"];
+ q34 -> q30 [label="T_TYPE_QUALIFIER"];
+ q34 -> q67 [label="';'"];
+ q34 -> q68 [label="decl_specifier"];
+ q34 -> q36 [label="storage_class"];
+ q34 -> q37 [label="type_specifier"];
+ q34 -> q38 [label="type_qualifier"];
+ q34 -> q39 [label="struct_or_union_specifier"];
+ q34 -> q40 [label="enum_specifier"];
+ q34 -> q69 [label="init_declarator_list"];
+ q34 -> q70 [label="init_declarator"];
+ q34 -> q71 [label="declarator"];
+ q34 -> q42 [label="direct_declarator"];
+ q34 -> q43 [label="struct_or_union"];
+ q34 -> q44 [label="pointer"];
+ q34 -> q45 [label="any_id"];
+ q34 -> q46 [label="identifier_or_ref"];
+ q34 -> q47 [label="enumeration"];
+ q41 -> q72 [label="$$4"];
+ q42 -> q73 [label="'('"];
+ q42 -> q74 [label="T_BRACKETS"];
+ q43 -> q5 [label="T_IDENTIFIER"];
+ q43 -> q56 [label="T_TYPEDEF_NAME"];
+ q43 -> q75 [label="T_LBRACE"];
+ q43 -> q76 [label="any_id"];
+ q43 -> q77 [label="braces"];
+ q44 -> q2 [label="'('"];
+ q44 -> q4 [label="'&'"];
+ q44 -> q5 [label="T_IDENTIFIER"];
+ q44 -> q56 [label="T_TYPEDEF_NAME"];
+ q44 -> q78 [label="direct_declarator"];
+ q44 -> q45 [label="any_id"];
+ q44 -> q46 [label="identifier_or_ref"];
+ q47 -> q5 [label="T_IDENTIFIER"];
+ q47 -> q56 [label="T_TYPEDEF_NAME"];
+ q47 -> q75 [label="T_LBRACE"];
+ q47 -> q79 [label="any_id"];
+ q47 -> q80 [label="braces"];
+ q48 -> q1 [label="error"];
+ q48 -> q2 [label="'('"];
+ q48 -> q3 [label="'*'"];
+ q48 -> q4 [label="'&'"];
+ q48 -> q5 [label="T_IDENTIFIER"];
+ q48 -> q6 [label="T_TYPEDEF_NAME"];
+ q48 -> q7 [label="T_DEFINE_NAME"];
+ q48 -> q8 [label="T_AUTO"];
+ q48 -> q9 [label="T_EXTERN"];
+ q48 -> q10 [label="T_REGISTER"];
+ q48 -> q11 [label="T_STATIC"];
+ q48 -> q12 [label="T_TYPEDEF"];
+ q48 -> q13 [label="T_INLINE"];
+ q48 -> q14 [label="T_EXTENSION"];
+ q48 -> q15 [label="T_CHAR"];
+ q48 -> q16 [label="T_DOUBLE"];
+ q48 -> q17 [label="T_FLOAT"];
+ q48 -> q18 [label="T_INT"];
+ q48 -> q19 [label="T_VOID"];
+ q48 -> q20 [label="T_LONG"];
+ q48 -> q21 [label="T_SHORT"];
+ q48 -> q22 [label="T_SIGNED"];
+ q48 -> q23 [label="T_UNSIGNED"];
+ q48 -> q24 [label="T_ENUM"];
+ q48 -> q25 [label="T_STRUCT"];
+ q48 -> q26 [label="T_UNION"];
+ q48 -> q27 [label="T_Bool"];
+ q48 -> q28 [label="T_Complex"];
+ q48 -> q29 [label="T_Imaginary"];
+ q48 -> q30 [label="T_TYPE_QUALIFIER"];
+ q48 -> q31 [label="T_ASM"];
+ q48 -> q32 [label="';'"];
+ q48 -> q34 [label="decl_specifiers"];
+ q48 -> q35 [label="decl_specifier"];
+ q48 -> q36 [label="storage_class"];
+ q48 -> q37 [label="type_specifier"];
+ q48 -> q38 [label="type_qualifier"];
+ q48 -> q39 [label="struct_or_union_specifier"];
+ q48 -> q40 [label="enum_specifier"];
+ q48 -> q41 [label="declarator"];
+ q48 -> q42 [label="direct_declarator"];
+ q48 -> q43 [label="struct_or_union"];
+ q48 -> q44 [label="pointer"];
+ q48 -> q45 [label="any_id"];
+ q48 -> q46 [label="identifier_or_ref"];
+ q48 -> q47 [label="enumeration"];
+ q48 -> q81 [label="external_declaration"];
+ q48 -> q50 [label="declaration"];
+ q48 -> q51 [label="function_definition"];
+ q48 -> q52 [label="linkage_specification"];
+ q48 -> q53 [label="any_typedef"];
+ q53 -> q82 [label="T_TYPEDEF_NAME"];
+ q53 -> q7 [label="T_DEFINE_NAME"];
+ q53 -> q8 [label="T_AUTO"];
+ q53 -> q65 [label="T_EXTERN"];
+ q53 -> q10 [label="T_REGISTER"];
+ q53 -> q11 [label="T_STATIC"];
+ q53 -> q13 [label="T_INLINE"];
+ q53 -> q66 [label="T_EXTENSION"];
+ q53 -> q15 [label="T_CHAR"];
+ q53 -> q16 [label="T_DOUBLE"];
+ q53 -> q17 [label="T_FLOAT"];
+ q53 -> q18 [label="T_INT"];
+ q53 -> q19 [label="T_VOID"];
+ q53 -> q20 [label="T_LONG"];
+ q53 -> q21 [label="T_SHORT"];
+ q53 -> q22 [label="T_SIGNED"];
+ q53 -> q23 [label="T_UNSIGNED"];
+ q53 -> q24 [label="T_ENUM"];
+ q53 -> q25 [label="T_STRUCT"];
+ q53 -> q26 [label="T_UNION"];
+ q53 -> q27 [label="T_Bool"];
+ q53 -> q28 [label="T_Complex"];
+ q53 -> q29 [label="T_Imaginary"];
+ q53 -> q30 [label="T_TYPE_QUALIFIER"];
+ q53 -> q83 [label="decl_specifiers"];
+ q53 -> q35 [label="decl_specifier"];
+ q53 -> q36 [label="storage_class"];
+ q53 -> q37 [label="type_specifier"];
+ q53 -> q38 [label="type_qualifier"];
+ q53 -> q39 [label="struct_or_union_specifier"];
+ q53 -> q40 [label="enum_specifier"];
+ q53 -> q43 [label="struct_or_union"];
+ q53 -> q47 [label="enumeration"];
+ q57 -> q84 [label="')'"];
+ q59 -> q3 [label="'*'"];
+ q59 -> q85 [label="pointer"];
+ q60 -> q7 [label="T_DEFINE_NAME"];
+ q60 -> q30 [label="T_TYPE_QUALIFIER"];
+ q60 -> q86 [label="type_qualifier"];
+ q62 -> q82 [label="T_TYPEDEF_NAME"];
+ q62 -> q7 [label="T_DEFINE_NAME"];
+ q62 -> q8 [label="T_AUTO"];
+ q62 -> q65 [label="T_EXTERN"];
+ q62 -> q10 [label="T_REGISTER"];
+ q62 -> q11 [label="T_STATIC"];
+ q62 -> q12 [label="T_TYPEDEF"];
+ q62 -> q13 [label="T_INLINE"];
+ q62 -> q14 [label="T_EXTENSION"];
+ q62 -> q15 [label="T_CHAR"];
+ q62 -> q16 [label="T_DOUBLE"];
+ q62 -> q17 [label="T_FLOAT"];
+ q62 -> q18 [label="T_INT"];
+ q62 -> q19 [label="T_VOID"];
+ q62 -> q20 [label="T_LONG"];
+ q62 -> q21 [label="T_SHORT"];
+ q62 -> q22 [label="T_SIGNED"];
+ q62 -> q23 [label="T_UNSIGNED"];
+ q62 -> q24 [label="T_ENUM"];
+ q62 -> q25 [label="T_STRUCT"];
+ q62 -> q26 [label="T_UNION"];
+ q62 -> q27 [label="T_Bool"];
+ q62 -> q28 [label="T_Complex"];
+ q62 -> q29 [label="T_Imaginary"];
+ q62 -> q30 [label="T_TYPE_QUALIFIER"];
+ q62 -> q75 [label="T_LBRACE"];
+ q62 -> q87 [label="decl_specifiers"];
+ q62 -> q35 [label="decl_specifier"];
+ q62 -> q36 [label="storage_class"];
+ q62 -> q37 [label="type_specifier"];
+ q62 -> q38 [label="type_qualifier"];
+ q62 -> q39 [label="struct_or_union_specifier"];
+ q62 -> q40 [label="enum_specifier"];
+ q62 -> q43 [label="struct_or_union"];
+ q62 -> q47 [label="enumeration"];
+ q62 -> q88 [label="declaration"];
+ q62 -> q89 [label="braces"];
+ q62 -> q53 [label="any_typedef"];
+ q64 -> q90 [label="';'"];
+ q69 -> q91 [label="';'"];
+ q69 -> q92 [label="','"];
+ q71 -> q93 [label="'='"];
+ q71 -> q94 [label="$$2"];
+ q72 -> q82 [label="T_TYPEDEF_NAME"];
+ q72 -> q7 [label="T_DEFINE_NAME"];
+ q72 -> q8 [label="T_AUTO"];
+ q72 -> q65 [label="T_EXTERN"];
+ q72 -> q10 [label="T_REGISTER"];
+ q72 -> q11 [label="T_STATIC"];
+ q72 -> q12 [label="T_TYPEDEF"];
+ q72 -> q13 [label="T_INLINE"];
+ q72 -> q14 [label="T_EXTENSION"];
+ q72 -> q15 [label="T_CHAR"];
+ q72 -> q16 [label="T_DOUBLE"];
+ q72 -> q17 [label="T_FLOAT"];
+ q72 -> q18 [label="T_INT"];
+ q72 -> q19 [label="T_VOID"];
+ q72 -> q20 [label="T_LONG"];
+ q72 -> q21 [label="T_SHORT"];
+ q72 -> q22 [label="T_SIGNED"];
+ q72 -> q23 [label="T_UNSIGNED"];
+ q72 -> q24 [label="T_ENUM"];
+ q72 -> q25 [label="T_STRUCT"];
+ q72 -> q26 [label="T_UNION"];
+ q72 -> q27 [label="T_Bool"];
+ q72 -> q28 [label="T_Complex"];
+ q72 -> q29 [label="T_Imaginary"];
+ q72 -> q30 [label="T_TYPE_QUALIFIER"];
+ q72 -> q95 [label="T_VA_DCL"];
+ q72 -> q87 [label="decl_specifiers"];
+ q72 -> q35 [label="decl_specifier"];
+ q72 -> q36 [label="storage_class"];
+ q72 -> q37 [label="type_specifier"];
+ q72 -> q38 [label="type_qualifier"];
+ q72 -> q39 [label="struct_or_union_specifier"];
+ q72 -> q40 [label="enum_specifier"];
+ q72 -> q43 [label="struct_or_union"];
+ q72 -> q47 [label="enumeration"];
+ q72 -> q96 [label="declaration"];
+ q72 -> q53 [label="any_typedef"];
+ q72 -> q97 [label="opt_declaration_list"];
+ q72 -> q98 [label="declaration_list"];
+ q73 -> q5 [label="T_IDENTIFIER"];
+ q73 -> q6 [label="T_TYPEDEF_NAME"];
+ q73 -> q7 [label="T_DEFINE_NAME"];
+ q73 -> q8 [label="T_AUTO"];
+ q73 -> q65 [label="T_EXTERN"];
+ q73 -> q10 [label="T_REGISTER"];
+ q73 -> q11 [label="T_STATIC"];
+ q73 -> q13 [label="T_INLINE"];
+ q73 -> q66 [label="T_EXTENSION"];
+ q73 -> q15 [label="T_CHAR"];
+ q73 -> q16 [label="T_DOUBLE"];
+ q73 -> q17 [label="T_FLOAT"];
+ q73 -> q18 [label="T_INT"];
+ q73 -> q19 [label="T_VOID"];
+ q73 -> q20 [label="T_LONG"];
+ q73 -> q21 [label="T_SHORT"];
+ q73 -> q22 [label="T_SIGNED"];
+ q73 -> q23 [label="T_UNSIGNED"];
+ q73 -> q24 [label="T_ENUM"];
+ q73 -> q25 [label="T_STRUCT"];
+ q73 -> q26 [label="T_UNION"];
+ q73 -> q27 [label="T_Bool"];
+ q73 -> q28 [label="T_Complex"];
+ q73 -> q29 [label="T_Imaginary"];
+ q73 -> q30 [label="T_TYPE_QUALIFIER"];
+ q73 -> q99 [label="decl_specifiers"];
+ q73 -> q35 [label="decl_specifier"];
+ q73 -> q36 [label="storage_class"];
+ q73 -> q37 [label="type_specifier"];
+ q73 -> q38 [label="type_qualifier"];
+ q73 -> q39 [label="struct_or_union_specifier"];
+ q73 -> q40 [label="enum_specifier"];
+ q73 -> q100 [label="parameter_type_list"];
+ q73 -> q101 [label="parameter_list"];
+ q73 -> q102 [label="parameter_declaration"];
+ q73 -> q103 [label="opt_identifier_list"];
+ q73 -> q104 [label="identifier_list"];
+ q73 -> q43 [label="struct_or_union"];
+ q73 -> q105 [label="any_id"];
+ q73 -> q47 [label="enumeration"];
+ q75 -> q106 [label="T_MATCHRBRACE"];
+ q76 -> q75 [label="T_LBRACE"];
+ q76 -> q107 [label="braces"];
+ q78 -> q73 [label="'('"];
+ q78 -> q74 [label="T_BRACKETS"];
+ q79 -> q75 [label="T_LBRACE"];
+ q79 -> q108 [label="braces"];
+ q83 -> q82 [label="T_TYPEDEF_NAME"];
+ q83 -> q7 [label="T_DEFINE_NAME"];
+ q83 -> q8 [label="T_AUTO"];
+ q83 -> q65 [label="T_EXTERN"];
+ q83 -> q10 [label="T_REGISTER"];
+ q83 -> q11 [label="T_STATIC"];
+ q83 -> q13 [label="T_INLINE"];
+ q83 -> q66 [label="T_EXTENSION"];
+ q83 -> q15 [label="T_CHAR"];
+ q83 -> q16 [label="T_DOUBLE"];
+ q83 -> q17 [label="T_FLOAT"];
+ q83 -> q18 [label="T_INT"];
+ q83 -> q19 [label="T_VOID"];
+ q83 -> q20 [label="T_LONG"];
+ q83 -> q21 [label="T_SHORT"];
+ q83 -> q22 [label="T_SIGNED"];
+ q83 -> q23 [label="T_UNSIGNED"];
+ q83 -> q24 [label="T_ENUM"];
+ q83 -> q25 [label="T_STRUCT"];
+ q83 -> q26 [label="T_UNION"];
+ q83 -> q27 [label="T_Bool"];
+ q83 -> q28 [label="T_Complex"];
+ q83 -> q29 [label="T_Imaginary"];
+ q83 -> q30 [label="T_TYPE_QUALIFIER"];
+ q83 -> q68 [label="decl_specifier"];
+ q83 -> q36 [label="storage_class"];
+ q83 -> q37 [label="type_specifier"];
+ q83 -> q38 [label="type_qualifier"];
+ q83 -> q39 [label="struct_or_union_specifier"];
+ q83 -> q40 [label="enum_specifier"];
+ q83 -> q43 [label="struct_or_union"];
+ q83 -> q47 [label="enumeration"];
+ q83 -> q109 [label="$$1"];
+ q87 -> q2 [label="'('"];
+ q87 -> q3 [label="'*'"];
+ q87 -> q4 [label="'&'"];
+ q87 -> q5 [label="T_IDENTIFIER"];
+ q87 -> q6 [label="T_TYPEDEF_NAME"];
+ q87 -> q7 [label="T_DEFINE_NAME"];
+ q87 -> q8 [label="T_AUTO"];
+ q87 -> q65 [label="T_EXTERN"];
+ q87 -> q10 [label="T_REGISTER"];
+ q87 -> q11 [label="T_STATIC"];
+ q87 -> q13 [label="T_INLINE"];
+ q87 -> q66 [label="T_EXTENSION"];
+ q87 -> q15 [label="T_CHAR"];
+ q87 -> q16 [label="T_DOUBLE"];
+ q87 -> q17 [label="T_FLOAT"];
+ q87 -> q18 [label="T_INT"];
+ q87 -> q19 [label="T_VOID"];
+ q87 -> q20 [label="T_LONG"];
+ q87 -> q21 [label="T_SHORT"];
+ q87 -> q22 [label="T_SIGNED"];
+ q87 -> q23 [label="T_UNSIGNED"];
+ q87 -> q24 [label="T_ENUM"];
+ q87 -> q25 [label="T_STRUCT"];
+ q87 -> q26 [label="T_UNION"];
+ q87 -> q27 [label="T_Bool"];
+ q87 -> q28 [label="T_Complex"];
+ q87 -> q29 [label="T_Imaginary"];
+ q87 -> q30 [label="T_TYPE_QUALIFIER"];
+ q87 -> q67 [label="';'"];
+ q87 -> q68 [label="decl_specifier"];
+ q87 -> q36 [label="storage_class"];
+ q87 -> q37 [label="type_specifier"];
+ q87 -> q38 [label="type_qualifier"];
+ q87 -> q39 [label="struct_or_union_specifier"];
+ q87 -> q40 [label="enum_specifier"];
+ q87 -> q69 [label="init_declarator_list"];
+ q87 -> q70 [label="init_declarator"];
+ q87 -> q110 [label="declarator"];
+ q87 -> q42 [label="direct_declarator"];
+ q87 -> q43 [label="struct_or_union"];
+ q87 -> q44 [label="pointer"];
+ q87 -> q45 [label="any_id"];
+ q87 -> q46 [label="identifier_or_ref"];
+ q87 -> q47 [label="enumeration"];
+ q92 -> q2 [label="'('"];
+ q92 -> q3 [label="'*'"];
+ q92 -> q4 [label="'&'"];
+ q92 -> q5 [label="T_IDENTIFIER"];
+ q92 -> q56 [label="T_TYPEDEF_NAME"];
+ q92 -> q111 [label="init_declarator"];
+ q92 -> q110 [label="declarator"];
+ q92 -> q42 [label="direct_declarator"];
+ q92 -> q44 [label="pointer"];
+ q92 -> q45 [label="any_id"];
+ q92 -> q46 [label="identifier_or_ref"];
+ q93 -> q112 [label="$$5"];
+ q94 -> q82 [label="T_TYPEDEF_NAME"];
+ q94 -> q7 [label="T_DEFINE_NAME"];
+ q94 -> q8 [label="T_AUTO"];
+ q94 -> q65 [label="T_EXTERN"];
+ q94 -> q10 [label="T_REGISTER"];
+ q94 -> q11 [label="T_STATIC"];
+ q94 -> q12 [label="T_TYPEDEF"];
+ q94 -> q13 [label="T_INLINE"];
+ q94 -> q14 [label="T_EXTENSION"];
+ q94 -> q15 [label="T_CHAR"];
+ q94 -> q16 [label="T_DOUBLE"];
+ q94 -> q17 [label="T_FLOAT"];
+ q94 -> q18 [label="T_INT"];
+ q94 -> q19 [label="T_VOID"];
+ q94 -> q20 [label="T_LONG"];
+ q94 -> q21 [label="T_SHORT"];
+ q94 -> q22 [label="T_SIGNED"];
+ q94 -> q23 [label="T_UNSIGNED"];
+ q94 -> q24 [label="T_ENUM"];
+ q94 -> q25 [label="T_STRUCT"];
+ q94 -> q26 [label="T_UNION"];
+ q94 -> q27 [label="T_Bool"];
+ q94 -> q28 [label="T_Complex"];
+ q94 -> q29 [label="T_Imaginary"];
+ q94 -> q30 [label="T_TYPE_QUALIFIER"];
+ q94 -> q95 [label="T_VA_DCL"];
+ q94 -> q87 [label="decl_specifiers"];
+ q94 -> q35 [label="decl_specifier"];
+ q94 -> q36 [label="storage_class"];
+ q94 -> q37 [label="type_specifier"];
+ q94 -> q38 [label="type_qualifier"];
+ q94 -> q39 [label="struct_or_union_specifier"];
+ q94 -> q40 [label="enum_specifier"];
+ q94 -> q43 [label="struct_or_union"];
+ q94 -> q47 [label="enumeration"];
+ q94 -> q96 [label="declaration"];
+ q94 -> q53 [label="any_typedef"];
+ q94 -> q113 [label="opt_declaration_list"];
+ q94 -> q98 [label="declaration_list"];
+ q97 -> q114 [label="T_LBRACE"];
+ q98 -> q82 [label="T_TYPEDEF_NAME"];
+ q98 -> q7 [label="T_DEFINE_NAME"];
+ q98 -> q8 [label="T_AUTO"];
+ q98 -> q65 [label="T_EXTERN"];
+ q98 -> q10 [label="T_REGISTER"];
+ q98 -> q11 [label="T_STATIC"];
+ q98 -> q12 [label="T_TYPEDEF"];
+ q98 -> q13 [label="T_INLINE"];
+ q98 -> q14 [label="T_EXTENSION"];
+ q98 -> q15 [label="T_CHAR"];
+ q98 -> q16 [label="T_DOUBLE"];
+ q98 -> q17 [label="T_FLOAT"];
+ q98 -> q18 [label="T_INT"];
+ q98 -> q19 [label="T_VOID"];
+ q98 -> q20 [label="T_LONG"];
+ q98 -> q21 [label="T_SHORT"];
+ q98 -> q22 [label="T_SIGNED"];
+ q98 -> q23 [label="T_UNSIGNED"];
+ q98 -> q24 [label="T_ENUM"];
+ q98 -> q25 [label="T_STRUCT"];
+ q98 -> q26 [label="T_UNION"];
+ q98 -> q27 [label="T_Bool"];
+ q98 -> q28 [label="T_Complex"];
+ q98 -> q29 [label="T_Imaginary"];
+ q98 -> q30 [label="T_TYPE_QUALIFIER"];
+ q98 -> q87 [label="decl_specifiers"];
+ q98 -> q35 [label="decl_specifier"];
+ q98 -> q36 [label="storage_class"];
+ q98 -> q37 [label="type_specifier"];
+ q98 -> q38 [label="type_qualifier"];
+ q98 -> q39 [label="struct_or_union_specifier"];
+ q98 -> q40 [label="enum_specifier"];
+ q98 -> q43 [label="struct_or_union"];
+ q98 -> q47 [label="enumeration"];
+ q98 -> q115 [label="declaration"];
+ q98 -> q53 [label="any_typedef"];
+ q99 -> q116 [label="'('"];
+ q99 -> q3 [label="'*'"];
+ q99 -> q4 [label="'&'"];
+ q99 -> q5 [label="T_IDENTIFIER"];
+ q99 -> q6 [label="T_TYPEDEF_NAME"];
+ q99 -> q7 [label="T_DEFINE_NAME"];
+ q99 -> q8 [label="T_AUTO"];
+ q99 -> q65 [label="T_EXTERN"];
+ q99 -> q10 [label="T_REGISTER"];
+ q99 -> q11 [label="T_STATIC"];
+ q99 -> q13 [label="T_INLINE"];
+ q99 -> q66 [label="T_EXTENSION"];
+ q99 -> q15 [label="T_CHAR"];
+ q99 -> q16 [label="T_DOUBLE"];
+ q99 -> q17 [label="T_FLOAT"];
+ q99 -> q18 [label="T_INT"];
+ q99 -> q19 [label="T_VOID"];
+ q99 -> q20 [label="T_LONG"];
+ q99 -> q21 [label="T_SHORT"];
+ q99 -> q22 [label="T_SIGNED"];
+ q99 -> q23 [label="T_UNSIGNED"];
+ q99 -> q24 [label="T_ENUM"];
+ q99 -> q25 [label="T_STRUCT"];
+ q99 -> q26 [label="T_UNION"];
+ q99 -> q27 [label="T_Bool"];
+ q99 -> q28 [label="T_Complex"];
+ q99 -> q29 [label="T_Imaginary"];
+ q99 -> q30 [label="T_TYPE_QUALIFIER"];
+ q99 -> q117 [label="T_BRACKETS"];
+ q99 -> q68 [label="decl_specifier"];
+ q99 -> q36 [label="storage_class"];
+ q99 -> q37 [label="type_specifier"];
+ q99 -> q38 [label="type_qualifier"];
+ q99 -> q39 [label="struct_or_union_specifier"];
+ q99 -> q40 [label="enum_specifier"];
+ q99 -> q118 [label="declarator"];
+ q99 -> q42 [label="direct_declarator"];
+ q99 -> q119 [label="abs_declarator"];
+ q99 -> q120 [label="direct_abs_declarator"];
+ q99 -> q43 [label="struct_or_union"];
+ q99 -> q121 [label="pointer"];
+ q99 -> q45 [label="any_id"];
+ q99 -> q46 [label="identifier_or_ref"];
+ q99 -> q47 [label="enumeration"];
+ q100 -> q122 [label="')'"];
+ q101 -> q123 [label="','"];
+ q103 -> q124 [label="')'"];
+ q104 -> q125 [label="','"];
+ q109 -> q2 [label="'('"];
+ q109 -> q3 [label="'*'"];
+ q109 -> q4 [label="'&'"];
+ q109 -> q5 [label="T_IDENTIFIER"];
+ q109 -> q56 [label="T_TYPEDEF_NAME"];
+ q109 -> q126 [label="declarator"];
+ q109 -> q42 [label="direct_declarator"];
+ q109 -> q44 [label="pointer"];
+ q109 -> q45 [label="any_id"];
+ q109 -> q46 [label="identifier_or_ref"];
+ q109 -> q127 [label="opt_declarator_list"];
+ q109 -> q128 [label="declarator_list"];
+ q110 -> q93 [label="'='"];
+ q112 -> q129 [label="T_INITIALIZER"];
+ q113 -> q130 [label="T_LBRACE"];
+ q114 -> q131 [label="T_MATCHRBRACE"];
+ q116 -> q116 [label="'('"];
+ q116 -> q3 [label="'*'"];
+ q116 -> q4 [label="'&'"];
+ q116 -> q5 [label="T_IDENTIFIER"];
+ q116 -> q6 [label="T_TYPEDEF_NAME"];
+ q116 -> q7 [label="T_DEFINE_NAME"];
+ q116 -> q8 [label="T_AUTO"];
+ q116 -> q65 [label="T_EXTERN"];
+ q116 -> q10 [label="T_REGISTER"];
+ q116 -> q11 [label="T_STATIC"];
+ q116 -> q13 [label="T_INLINE"];
+ q116 -> q66 [label="T_EXTENSION"];
+ q116 -> q15 [label="T_CHAR"];
+ q116 -> q16 [label="T_DOUBLE"];
+ q116 -> q17 [label="T_FLOAT"];
+ q116 -> q18 [label="T_INT"];
+ q116 -> q19 [label="T_VOID"];
+ q116 -> q20 [label="T_LONG"];
+ q116 -> q21 [label="T_SHORT"];
+ q116 -> q22 [label="T_SIGNED"];
+ q116 -> q23 [label="T_UNSIGNED"];
+ q116 -> q24 [label="T_ENUM"];
+ q116 -> q25 [label="T_STRUCT"];
+ q116 -> q26 [label="T_UNION"];
+ q116 -> q27 [label="T_Bool"];
+ q116 -> q28 [label="T_Complex"];
+ q116 -> q29 [label="T_Imaginary"];
+ q116 -> q30 [label="T_TYPE_QUALIFIER"];
+ q116 -> q117 [label="T_BRACKETS"];
+ q116 -> q132 [label="')'"];
+ q116 -> q99 [label="decl_specifiers"];
+ q116 -> q35 [label="decl_specifier"];
+ q116 -> q36 [label="storage_class"];
+ q116 -> q37 [label="type_specifier"];
+ q116 -> q38 [label="type_qualifier"];
+ q116 -> q39 [label="struct_or_union_specifier"];
+ q116 -> q40 [label="enum_specifier"];
+ q116 -> q57 [label="declarator"];
+ q116 -> q42 [label="direct_declarator"];
+ q116 -> q133 [label="abs_declarator"];
+ q116 -> q120 [label="direct_abs_declarator"];
+ q116 -> q134 [label="parameter_type_list"];
+ q116 -> q101 [label="parameter_list"];
+ q116 -> q102 [label="parameter_declaration"];
+ q116 -> q43 [label="struct_or_union"];
+ q116 -> q121 [label="pointer"];
+ q116 -> q45 [label="any_id"];
+ q116 -> q46 [label="identifier_or_ref"];
+ q116 -> q47 [label="enumeration"];
+ q120 -> q135 [label="'('"];
+ q120 -> q136 [label="T_BRACKETS"];
+ q121 -> q116 [label="'('"];
+ q121 -> q4 [label="'&'"];
+ q121 -> q5 [label="T_IDENTIFIER"];
+ q121 -> q56 [label="T_TYPEDEF_NAME"];
+ q121 -> q117 [label="T_BRACKETS"];
+ q121 -> q78 [label="direct_declarator"];
+ q121 -> q137 [label="direct_abs_declarator"];
+ q121 -> q45 [label="any_id"];
+ q121 -> q46 [label="identifier_or_ref"];
+ q123 -> q82 [label="T_TYPEDEF_NAME"];
+ q123 -> q7 [label="T_DEFINE_NAME"];
+ q123 -> q8 [label="T_AUTO"];
+ q123 -> q65 [label="T_EXTERN"];
+ q123 -> q10 [label="T_REGISTER"];
+ q123 -> q11 [label="T_STATIC"];
+ q123 -> q13 [label="T_INLINE"];
+ q123 -> q66 [label="T_EXTENSION"];
+ q123 -> q15 [label="T_CHAR"];
+ q123 -> q16 [label="T_DOUBLE"];
+ q123 -> q17 [label="T_FLOAT"];
+ q123 -> q18 [label="T_INT"];
+ q123 -> q19 [label="T_VOID"];
+ q123 -> q20 [label="T_LONG"];
+ q123 -> q21 [label="T_SHORT"];
+ q123 -> q22 [label="T_SIGNED"];
+ q123 -> q23 [label="T_UNSIGNED"];
+ q123 -> q24 [label="T_ENUM"];
+ q123 -> q25 [label="T_STRUCT"];
+ q123 -> q26 [label="T_UNION"];
+ q123 -> q27 [label="T_Bool"];
+ q123 -> q28 [label="T_Complex"];
+ q123 -> q29 [label="T_Imaginary"];
+ q123 -> q30 [label="T_TYPE_QUALIFIER"];
+ q123 -> q138 [label="T_ELLIPSIS"];
+ q123 -> q99 [label="decl_specifiers"];
+ q123 -> q35 [label="decl_specifier"];
+ q123 -> q36 [label="storage_class"];
+ q123 -> q37 [label="type_specifier"];
+ q123 -> q38 [label="type_qualifier"];
+ q123 -> q39 [label="struct_or_union_specifier"];
+ q123 -> q40 [label="enum_specifier"];
+ q123 -> q139 [label="parameter_declaration"];
+ q123 -> q43 [label="struct_or_union"];
+ q123 -> q47 [label="enumeration"];
+ q125 -> q5 [label="T_IDENTIFIER"];
+ q125 -> q56 [label="T_TYPEDEF_NAME"];
+ q125 -> q140 [label="any_id"];
+ q127 -> q141 [label="';'"];
+ q128 -> q142 [label="','"];
+ q130 -> q143 [label="$$3"];
+ q133 -> q144 [label="')'"];
+ q134 -> q145 [label="')'"];
+ q135 -> q82 [label="T_TYPEDEF_NAME"];
+ q135 -> q7 [label="T_DEFINE_NAME"];
+ q135 -> q8 [label="T_AUTO"];
+ q135 -> q65 [label="T_EXTERN"];
+ q135 -> q10 [label="T_REGISTER"];
+ q135 -> q11 [label="T_STATIC"];
+ q135 -> q13 [label="T_INLINE"];
+ q135 -> q66 [label="T_EXTENSION"];
+ q135 -> q15 [label="T_CHAR"];
+ q135 -> q16 [label="T_DOUBLE"];
+ q135 -> q17 [label="T_FLOAT"];
+ q135 -> q18 [label="T_INT"];
+ q135 -> q19 [label="T_VOID"];
+ q135 -> q20 [label="T_LONG"];
+ q135 -> q21 [label="T_SHORT"];
+ q135 -> q22 [label="T_SIGNED"];
+ q135 -> q23 [label="T_UNSIGNED"];
+ q135 -> q24 [label="T_ENUM"];
+ q135 -> q25 [label="T_STRUCT"];
+ q135 -> q26 [label="T_UNION"];
+ q135 -> q27 [label="T_Bool"];
+ q135 -> q28 [label="T_Complex"];
+ q135 -> q29 [label="T_Imaginary"];
+ q135 -> q30 [label="T_TYPE_QUALIFIER"];
+ q135 -> q146 [label="')'"];
+ q135 -> q99 [label="decl_specifiers"];
+ q135 -> q35 [label="decl_specifier"];
+ q135 -> q36 [label="storage_class"];
+ q135 -> q37 [label="type_specifier"];
+ q135 -> q38 [label="type_qualifier"];
+ q135 -> q39 [label="struct_or_union_specifier"];
+ q135 -> q40 [label="enum_specifier"];
+ q135 -> q147 [label="parameter_type_list"];
+ q135 -> q101 [label="parameter_list"];
+ q135 -> q102 [label="parameter_declaration"];
+ q135 -> q43 [label="struct_or_union"];
+ q135 -> q47 [label="enumeration"];
+ q137 -> q135 [label="'('"];
+ q137 -> q136 [label="T_BRACKETS"];
+ q142 -> q2 [label="'('"];
+ q142 -> q3 [label="'*'"];
+ q142 -> q4 [label="'&'"];
+ q142 -> q5 [label="T_IDENTIFIER"];
+ q142 -> q56 [label="T_TYPEDEF_NAME"];
+ q142 -> q148 [label="declarator"];
+ q142 -> q42 [label="direct_declarator"];
+ q142 -> q44 [label="pointer"];
+ q142 -> q45 [label="any_id"];
+ q142 -> q46 [label="identifier_or_ref"];
+ q143 -> q149 [label="T_MATCHRBRACE"];
+ q147 -> q150 [label="')'"];
+}
diff --git a/contrib/byacc/test/btyacc/grammar.error b/contrib/byacc/test/btyacc/grammar.error
new file mode 100644
index 000000000000..d442f8abaeb5
--- /dev/null
+++ b/contrib/byacc/test/btyacc/grammar.error
@@ -0,0 +1 @@
+YACC: 1 shift/reduce conflict, 29 reduce/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/grammar.output b/contrib/byacc/test/btyacc/grammar.output
new file mode 100644
index 000000000000..8000cca1ae23
--- /dev/null
+++ b/contrib/byacc/test/btyacc/grammar.output
@@ -0,0 +1,2304 @@
+ 0 $accept : program $end
+
+ 1 program :
+ 2 | translation_unit
+
+ 3 translation_unit : external_declaration
+ 4 | translation_unit external_declaration
+
+ 5 external_declaration : declaration
+ 6 | function_definition
+ 7 | ';'
+ 8 | linkage_specification
+ 9 | T_ASM T_ASMARG ';'
+ 10 | error T_MATCHRBRACE
+ 11 | error ';'
+
+ 12 braces : T_LBRACE T_MATCHRBRACE
+
+ 13 linkage_specification : T_EXTERN T_STRING_LITERAL braces
+ 14 | T_EXTERN T_STRING_LITERAL declaration
+
+ 15 declaration : decl_specifiers ';'
+ 16 | decl_specifiers init_declarator_list ';'
+
+ 17 $$1 :
+
+ 18 declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'
+
+ 19 any_typedef : T_EXTENSION T_TYPEDEF
+ 20 | T_TYPEDEF
+
+ 21 opt_declarator_list :
+ 22 | declarator_list
+
+ 23 declarator_list : declarator
+ 24 | declarator_list ',' declarator
+
+ 25 $$2 :
+
+ 26 $$3 :
+
+ 27 function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE
+
+ 28 $$4 :
+
+ 29 function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE
+
+ 30 opt_declaration_list :
+ 31 | T_VA_DCL
+ 32 | declaration_list
+
+ 33 declaration_list : declaration
+ 34 | declaration_list declaration
+
+ 35 decl_specifiers : decl_specifier
+ 36 | decl_specifiers decl_specifier
+
+ 37 decl_specifier : storage_class
+ 38 | type_specifier
+ 39 | type_qualifier
+
+ 40 storage_class : T_AUTO
+ 41 | T_EXTERN
+ 42 | T_REGISTER
+ 43 | T_STATIC
+ 44 | T_INLINE
+ 45 | T_EXTENSION
+
+ 46 type_specifier : T_CHAR
+ 47 | T_DOUBLE
+ 48 | T_FLOAT
+ 49 | T_INT
+ 50 | T_LONG
+ 51 | T_SHORT
+ 52 | T_SIGNED
+ 53 | T_UNSIGNED
+ 54 | T_VOID
+ 55 | T_Bool
+ 56 | T_Complex
+ 57 | T_Imaginary
+ 58 | T_TYPEDEF_NAME
+ 59 | struct_or_union_specifier
+ 60 | enum_specifier
+
+ 61 type_qualifier : T_TYPE_QUALIFIER
+ 62 | T_DEFINE_NAME
+
+ 63 struct_or_union_specifier : struct_or_union any_id braces
+ 64 | struct_or_union braces
+ 65 | struct_or_union any_id
+
+ 66 struct_or_union : T_STRUCT
+ 67 | T_UNION
+
+ 68 init_declarator_list : init_declarator
+ 69 | init_declarator_list ',' init_declarator
+
+ 70 init_declarator : declarator
+
+ 71 $$5 :
+
+ 72 init_declarator : declarator '=' $$5 T_INITIALIZER
+
+ 73 enum_specifier : enumeration any_id braces
+ 74 | enumeration braces
+ 75 | enumeration any_id
+
+ 76 enumeration : T_ENUM
+
+ 77 any_id : T_IDENTIFIER
+ 78 | T_TYPEDEF_NAME
+
+ 79 declarator : pointer direct_declarator
+ 80 | direct_declarator
+
+ 81 direct_declarator : identifier_or_ref
+ 82 | '(' declarator ')'
+ 83 | direct_declarator T_BRACKETS
+ 84 | direct_declarator '(' parameter_type_list ')'
+ 85 | direct_declarator '(' opt_identifier_list ')'
+
+ 86 pointer : '*' opt_type_qualifiers
+ 87 | '*' opt_type_qualifiers pointer
+
+ 88 opt_type_qualifiers :
+ 89 | type_qualifier_list
+
+ 90 type_qualifier_list : type_qualifier
+ 91 | type_qualifier_list type_qualifier
+
+ 92 parameter_type_list : parameter_list
+ 93 | parameter_list ',' T_ELLIPSIS
+
+ 94 parameter_list : parameter_declaration
+ 95 | parameter_list ',' parameter_declaration
+
+ 96 parameter_declaration : decl_specifiers declarator
+ 97 | decl_specifiers abs_declarator
+ 98 | decl_specifiers
+
+ 99 opt_identifier_list :
+ 100 | identifier_list
+
+ 101 identifier_list : any_id
+ 102 | identifier_list ',' any_id
+
+ 103 identifier_or_ref : any_id
+ 104 | '&' any_id
+
+ 105 abs_declarator : pointer
+ 106 | pointer direct_abs_declarator
+ 107 | direct_abs_declarator
+
+ 108 direct_abs_declarator : '(' abs_declarator ')'
+ 109 | direct_abs_declarator T_BRACKETS
+ 110 | T_BRACKETS
+ 111 | direct_abs_declarator '(' parameter_type_list ')'
+ 112 | direct_abs_declarator '(' ')'
+ 113 | '(' parameter_type_list ')'
+ 114 | '(' ')'
+
+state 0
+ $accept : . program $end (0)
+ program : . (1)
+
+ error shift 1
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 6
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 9
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_TYPEDEF shift 12
+ T_INLINE shift 13
+ T_EXTENSION shift 14
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_ASM shift 31
+ ';' shift 32
+ $end reduce 1
+
+ program goto 33
+ decl_specifiers goto 34
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ declarator goto 41
+ direct_declarator goto 42
+ struct_or_union goto 43
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+ enumeration goto 47
+ translation_unit goto 48
+ external_declaration goto 49
+ declaration goto 50
+ function_definition goto 51
+ linkage_specification goto 52
+ any_typedef goto 53
+
+
+state 1
+ external_declaration : error . T_MATCHRBRACE (10)
+ external_declaration : error . ';' (11)
+
+ T_MATCHRBRACE shift 54
+ ';' shift 55
+ . error
+
+
+state 2
+ direct_declarator : '(' . declarator ')' (82)
+
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ . error
+
+ declarator goto 57
+ direct_declarator goto 42
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+
+
+state 3
+ pointer : '*' . opt_type_qualifiers (86)
+ pointer : '*' . opt_type_qualifiers pointer (87)
+ opt_type_qualifiers : . (88)
+
+ T_DEFINE_NAME shift 7
+ T_TYPE_QUALIFIER shift 30
+ '(' reduce 88
+ '*' reduce 88
+ '&' reduce 88
+ T_IDENTIFIER reduce 88
+ T_TYPEDEF_NAME reduce 88
+ T_BRACKETS reduce 88
+ ',' reduce 88
+ ')' reduce 88
+
+ type_qualifier goto 58
+ opt_type_qualifiers goto 59
+ type_qualifier_list goto 60
+
+
+state 4
+ identifier_or_ref : '&' . any_id (104)
+
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ . error
+
+ any_id goto 61
+
+
+state 5
+ any_id : T_IDENTIFIER . (77)
+
+ . reduce 77
+
+
+6: reduce/reduce conflict (reduce 58, reduce 78) on '('
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_TYPEDEF_NAME
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_DEFINE_NAME
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_AUTO
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_EXTERN
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_REGISTER
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_STATIC
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_INLINE
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_EXTENSION
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_CHAR
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_DOUBLE
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_FLOAT
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_INT
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_VOID
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_LONG
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_SHORT
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_SIGNED
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_UNSIGNED
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_ENUM
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_STRUCT
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_UNION
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_Bool
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_Complex
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_Imaginary
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_TYPE_QUALIFIER
+6: reduce/reduce conflict (reduce 58, reduce 78) on T_BRACKETS
+6: reduce/reduce conflict (reduce 58, reduce 78) on ';'
+6: reduce/reduce conflict (reduce 58, reduce 78) on ','
+6: reduce/reduce conflict (reduce 58, reduce 78) on ')'
+state 6
+ type_specifier : T_TYPEDEF_NAME . (58)
+ any_id : T_TYPEDEF_NAME . (78)
+
+ '(' reduce 58
+ '*' reduce 58
+ '&' reduce 58
+ T_IDENTIFIER reduce 58
+ T_TYPEDEF_NAME reduce 58
+ T_DEFINE_NAME reduce 58
+ T_AUTO reduce 58
+ T_EXTERN reduce 58
+ T_REGISTER reduce 58
+ T_STATIC reduce 58
+ T_TYPEDEF reduce 78
+ T_INLINE reduce 58
+ T_EXTENSION reduce 58
+ T_CHAR reduce 58
+ T_DOUBLE reduce 58
+ T_FLOAT reduce 58
+ T_INT reduce 58
+ T_VOID reduce 58
+ T_LONG reduce 58
+ T_SHORT reduce 58
+ T_SIGNED reduce 58
+ T_UNSIGNED reduce 58
+ T_ENUM reduce 58
+ T_STRUCT reduce 58
+ T_UNION reduce 58
+ T_Bool reduce 58
+ T_Complex reduce 58
+ T_Imaginary reduce 58
+ T_TYPE_QUALIFIER reduce 58
+ T_BRACKETS reduce 58
+ T_LBRACE reduce 78
+ T_VA_DCL reduce 78
+ ';' reduce 58
+ ',' reduce 58
+ '=' reduce 78
+ ')' reduce 58
+
+
+state 7
+ type_qualifier : T_DEFINE_NAME . (62)
+
+ . reduce 62
+
+
+state 8
+ storage_class : T_AUTO . (40)
+
+ . reduce 40
+
+
+state 9
+ linkage_specification : T_EXTERN . T_STRING_LITERAL braces (13)
+ linkage_specification : T_EXTERN . T_STRING_LITERAL declaration (14)
+ storage_class : T_EXTERN . (41)
+
+ T_STRING_LITERAL shift 62
+ '(' reduce 41
+ '*' reduce 41
+ '&' reduce 41
+ T_IDENTIFIER reduce 41
+ T_TYPEDEF_NAME reduce 41
+ T_DEFINE_NAME reduce 41
+ T_AUTO reduce 41
+ T_EXTERN reduce 41
+ T_REGISTER reduce 41
+ T_STATIC reduce 41
+ T_INLINE reduce 41
+ T_EXTENSION reduce 41
+ T_CHAR reduce 41
+ T_DOUBLE reduce 41
+ T_FLOAT reduce 41
+ T_INT reduce 41
+ T_VOID reduce 41
+ T_LONG reduce 41
+ T_SHORT reduce 41
+ T_SIGNED reduce 41
+ T_UNSIGNED reduce 41
+ T_ENUM reduce 41
+ T_STRUCT reduce 41
+ T_UNION reduce 41
+ T_Bool reduce 41
+ T_Complex reduce 41
+ T_Imaginary reduce 41
+ T_TYPE_QUALIFIER reduce 41
+ ';' reduce 41
+
+
+state 10
+ storage_class : T_REGISTER . (42)
+
+ . reduce 42
+
+
+state 11
+ storage_class : T_STATIC . (43)
+
+ . reduce 43
+
+
+state 12
+ any_typedef : T_TYPEDEF . (20)
+
+ . reduce 20
+
+
+state 13
+ storage_class : T_INLINE . (44)
+
+ . reduce 44
+
+
+state 14
+ any_typedef : T_EXTENSION . T_TYPEDEF (19)
+ storage_class : T_EXTENSION . (45)
+
+ T_TYPEDEF shift 63
+ '(' reduce 45
+ '*' reduce 45
+ '&' reduce 45
+ T_IDENTIFIER reduce 45
+ T_TYPEDEF_NAME reduce 45
+ T_DEFINE_NAME reduce 45
+ T_AUTO reduce 45
+ T_EXTERN reduce 45
+ T_REGISTER reduce 45
+ T_STATIC reduce 45
+ T_INLINE reduce 45
+ T_EXTENSION reduce 45
+ T_CHAR reduce 45
+ T_DOUBLE reduce 45
+ T_FLOAT reduce 45
+ T_INT reduce 45
+ T_VOID reduce 45
+ T_LONG reduce 45
+ T_SHORT reduce 45
+ T_SIGNED reduce 45
+ T_UNSIGNED reduce 45
+ T_ENUM reduce 45
+ T_STRUCT reduce 45
+ T_UNION reduce 45
+ T_Bool reduce 45
+ T_Complex reduce 45
+ T_Imaginary reduce 45
+ T_TYPE_QUALIFIER reduce 45
+ ';' reduce 45
+
+
+state 15
+ type_specifier : T_CHAR . (46)
+
+ . reduce 46
+
+
+state 16
+ type_specifier : T_DOUBLE . (47)
+
+ . reduce 47
+
+
+state 17
+ type_specifier : T_FLOAT . (48)
+
+ . reduce 48
+
+
+state 18
+ type_specifier : T_INT . (49)
+
+ . reduce 49
+
+
+state 19
+ type_specifier : T_VOID . (54)
+
+ . reduce 54
+
+
+state 20
+ type_specifier : T_LONG . (50)
+
+ . reduce 50
+
+
+state 21
+ type_specifier : T_SHORT . (51)
+
+ . reduce 51
+
+
+state 22
+ type_specifier : T_SIGNED . (52)
+
+ . reduce 52
+
+
+state 23
+ type_specifier : T_UNSIGNED . (53)
+
+ . reduce 53
+
+
+state 24
+ enumeration : T_ENUM . (76)
+
+ . reduce 76
+
+
+state 25
+ struct_or_union : T_STRUCT . (66)
+
+ . reduce 66
+
+
+state 26
+ struct_or_union : T_UNION . (67)
+
+ . reduce 67
+
+
+state 27
+ type_specifier : T_Bool . (55)
+
+ . reduce 55
+
+
+state 28
+ type_specifier : T_Complex . (56)
+
+ . reduce 56
+
+
+state 29
+ type_specifier : T_Imaginary . (57)
+
+ . reduce 57
+
+
+state 30
+ type_qualifier : T_TYPE_QUALIFIER . (61)
+
+ . reduce 61
+
+
+state 31
+ external_declaration : T_ASM . T_ASMARG ';' (9)
+
+ T_ASMARG shift 64
+ . error
+
+
+state 32
+ external_declaration : ';' . (7)
+
+ . reduce 7
+
+
+state 33
+ $accept : program . $end (0)
+
+ $end accept
+
+
+state 34
+ declaration : decl_specifiers . ';' (15)
+ declaration : decl_specifiers . init_declarator_list ';' (16)
+ function_definition : decl_specifiers . declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE (27)
+ decl_specifiers : decl_specifiers . decl_specifier (36)
+
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 6
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ ';' shift 67
+ . error
+
+ decl_specifier goto 68
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ init_declarator_list goto 69
+ init_declarator goto 70
+ declarator goto 71
+ direct_declarator goto 42
+ struct_or_union goto 43
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+ enumeration goto 47
+
+
+state 35
+ decl_specifiers : decl_specifier . (35)
+
+ . reduce 35
+
+
+state 36
+ decl_specifier : storage_class . (37)
+
+ . reduce 37
+
+
+state 37
+ decl_specifier : type_specifier . (38)
+
+ . reduce 38
+
+
+state 38
+ decl_specifier : type_qualifier . (39)
+
+ . reduce 39
+
+
+state 39
+ type_specifier : struct_or_union_specifier . (59)
+
+ . reduce 59
+
+
+state 40
+ type_specifier : enum_specifier . (60)
+
+ . reduce 60
+
+
+state 41
+ function_definition : declarator . $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE (29)
+ $$4 : . (28)
+
+ . reduce 28
+
+ $$4 goto 72
+
+
+state 42
+ declarator : direct_declarator . (80)
+ direct_declarator : direct_declarator . T_BRACKETS (83)
+ direct_declarator : direct_declarator . '(' parameter_type_list ')' (84)
+ direct_declarator : direct_declarator . '(' opt_identifier_list ')' (85)
+
+ '(' shift 73
+ T_BRACKETS shift 74
+ T_TYPEDEF_NAME reduce 80
+ T_DEFINE_NAME reduce 80
+ T_AUTO reduce 80
+ T_EXTERN reduce 80
+ T_REGISTER reduce 80
+ T_STATIC reduce 80
+ T_TYPEDEF reduce 80
+ T_INLINE reduce 80
+ T_EXTENSION reduce 80
+ T_CHAR reduce 80
+ T_DOUBLE reduce 80
+ T_FLOAT reduce 80
+ T_INT reduce 80
+ T_VOID reduce 80
+ T_LONG reduce 80
+ T_SHORT reduce 80
+ T_SIGNED reduce 80
+ T_UNSIGNED reduce 80
+ T_ENUM reduce 80
+ T_STRUCT reduce 80
+ T_UNION reduce 80
+ T_Bool reduce 80
+ T_Complex reduce 80
+ T_Imaginary reduce 80
+ T_TYPE_QUALIFIER reduce 80
+ T_LBRACE reduce 80
+ T_VA_DCL reduce 80
+ ';' reduce 80
+ ',' reduce 80
+ '=' reduce 80
+ ')' reduce 80
+
+
+state 43
+ struct_or_union_specifier : struct_or_union . any_id braces (63)
+ struct_or_union_specifier : struct_or_union . braces (64)
+ struct_or_union_specifier : struct_or_union . any_id (65)
+
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ T_LBRACE shift 75
+ . error
+
+ any_id goto 76
+ braces goto 77
+
+
+state 44
+ declarator : pointer . direct_declarator (79)
+
+ '(' shift 2
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ . error
+
+ direct_declarator goto 78
+ any_id goto 45
+ identifier_or_ref goto 46
+
+
+state 45
+ identifier_or_ref : any_id . (103)
+
+ . reduce 103
+
+
+state 46
+ direct_declarator : identifier_or_ref . (81)
+
+ . reduce 81
+
+
+state 47
+ enum_specifier : enumeration . any_id braces (73)
+ enum_specifier : enumeration . braces (74)
+ enum_specifier : enumeration . any_id (75)
+
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ T_LBRACE shift 75
+ . error
+
+ any_id goto 79
+ braces goto 80
+
+
+state 48
+ program : translation_unit . (2)
+ translation_unit : translation_unit . external_declaration (4)
+
+ error shift 1
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 6
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 9
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_TYPEDEF shift 12
+ T_INLINE shift 13
+ T_EXTENSION shift 14
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_ASM shift 31
+ ';' shift 32
+ $end reduce 2
+
+ decl_specifiers goto 34
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ declarator goto 41
+ direct_declarator goto 42
+ struct_or_union goto 43
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+ enumeration goto 47
+ external_declaration goto 81
+ declaration goto 50
+ function_definition goto 51
+ linkage_specification goto 52
+ any_typedef goto 53
+
+
+state 49
+ translation_unit : external_declaration . (3)
+
+ . reduce 3
+
+
+state 50
+ external_declaration : declaration . (5)
+
+ . reduce 5
+
+
+state 51
+ external_declaration : function_definition . (6)
+
+ . reduce 6
+
+
+state 52
+ external_declaration : linkage_specification . (8)
+
+ . reduce 8
+
+
+state 53
+ declaration : any_typedef . decl_specifiers $$1 opt_declarator_list ';' (18)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ . error
+
+ decl_specifiers goto 83
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ struct_or_union goto 43
+ enumeration goto 47
+
+
+state 54
+ external_declaration : error T_MATCHRBRACE . (10)
+
+ . reduce 10
+
+
+state 55
+ external_declaration : error ';' . (11)
+
+ . reduce 11
+
+
+state 56
+ any_id : T_TYPEDEF_NAME . (78)
+
+ . reduce 78
+
+
+state 57
+ direct_declarator : '(' declarator . ')' (82)
+
+ ')' shift 84
+ . error
+
+
+state 58
+ type_qualifier_list : type_qualifier . (90)
+
+ . reduce 90
+
+
+state 59
+ pointer : '*' opt_type_qualifiers . (86)
+ pointer : '*' opt_type_qualifiers . pointer (87)
+
+ '*' shift 3
+ '(' reduce 86
+ '&' reduce 86
+ T_IDENTIFIER reduce 86
+ T_TYPEDEF_NAME reduce 86
+ T_BRACKETS reduce 86
+ ',' reduce 86
+ ')' reduce 86
+
+ pointer goto 85
+
+
+state 60
+ opt_type_qualifiers : type_qualifier_list . (89)
+ type_qualifier_list : type_qualifier_list . type_qualifier (91)
+
+ T_DEFINE_NAME shift 7
+ T_TYPE_QUALIFIER shift 30
+ '(' reduce 89
+ '*' reduce 89
+ '&' reduce 89
+ T_IDENTIFIER reduce 89
+ T_TYPEDEF_NAME reduce 89
+ T_BRACKETS reduce 89
+ ',' reduce 89
+ ')' reduce 89
+
+ type_qualifier goto 86
+
+
+state 61
+ identifier_or_ref : '&' any_id . (104)
+
+ . reduce 104
+
+
+state 62
+ linkage_specification : T_EXTERN T_STRING_LITERAL . braces (13)
+ linkage_specification : T_EXTERN T_STRING_LITERAL . declaration (14)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_TYPEDEF shift 12
+ T_INLINE shift 13
+ T_EXTENSION shift 14
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_LBRACE shift 75
+ . error
+
+ decl_specifiers goto 87
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ struct_or_union goto 43
+ enumeration goto 47
+ declaration goto 88
+ braces goto 89
+ any_typedef goto 53
+
+
+state 63
+ any_typedef : T_EXTENSION T_TYPEDEF . (19)
+
+ . reduce 19
+
+
+state 64
+ external_declaration : T_ASM T_ASMARG . ';' (9)
+
+ ';' shift 90
+ . error
+
+
+state 65
+ storage_class : T_EXTERN . (41)
+
+ . reduce 41
+
+
+state 66
+ storage_class : T_EXTENSION . (45)
+
+ . reduce 45
+
+
+state 67
+ declaration : decl_specifiers ';' . (15)
+
+ . reduce 15
+
+
+state 68
+ decl_specifiers : decl_specifiers decl_specifier . (36)
+
+ . reduce 36
+
+
+state 69
+ declaration : decl_specifiers init_declarator_list . ';' (16)
+ init_declarator_list : init_declarator_list . ',' init_declarator (69)
+
+ ';' shift 91
+ ',' shift 92
+ . error
+
+
+state 70
+ init_declarator_list : init_declarator . (68)
+
+ . reduce 68
+
+
+state 71
+ function_definition : decl_specifiers declarator . $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE (27)
+ init_declarator : declarator . (70)
+ init_declarator : declarator . '=' $$5 T_INITIALIZER (72)
+ $$2 : . (25)
+
+ '=' shift 93
+ T_TYPEDEF_NAME reduce 25
+ T_DEFINE_NAME reduce 25
+ T_AUTO reduce 25
+ T_EXTERN reduce 25
+ T_REGISTER reduce 25
+ T_STATIC reduce 25
+ T_TYPEDEF reduce 25
+ T_INLINE reduce 25
+ T_EXTENSION reduce 25
+ T_CHAR reduce 25
+ T_DOUBLE reduce 25
+ T_FLOAT reduce 25
+ T_INT reduce 25
+ T_VOID reduce 25
+ T_LONG reduce 25
+ T_SHORT reduce 25
+ T_SIGNED reduce 25
+ T_UNSIGNED reduce 25
+ T_ENUM reduce 25
+ T_STRUCT reduce 25
+ T_UNION reduce 25
+ T_Bool reduce 25
+ T_Complex reduce 25
+ T_Imaginary reduce 25
+ T_TYPE_QUALIFIER reduce 25
+ T_LBRACE reduce 25
+ T_VA_DCL reduce 25
+ ';' reduce 70
+ ',' reduce 70
+
+ $$2 goto 94
+
+
+state 72
+ function_definition : declarator $$4 . opt_declaration_list T_LBRACE T_MATCHRBRACE (29)
+ opt_declaration_list : . (30)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_TYPEDEF shift 12
+ T_INLINE shift 13
+ T_EXTENSION shift 14
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_VA_DCL shift 95
+ T_LBRACE reduce 30
+
+ decl_specifiers goto 87
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ struct_or_union goto 43
+ enumeration goto 47
+ declaration goto 96
+ any_typedef goto 53
+ opt_declaration_list goto 97
+ declaration_list goto 98
+
+
+state 73
+ direct_declarator : direct_declarator '(' . parameter_type_list ')' (84)
+ direct_declarator : direct_declarator '(' . opt_identifier_list ')' (85)
+ opt_identifier_list : . (99)
+
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 6
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ ')' reduce 99
+
+ decl_specifiers goto 99
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ parameter_type_list goto 100
+ parameter_list goto 101
+ parameter_declaration goto 102
+ opt_identifier_list goto 103
+ identifier_list goto 104
+ struct_or_union goto 43
+ any_id goto 105
+ enumeration goto 47
+
+
+state 74
+ direct_declarator : direct_declarator T_BRACKETS . (83)
+
+ . reduce 83
+
+
+state 75
+ braces : T_LBRACE . T_MATCHRBRACE (12)
+
+ T_MATCHRBRACE shift 106
+ . error
+
+
+state 76
+ struct_or_union_specifier : struct_or_union any_id . braces (63)
+ struct_or_union_specifier : struct_or_union any_id . (65)
+
+ T_LBRACE shift 75
+ '(' reduce 65
+ '*' reduce 65
+ '&' reduce 65
+ T_IDENTIFIER reduce 65
+ T_TYPEDEF_NAME reduce 65
+ T_DEFINE_NAME reduce 65
+ T_AUTO reduce 65
+ T_EXTERN reduce 65
+ T_REGISTER reduce 65
+ T_STATIC reduce 65
+ T_INLINE reduce 65
+ T_EXTENSION reduce 65
+ T_CHAR reduce 65
+ T_DOUBLE reduce 65
+ T_FLOAT reduce 65
+ T_INT reduce 65
+ T_VOID reduce 65
+ T_LONG reduce 65
+ T_SHORT reduce 65
+ T_SIGNED reduce 65
+ T_UNSIGNED reduce 65
+ T_ENUM reduce 65
+ T_STRUCT reduce 65
+ T_UNION reduce 65
+ T_Bool reduce 65
+ T_Complex reduce 65
+ T_Imaginary reduce 65
+ T_TYPE_QUALIFIER reduce 65
+ T_BRACKETS reduce 65
+ ';' reduce 65
+ ',' reduce 65
+ ')' reduce 65
+
+ braces goto 107
+
+
+state 77
+ struct_or_union_specifier : struct_or_union braces . (64)
+
+ . reduce 64
+
+
+state 78
+ declarator : pointer direct_declarator . (79)
+ direct_declarator : direct_declarator . T_BRACKETS (83)
+ direct_declarator : direct_declarator . '(' parameter_type_list ')' (84)
+ direct_declarator : direct_declarator . '(' opt_identifier_list ')' (85)
+
+ '(' shift 73
+ T_BRACKETS shift 74
+ T_TYPEDEF_NAME reduce 79
+ T_DEFINE_NAME reduce 79
+ T_AUTO reduce 79
+ T_EXTERN reduce 79
+ T_REGISTER reduce 79
+ T_STATIC reduce 79
+ T_TYPEDEF reduce 79
+ T_INLINE reduce 79
+ T_EXTENSION reduce 79
+ T_CHAR reduce 79
+ T_DOUBLE reduce 79
+ T_FLOAT reduce 79
+ T_INT reduce 79
+ T_VOID reduce 79
+ T_LONG reduce 79
+ T_SHORT reduce 79
+ T_SIGNED reduce 79
+ T_UNSIGNED reduce 79
+ T_ENUM reduce 79
+ T_STRUCT reduce 79
+ T_UNION reduce 79
+ T_Bool reduce 79
+ T_Complex reduce 79
+ T_Imaginary reduce 79
+ T_TYPE_QUALIFIER reduce 79
+ T_LBRACE reduce 79
+ T_VA_DCL reduce 79
+ ';' reduce 79
+ ',' reduce 79
+ '=' reduce 79
+ ')' reduce 79
+
+
+state 79
+ enum_specifier : enumeration any_id . braces (73)
+ enum_specifier : enumeration any_id . (75)
+
+ T_LBRACE shift 75
+ '(' reduce 75
+ '*' reduce 75
+ '&' reduce 75
+ T_IDENTIFIER reduce 75
+ T_TYPEDEF_NAME reduce 75
+ T_DEFINE_NAME reduce 75
+ T_AUTO reduce 75
+ T_EXTERN reduce 75
+ T_REGISTER reduce 75
+ T_STATIC reduce 75
+ T_INLINE reduce 75
+ T_EXTENSION reduce 75
+ T_CHAR reduce 75
+ T_DOUBLE reduce 75
+ T_FLOAT reduce 75
+ T_INT reduce 75
+ T_VOID reduce 75
+ T_LONG reduce 75
+ T_SHORT reduce 75
+ T_SIGNED reduce 75
+ T_UNSIGNED reduce 75
+ T_ENUM reduce 75
+ T_STRUCT reduce 75
+ T_UNION reduce 75
+ T_Bool reduce 75
+ T_Complex reduce 75
+ T_Imaginary reduce 75
+ T_TYPE_QUALIFIER reduce 75
+ T_BRACKETS reduce 75
+ ';' reduce 75
+ ',' reduce 75
+ ')' reduce 75
+
+ braces goto 108
+
+
+state 80
+ enum_specifier : enumeration braces . (74)
+
+ . reduce 74
+
+
+state 81
+ translation_unit : translation_unit external_declaration . (4)
+
+ . reduce 4
+
+
+state 82
+ type_specifier : T_TYPEDEF_NAME . (58)
+
+ . reduce 58
+
+
+83: shift/reduce conflict (shift 82, reduce 17) on T_TYPEDEF_NAME
+state 83
+ declaration : any_typedef decl_specifiers . $$1 opt_declarator_list ';' (18)
+ decl_specifiers : decl_specifiers . decl_specifier (36)
+ $$1 : . (17)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ '(' reduce 17
+ '*' reduce 17
+ '&' reduce 17
+ T_IDENTIFIER reduce 17
+ ';' reduce 17
+
+ decl_specifier goto 68
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ struct_or_union goto 43
+ enumeration goto 47
+ $$1 goto 109
+
+
+state 84
+ direct_declarator : '(' declarator ')' . (82)
+
+ . reduce 82
+
+
+state 85
+ pointer : '*' opt_type_qualifiers pointer . (87)
+
+ . reduce 87
+
+
+state 86
+ type_qualifier_list : type_qualifier_list type_qualifier . (91)
+
+ . reduce 91
+
+
+state 87
+ declaration : decl_specifiers . ';' (15)
+ declaration : decl_specifiers . init_declarator_list ';' (16)
+ decl_specifiers : decl_specifiers . decl_specifier (36)
+
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 6
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ ';' shift 67
+ . error
+
+ decl_specifier goto 68
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ init_declarator_list goto 69
+ init_declarator goto 70
+ declarator goto 110
+ direct_declarator goto 42
+ struct_or_union goto 43
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+ enumeration goto 47
+
+
+state 88
+ linkage_specification : T_EXTERN T_STRING_LITERAL declaration . (14)
+
+ . reduce 14
+
+
+state 89
+ linkage_specification : T_EXTERN T_STRING_LITERAL braces . (13)
+
+ . reduce 13
+
+
+state 90
+ external_declaration : T_ASM T_ASMARG ';' . (9)
+
+ . reduce 9
+
+
+state 91
+ declaration : decl_specifiers init_declarator_list ';' . (16)
+
+ . reduce 16
+
+
+state 92
+ init_declarator_list : init_declarator_list ',' . init_declarator (69)
+
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ . error
+
+ init_declarator goto 111
+ declarator goto 110
+ direct_declarator goto 42
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+
+
+state 93
+ init_declarator : declarator '=' . $$5 T_INITIALIZER (72)
+ $$5 : . (71)
+
+ . reduce 71
+
+ $$5 goto 112
+
+
+state 94
+ function_definition : decl_specifiers declarator $$2 . opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE (27)
+ opt_declaration_list : . (30)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_TYPEDEF shift 12
+ T_INLINE shift 13
+ T_EXTENSION shift 14
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_VA_DCL shift 95
+ T_LBRACE reduce 30
+
+ decl_specifiers goto 87
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ struct_or_union goto 43
+ enumeration goto 47
+ declaration goto 96
+ any_typedef goto 53
+ opt_declaration_list goto 113
+ declaration_list goto 98
+
+
+state 95
+ opt_declaration_list : T_VA_DCL . (31)
+
+ . reduce 31
+
+
+state 96
+ declaration_list : declaration . (33)
+
+ . reduce 33
+
+
+state 97
+ function_definition : declarator $$4 opt_declaration_list . T_LBRACE T_MATCHRBRACE (29)
+
+ T_LBRACE shift 114
+ . error
+
+
+state 98
+ opt_declaration_list : declaration_list . (32)
+ declaration_list : declaration_list . declaration (34)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_TYPEDEF shift 12
+ T_INLINE shift 13
+ T_EXTENSION shift 14
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_LBRACE reduce 32
+
+ decl_specifiers goto 87
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ struct_or_union goto 43
+ enumeration goto 47
+ declaration goto 115
+ any_typedef goto 53
+
+
+state 99
+ decl_specifiers : decl_specifiers . decl_specifier (36)
+ parameter_declaration : decl_specifiers . declarator (96)
+ parameter_declaration : decl_specifiers . abs_declarator (97)
+ parameter_declaration : decl_specifiers . (98)
+
+ '(' shift 116
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 6
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_BRACKETS shift 117
+ ',' reduce 98
+ ')' reduce 98
+
+ decl_specifier goto 68
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ declarator goto 118
+ direct_declarator goto 42
+ abs_declarator goto 119
+ direct_abs_declarator goto 120
+ struct_or_union goto 43
+ pointer goto 121
+ any_id goto 45
+ identifier_or_ref goto 46
+ enumeration goto 47
+
+
+state 100
+ direct_declarator : direct_declarator '(' parameter_type_list . ')' (84)
+
+ ')' shift 122
+ . error
+
+
+state 101
+ parameter_type_list : parameter_list . (92)
+ parameter_type_list : parameter_list . ',' T_ELLIPSIS (93)
+ parameter_list : parameter_list . ',' parameter_declaration (95)
+
+ ',' shift 123
+ ')' reduce 92
+
+
+state 102
+ parameter_list : parameter_declaration . (94)
+
+ . reduce 94
+
+
+state 103
+ direct_declarator : direct_declarator '(' opt_identifier_list . ')' (85)
+
+ ')' shift 124
+ . error
+
+
+state 104
+ opt_identifier_list : identifier_list . (100)
+ identifier_list : identifier_list . ',' any_id (102)
+
+ ',' shift 125
+ ')' reduce 100
+
+
+state 105
+ identifier_list : any_id . (101)
+
+ . reduce 101
+
+
+state 106
+ braces : T_LBRACE T_MATCHRBRACE . (12)
+
+ . reduce 12
+
+
+state 107
+ struct_or_union_specifier : struct_or_union any_id braces . (63)
+
+ . reduce 63
+
+
+state 108
+ enum_specifier : enumeration any_id braces . (73)
+
+ . reduce 73
+
+
+state 109
+ declaration : any_typedef decl_specifiers $$1 . opt_declarator_list ';' (18)
+ opt_declarator_list : . (21)
+
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ ';' reduce 21
+
+ declarator goto 126
+ direct_declarator goto 42
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+ opt_declarator_list goto 127
+ declarator_list goto 128
+
+
+state 110
+ init_declarator : declarator . (70)
+ init_declarator : declarator . '=' $$5 T_INITIALIZER (72)
+
+ '=' shift 93
+ ';' reduce 70
+ ',' reduce 70
+
+
+state 111
+ init_declarator_list : init_declarator_list ',' init_declarator . (69)
+
+ . reduce 69
+
+
+state 112
+ init_declarator : declarator '=' $$5 . T_INITIALIZER (72)
+
+ T_INITIALIZER shift 129
+ . error
+
+
+state 113
+ function_definition : decl_specifiers declarator $$2 opt_declaration_list . T_LBRACE $$3 T_MATCHRBRACE (27)
+
+ T_LBRACE shift 130
+ . error
+
+
+state 114
+ function_definition : declarator $$4 opt_declaration_list T_LBRACE . T_MATCHRBRACE (29)
+
+ T_MATCHRBRACE shift 131
+ . error
+
+
+state 115
+ declaration_list : declaration_list declaration . (34)
+
+ . reduce 34
+
+
+state 116
+ direct_declarator : '(' . declarator ')' (82)
+ direct_abs_declarator : '(' . abs_declarator ')' (108)
+ direct_abs_declarator : '(' . parameter_type_list ')' (113)
+ direct_abs_declarator : '(' . ')' (114)
+
+ '(' shift 116
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 6
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_BRACKETS shift 117
+ ')' shift 132
+ . error
+
+ decl_specifiers goto 99
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ declarator goto 57
+ direct_declarator goto 42
+ abs_declarator goto 133
+ direct_abs_declarator goto 120
+ parameter_type_list goto 134
+ parameter_list goto 101
+ parameter_declaration goto 102
+ struct_or_union goto 43
+ pointer goto 121
+ any_id goto 45
+ identifier_or_ref goto 46
+ enumeration goto 47
+
+
+state 117
+ direct_abs_declarator : T_BRACKETS . (110)
+
+ . reduce 110
+
+
+state 118
+ parameter_declaration : decl_specifiers declarator . (96)
+
+ . reduce 96
+
+
+state 119
+ parameter_declaration : decl_specifiers abs_declarator . (97)
+
+ . reduce 97
+
+
+state 120
+ abs_declarator : direct_abs_declarator . (107)
+ direct_abs_declarator : direct_abs_declarator . T_BRACKETS (109)
+ direct_abs_declarator : direct_abs_declarator . '(' parameter_type_list ')' (111)
+ direct_abs_declarator : direct_abs_declarator . '(' ')' (112)
+
+ '(' shift 135
+ T_BRACKETS shift 136
+ ',' reduce 107
+ ')' reduce 107
+
+
+state 121
+ declarator : pointer . direct_declarator (79)
+ abs_declarator : pointer . (105)
+ abs_declarator : pointer . direct_abs_declarator (106)
+
+ '(' shift 116
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ T_BRACKETS shift 117
+ ',' reduce 105
+ ')' reduce 105
+
+ direct_declarator goto 78
+ direct_abs_declarator goto 137
+ any_id goto 45
+ identifier_or_ref goto 46
+
+
+state 122
+ direct_declarator : direct_declarator '(' parameter_type_list ')' . (84)
+
+ . reduce 84
+
+
+state 123
+ parameter_type_list : parameter_list ',' . T_ELLIPSIS (93)
+ parameter_list : parameter_list ',' . parameter_declaration (95)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ T_ELLIPSIS shift 138
+ . error
+
+ decl_specifiers goto 99
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ parameter_declaration goto 139
+ struct_or_union goto 43
+ enumeration goto 47
+
+
+state 124
+ direct_declarator : direct_declarator '(' opt_identifier_list ')' . (85)
+
+ . reduce 85
+
+
+state 125
+ identifier_list : identifier_list ',' . any_id (102)
+
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ . error
+
+ any_id goto 140
+
+
+state 126
+ declarator_list : declarator . (23)
+
+ . reduce 23
+
+
+state 127
+ declaration : any_typedef decl_specifiers $$1 opt_declarator_list . ';' (18)
+
+ ';' shift 141
+ . error
+
+
+state 128
+ opt_declarator_list : declarator_list . (22)
+ declarator_list : declarator_list . ',' declarator (24)
+
+ ',' shift 142
+ ';' reduce 22
+
+
+state 129
+ init_declarator : declarator '=' $$5 T_INITIALIZER . (72)
+
+ . reduce 72
+
+
+state 130
+ function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE . $$3 T_MATCHRBRACE (27)
+ $$3 : . (26)
+
+ . reduce 26
+
+ $$3 goto 143
+
+
+state 131
+ function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE . (29)
+
+ . reduce 29
+
+
+state 132
+ direct_abs_declarator : '(' ')' . (114)
+
+ . reduce 114
+
+
+state 133
+ direct_abs_declarator : '(' abs_declarator . ')' (108)
+
+ ')' shift 144
+ . error
+
+
+state 134
+ direct_abs_declarator : '(' parameter_type_list . ')' (113)
+
+ ')' shift 145
+ . error
+
+
+state 135
+ direct_abs_declarator : direct_abs_declarator '(' . parameter_type_list ')' (111)
+ direct_abs_declarator : direct_abs_declarator '(' . ')' (112)
+
+ T_TYPEDEF_NAME shift 82
+ T_DEFINE_NAME shift 7
+ T_AUTO shift 8
+ T_EXTERN shift 65
+ T_REGISTER shift 10
+ T_STATIC shift 11
+ T_INLINE shift 13
+ T_EXTENSION shift 66
+ T_CHAR shift 15
+ T_DOUBLE shift 16
+ T_FLOAT shift 17
+ T_INT shift 18
+ T_VOID shift 19
+ T_LONG shift 20
+ T_SHORT shift 21
+ T_SIGNED shift 22
+ T_UNSIGNED shift 23
+ T_ENUM shift 24
+ T_STRUCT shift 25
+ T_UNION shift 26
+ T_Bool shift 27
+ T_Complex shift 28
+ T_Imaginary shift 29
+ T_TYPE_QUALIFIER shift 30
+ ')' shift 146
+ . error
+
+ decl_specifiers goto 99
+ decl_specifier goto 35
+ storage_class goto 36
+ type_specifier goto 37
+ type_qualifier goto 38
+ struct_or_union_specifier goto 39
+ enum_specifier goto 40
+ parameter_type_list goto 147
+ parameter_list goto 101
+ parameter_declaration goto 102
+ struct_or_union goto 43
+ enumeration goto 47
+
+
+state 136
+ direct_abs_declarator : direct_abs_declarator T_BRACKETS . (109)
+
+ . reduce 109
+
+
+state 137
+ abs_declarator : pointer direct_abs_declarator . (106)
+ direct_abs_declarator : direct_abs_declarator . T_BRACKETS (109)
+ direct_abs_declarator : direct_abs_declarator . '(' parameter_type_list ')' (111)
+ direct_abs_declarator : direct_abs_declarator . '(' ')' (112)
+
+ '(' shift 135
+ T_BRACKETS shift 136
+ ',' reduce 106
+ ')' reduce 106
+
+
+state 138
+ parameter_type_list : parameter_list ',' T_ELLIPSIS . (93)
+
+ . reduce 93
+
+
+state 139
+ parameter_list : parameter_list ',' parameter_declaration . (95)
+
+ . reduce 95
+
+
+state 140
+ identifier_list : identifier_list ',' any_id . (102)
+
+ . reduce 102
+
+
+state 141
+ declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';' . (18)
+
+ . reduce 18
+
+
+state 142
+ declarator_list : declarator_list ',' . declarator (24)
+
+ '(' shift 2
+ '*' shift 3
+ '&' shift 4
+ T_IDENTIFIER shift 5
+ T_TYPEDEF_NAME shift 56
+ . error
+
+ declarator goto 148
+ direct_declarator goto 42
+ pointer goto 44
+ any_id goto 45
+ identifier_or_ref goto 46
+
+
+state 143
+ function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 . T_MATCHRBRACE (27)
+
+ T_MATCHRBRACE shift 149
+ . error
+
+
+state 144
+ direct_abs_declarator : '(' abs_declarator ')' . (108)
+
+ . reduce 108
+
+
+state 145
+ direct_abs_declarator : '(' parameter_type_list ')' . (113)
+
+ . reduce 113
+
+
+state 146
+ direct_abs_declarator : direct_abs_declarator '(' ')' . (112)
+
+ . reduce 112
+
+
+state 147
+ direct_abs_declarator : direct_abs_declarator '(' parameter_type_list . ')' (111)
+
+ ')' shift 150
+ . error
+
+
+state 148
+ declarator_list : declarator_list ',' declarator . (24)
+
+ . reduce 24
+
+
+state 149
+ function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE . (27)
+
+ . reduce 27
+
+
+state 150
+ direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')' . (111)
+
+ . reduce 111
+
+
+State 6 contains 29 reduce/reduce conflicts.
+State 83 contains 1 shift/reduce conflict.
+
+
+44 terminals, 43 nonterminals
+115 grammar rules, 151 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 40 '('
+ 3 42 '*'
+ 4 38 '&'
+ 5 257 T_IDENTIFIER
+ 6 258 T_TYPEDEF_NAME
+ 7 259 T_DEFINE_NAME
+ 8 260 T_AUTO
+ 9 261 T_EXTERN
+ 10 262 T_REGISTER
+ 11 263 T_STATIC
+ 12 264 T_TYPEDEF
+ 13 265 T_INLINE
+ 14 266 T_EXTENSION
+ 15 267 T_CHAR
+ 16 268 T_DOUBLE
+ 17 269 T_FLOAT
+ 18 270 T_INT
+ 19 271 T_VOID
+ 20 272 T_LONG
+ 21 273 T_SHORT
+ 22 274 T_SIGNED
+ 23 275 T_UNSIGNED
+ 24 276 T_ENUM
+ 25 277 T_STRUCT
+ 26 278 T_UNION
+ 27 279 T_Bool
+ 28 280 T_Complex
+ 29 281 T_Imaginary
+ 30 282 T_TYPE_QUALIFIER
+ 31 283 T_BRACKETS
+ 32 284 T_LBRACE
+ 33 285 T_MATCHRBRACE
+ 34 286 T_ELLIPSIS
+ 35 287 T_INITIALIZER
+ 36 288 T_STRING_LITERAL
+ 37 289 T_ASM
+ 38 290 T_ASMARG
+ 39 291 T_VA_DCL
+ 40 59 ';'
+ 41 44 ','
+ 42 61 '='
+ 43 41 ')'
+ 44 292 $accept
+ 45 293 program
+ 46 294 decl_specifiers
+ 47 295 decl_specifier
+ 48 296 storage_class
+ 49 297 type_specifier
+ 50 298 type_qualifier
+ 51 299 struct_or_union_specifier
+ 52 300 enum_specifier
+ 53 301 init_declarator_list
+ 54 302 init_declarator
+ 55 303 declarator
+ 56 304 direct_declarator
+ 57 305 abs_declarator
+ 58 306 direct_abs_declarator
+ 59 307 parameter_type_list
+ 60 308 parameter_list
+ 61 309 parameter_declaration
+ 62 310 opt_identifier_list
+ 63 311 identifier_list
+ 64 312 struct_or_union
+ 65 313 pointer
+ 66 314 opt_type_qualifiers
+ 67 315 type_qualifier_list
+ 68 316 any_id
+ 69 317 identifier_or_ref
+ 70 318 enumeration
+ 71 319 translation_unit
+ 72 320 external_declaration
+ 73 321 declaration
+ 74 322 function_definition
+ 75 323 linkage_specification
+ 76 324 braces
+ 77 325 any_typedef
+ 78 326 opt_declarator_list
+ 79 327 $$1
+ 80 328 declarator_list
+ 81 329 opt_declaration_list
+ 82 330 $$2
+ 83 331 $$3
+ 84 332 $$4
+ 85 333 declaration_list
+ 86 334 $$5
diff --git a/contrib/byacc/test/btyacc/grammar.tab.c b/contrib/byacc/test/btyacc/grammar.tab.c
new file mode 100644
index 000000000000..fc5270a54eaf
--- /dev/null
+++ b/contrib/byacc/test/btyacc/grammar.tab.c
@@ -0,0 +1,2813 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse grammar_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex grammar_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror grammar_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar grammar_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval grammar_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval grammar_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug grammar_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs grammar_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag grammar_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs grammar_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen grammar_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred grammar_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos grammar_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto grammar_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex grammar_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex grammar_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex grammar_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable grammar_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck grammar_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname grammar_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule grammar_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex grammar_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable grammar_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "grammar_"
+
+#define YYPURE 0
+
+#line 9 "grammar.y"
+#ifdef YYBISON
+#include <stdlib.h>
+#define YYSTYPE_IS_DECLARED
+#define yyerror yaccError
+#endif
+
+#if defined(YYBISON) || !defined(YYBYACC)
+static void yyerror(const char *s);
+#endif
+#line 81 "grammar.y"
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+
+#define OPT_LINTLIBRARY 1
+
+#ifndef TRUE
+#define TRUE (1)
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
+/* #include "cproto.h" */
+#define MAX_TEXT_SIZE 1024
+
+/* Prototype styles */
+#if OPT_LINTLIBRARY
+#define PROTO_ANSI_LLIB -2 /* form ANSI lint-library source */
+#define PROTO_LINTLIBRARY -1 /* form lint-library source */
+#endif
+#define PROTO_NONE 0 /* do not output any prototypes */
+#define PROTO_TRADITIONAL 1 /* comment out parameters */
+#define PROTO_ABSTRACT 2 /* comment out parameter names */
+#define PROTO_ANSI 3 /* ANSI C prototype */
+
+typedef int PrototypeStyle;
+
+typedef char boolean;
+
+extern boolean types_out;
+extern PrototypeStyle proto_style;
+
+#define ansiLintLibrary() (proto_style == PROTO_ANSI_LLIB)
+#define knrLintLibrary() (proto_style == PROTO_LINTLIBRARY)
+#define lintLibrary() (knrLintLibrary() || ansiLintLibrary())
+
+#if OPT_LINTLIBRARY
+#define FUNC_UNKNOWN -1 /* unspecified */
+#else
+#define FUNC_UNKNOWN 0 /* unspecified (same as FUNC_NONE) */
+#endif
+#define FUNC_NONE 0 /* not a function definition */
+#define FUNC_TRADITIONAL 1 /* traditional style */
+#define FUNC_ANSI 2 /* ANSI style */
+#define FUNC_BOTH 3 /* both styles */
+
+typedef int FuncDefStyle;
+
+/* Source file text */
+typedef struct text {
+ char text[MAX_TEXT_SIZE]; /* source text */
+ long begin; /* offset in temporary file */
+} Text;
+
+/* Declaration specifier flags */
+#define DS_NONE 0 /* default */
+#define DS_EXTERN 1 /* contains "extern" specifier */
+#define DS_STATIC 2 /* contains "static" specifier */
+#define DS_CHAR 4 /* contains "char" type specifier */
+#define DS_SHORT 8 /* contains "short" type specifier */
+#define DS_FLOAT 16 /* contains "float" type specifier */
+#define DS_INLINE 32 /* contains "inline" specifier */
+#define DS_JUNK 64 /* we're not interested in this declaration */
+
+/* This structure stores information about a declaration specifier. */
+typedef struct decl_spec {
+ unsigned short flags; /* flags defined above */
+ char *text; /* source text */
+ long begin; /* offset in temporary file */
+} DeclSpec;
+
+/* This is a list of function parameters. */
+typedef struct _ParameterList {
+ struct parameter *first; /* pointer to first parameter in list */
+ struct parameter *last; /* pointer to last parameter in list */
+ long begin_comment; /* begin offset of comment */
+ long end_comment; /* end offset of comment */
+ char *comment; /* comment at start of parameter list */
+} ParameterList;
+
+/* This structure stores information about a declarator. */
+typedef struct _Declarator {
+ char *name; /* name of variable or function */
+ char *text; /* source text */
+ long begin; /* offset in temporary file */
+ long begin_comment; /* begin offset of comment */
+ long end_comment; /* end offset of comment */
+ FuncDefStyle func_def; /* style of function definition */
+ ParameterList params; /* function parameters */
+ boolean pointer; /* TRUE if it declares a pointer */
+ struct _Declarator *head; /* head function declarator */
+ struct _Declarator *func_stack; /* stack of function declarators */
+ struct _Declarator *next; /* next declarator in list */
+} Declarator;
+
+/* This structure stores information about a function parameter. */
+typedef struct parameter {
+ struct parameter *next; /* next parameter in list */
+ DeclSpec decl_spec;
+ Declarator *declarator;
+ char *comment; /* comment following the parameter */
+} Parameter;
+
+/* This is a list of declarators. */
+typedef struct declarator_list {
+ Declarator *first; /* pointer to first declarator in list */
+ Declarator *last; /* pointer to last declarator in list */
+} DeclaratorList;
+
+/* #include "symbol.h" */
+typedef struct symbol {
+ struct symbol *next; /* next symbol in list */
+ char *name; /* name of symbol */
+ char *value; /* value of symbol (for defines) */
+ short flags; /* symbol attributes */
+} Symbol;
+
+/* parser stack entry type */
+typedef union {
+ Text text;
+ DeclSpec decl_spec;
+ Parameter *parameter;
+ ParameterList param_list;
+ Declarator *declarator;
+ DeclaratorList decl_list;
+} YYSTYPE;
+
+/* The hash table length should be a prime number. */
+#define SYM_MAX_HASH 251
+
+typedef struct symbol_table {
+ Symbol *bucket[SYM_MAX_HASH]; /* hash buckets */
+} SymbolTable;
+
+extern SymbolTable *new_symbol_table /* Create symbol table */
+ (void);
+extern void free_symbol_table /* Destroy symbol table */
+ (SymbolTable *s);
+extern Symbol *find_symbol /* Lookup symbol name */
+ (SymbolTable *s, const char *n);
+extern Symbol *new_symbol /* Define new symbol */
+ (SymbolTable *s, const char *n, const char *v, int f);
+
+/* #include "semantic.h" */
+extern void new_decl_spec (DeclSpec *, const char *, long, int);
+extern void free_decl_spec (DeclSpec *);
+extern void join_decl_specs (DeclSpec *, DeclSpec *, DeclSpec *);
+extern void check_untagged (DeclSpec *);
+extern Declarator *new_declarator (const char *, const char *, long);
+extern void free_declarator (Declarator *);
+extern void new_decl_list (DeclaratorList *, Declarator *);
+extern void free_decl_list (DeclaratorList *);
+extern void add_decl_list (DeclaratorList *, DeclaratorList *, Declarator *);
+extern Parameter *new_parameter (DeclSpec *, Declarator *);
+extern void free_parameter (Parameter *);
+extern void new_param_list (ParameterList *, Parameter *);
+extern void free_param_list (ParameterList *);
+extern void add_param_list (ParameterList *, ParameterList *, Parameter *);
+extern void new_ident_list (ParameterList *);
+extern void add_ident_list (ParameterList *, ParameterList *, const char *);
+extern void set_param_types (ParameterList *, DeclSpec *, DeclaratorList *);
+extern void gen_declarations (DeclSpec *, DeclaratorList *);
+extern void gen_prototype (DeclSpec *, Declarator *);
+extern void gen_func_declarator (Declarator *);
+extern void gen_func_definition (DeclSpec *, Declarator *);
+
+extern void init_parser (void);
+extern void process_file (FILE *infile, char *name);
+extern char *cur_text (void);
+extern char *cur_file_name (void);
+extern char *implied_typedef (void);
+extern void include_file (char *name, int convert);
+extern char *supply_parm (int count);
+extern char *xstrdup (const char *);
+extern int already_declared (char *name);
+extern int is_actual_func (Declarator *d);
+extern int lint_ellipsis (Parameter *p);
+extern int want_typedef (void);
+extern void begin_tracking (void);
+extern void begin_typedef (void);
+extern void copy_typedef (char *s);
+extern void ellipsis_varargs (Declarator *d);
+extern void end_typedef (void);
+extern void flush_varargs (void);
+extern void fmt_library (int code);
+extern void imply_typedef (const char *s);
+extern void indent (FILE *outf);
+extern void put_blankline (FILE *outf);
+extern void put_body (FILE *outf, DeclSpec *decl_spec, Declarator *declarator);
+extern void put_char (FILE *outf, int c);
+extern void put_error (void);
+extern void put_newline (FILE *outf);
+extern void put_padded (FILE *outf, const char *s);
+extern void put_string (FILE *outf, const char *s);
+extern void track_in (void);
+
+extern boolean file_comments;
+extern FuncDefStyle func_style;
+extern char base_file[];
+
+extern int yylex (void);
+
+/* declaration specifier attributes for the typedef statement currently being
+ * scanned
+ */
+static int cur_decl_spec_flags;
+
+/* pointer to parameter list for the current function definition */
+static ParameterList *func_params;
+
+/* A parser semantic action sets this pointer to the current declarator in
+ * a function parameter declaration in order to catch any comments following
+ * the parameter declaration on the same line. If the lexer scans a comment
+ * and <cur_declarator> is not NULL, then the comment is attached to the
+ * declarator. To ignore subsequent comments, the lexer sets this to NULL
+ * after scanning a comment or end of line.
+ */
+static Declarator *cur_declarator;
+
+/* temporary string buffer */
+static char buf[MAX_TEXT_SIZE];
+
+/* table of typedef names */
+static SymbolTable *typedef_names;
+
+/* table of define names */
+static SymbolTable *define_names;
+
+/* table of type qualifiers */
+static SymbolTable *type_qualifiers;
+
+/* information about the current input file */
+typedef struct {
+ char *base_name; /* base input file name */
+ char *file_name; /* current file name */
+ FILE *file; /* input file */
+ unsigned line_num; /* current line number in input file */
+ FILE *tmp_file; /* temporary file */
+ long begin_comment; /* tmp file offset after last written ) or ; */
+ long end_comment; /* tmp file offset after last comment */
+ boolean convert; /* if TRUE, convert function definitions */
+ boolean changed; /* TRUE if conversion done in this file */
+} IncludeStack;
+
+static IncludeStack *cur_file; /* current input file */
+
+/* #include "yyerror.c" */
+
+static int haveAnsiParam (void);
+
+
+/* Flags to enable us to find if a procedure returns a value.
+ */
+static int return_val; /* nonzero on BRACES iff return-expression found */
+
+static const char *
+dft_decl_spec (void)
+{
+ return (lintLibrary() && !return_val) ? "void" : "int";
+}
+
+static int
+haveAnsiParam (void)
+{
+ Parameter *p;
+ if (func_params != 0) {
+ for (p = func_params->first; p != 0; p = p->next) {
+ if (p->declarator->func_def == FUNC_ANSI) {
+ return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+#line 408 "grammar.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define T_IDENTIFIER 257
+#define T_TYPEDEF_NAME 258
+#define T_DEFINE_NAME 259
+#define T_AUTO 260
+#define T_EXTERN 261
+#define T_REGISTER 262
+#define T_STATIC 263
+#define T_TYPEDEF 264
+#define T_INLINE 265
+#define T_EXTENSION 266
+#define T_CHAR 267
+#define T_DOUBLE 268
+#define T_FLOAT 269
+#define T_INT 270
+#define T_VOID 271
+#define T_LONG 272
+#define T_SHORT 273
+#define T_SIGNED 274
+#define T_UNSIGNED 275
+#define T_ENUM 276
+#define T_STRUCT 277
+#define T_UNION 278
+#define T_Bool 279
+#define T_Complex 280
+#define T_Imaginary 281
+#define T_TYPE_QUALIFIER 282
+#define T_BRACKETS 283
+#define T_LBRACE 284
+#define T_MATCHRBRACE 285
+#define T_ELLIPSIS 286
+#define T_INITIALIZER 287
+#define T_STRING_LITERAL 288
+#define T_ASM 289
+#define T_ASMARG 290
+#define T_VA_DCL 291
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT grammar_lhs[] = { -1,
+ 0, 0, 26, 26, 27, 27, 27, 27, 27, 27,
+ 27, 31, 30, 30, 28, 28, 34, 28, 32, 32,
+ 33, 33, 35, 35, 37, 38, 29, 39, 29, 36,
+ 36, 36, 40, 40, 1, 1, 2, 2, 2, 3,
+ 3, 3, 3, 3, 3, 4, 4, 4, 4, 4,
+ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
+ 5, 5, 6, 6, 6, 19, 19, 8, 8, 9,
+ 41, 9, 7, 7, 7, 25, 23, 23, 10, 10,
+ 11, 11, 11, 11, 11, 20, 20, 21, 21, 22,
+ 22, 14, 14, 15, 15, 16, 16, 16, 17, 17,
+ 18, 18, 24, 24, 12, 12, 12, 13, 13, 13,
+ 13, 13, 13, 13,
+};
+static const YYINT grammar_len[] = { 2,
+ 0, 1, 1, 2, 1, 1, 1, 1, 3, 2,
+ 2, 2, 3, 3, 2, 3, 0, 5, 2, 1,
+ 0, 1, 1, 3, 0, 0, 7, 0, 5, 0,
+ 1, 1, 1, 2, 1, 2, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 1, 3, 2, 2, 1, 1, 1, 3, 1,
+ 0, 4, 3, 2, 2, 1, 1, 1, 2, 1,
+ 1, 3, 2, 4, 4, 2, 3, 0, 1, 1,
+ 2, 1, 3, 1, 3, 2, 2, 1, 0, 1,
+ 1, 3, 1, 2, 1, 2, 1, 3, 2, 1,
+ 4, 3, 3, 2,
+};
+static const YYINT grammar_defred[] = { 0,
+ 0, 0, 0, 0, 77, 0, 62, 40, 0, 42,
+ 43, 20, 44, 0, 46, 47, 48, 49, 54, 50,
+ 51, 52, 53, 76, 66, 67, 55, 56, 57, 61,
+ 0, 7, 0, 0, 35, 37, 38, 39, 59, 60,
+ 28, 0, 0, 0, 103, 81, 0, 0, 3, 5,
+ 6, 8, 0, 10, 11, 78, 0, 90, 0, 0,
+ 104, 0, 19, 0, 41, 45, 15, 36, 0, 68,
+ 0, 0, 0, 83, 0, 0, 64, 0, 0, 74,
+ 4, 58, 0, 82, 87, 91, 0, 14, 13, 9,
+ 16, 0, 71, 0, 31, 33, 0, 0, 0, 0,
+ 0, 94, 0, 0, 101, 12, 63, 73, 0, 0,
+ 69, 0, 0, 0, 34, 0, 110, 96, 97, 0,
+ 0, 84, 0, 85, 0, 23, 0, 0, 72, 26,
+ 29, 114, 0, 0, 0, 109, 0, 93, 95, 102,
+ 18, 0, 0, 108, 113, 112, 0, 24, 27, 111,
+};
+static const YYINT grammar_stos[] = { 0,
+ 256, 40, 42, 38, 257, 258, 259, 260, 261, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ 289, 59, 293, 294, 295, 296, 297, 298, 299, 300,
+ 303, 304, 312, 313, 316, 317, 318, 319, 320, 321,
+ 322, 323, 325, 285, 59, 258, 303, 298, 314, 315,
+ 316, 288, 264, 290, 261, 266, 59, 295, 301, 302,
+ 303, 332, 40, 283, 284, 316, 324, 304, 316, 324,
+ 320, 258, 294, 41, 313, 298, 294, 321, 324, 59,
+ 59, 44, 61, 330, 291, 321, 329, 333, 294, 307,
+ 308, 309, 310, 311, 316, 285, 324, 324, 327, 303,
+ 302, 334, 329, 284, 321, 40, 283, 303, 305, 306,
+ 313, 41, 44, 41, 44, 303, 326, 328, 287, 284,
+ 285, 41, 305, 307, 40, 283, 306, 286, 309, 316,
+ 59, 44, 331, 41, 41, 41, 307, 303, 285, 41,
+};
+static const YYINT grammar_dgoto[] = { 33,
+ 87, 35, 36, 37, 38, 39, 40, 69, 70, 41,
+ 42, 119, 120, 100, 101, 102, 103, 104, 43, 44,
+ 59, 60, 45, 46, 47, 48, 49, 50, 51, 52,
+ 77, 53, 127, 109, 128, 97, 94, 143, 72, 98,
+ 112,
+};
+static const YYINT grammar_sindex[] = { -2,
+ -3, 27, -239, -177, 0, 0, 0, 0, -274, 0,
+ 0, 0, 0, -246, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ -266, 0, 0, 455, 0, 0, 0, 0, 0, 0,
+ 0, -35, -245, 128, 0, 0, -245, -2, 0, 0,
+ 0, 0, 642, 0, 0, 0, -15, 0, -12, -239,
+ 0, 590, 0, -27, 0, 0, 0, 0, -10, 0,
+ -11, 534, -72, 0, -237, -232, 0, -35, -232, 0,
+ 0, 0, 642, 0, 0, 0, 455, 0, 0, 0,
+ 0, 27, 0, 534, 0, 0, -222, 617, 209, 34,
+ 39, 0, 44, 42, 0, 0, 0, 0, 27, -11,
+ 0, -200, -196, -195, 0, 174, 0, 0, 0, -33,
+ 243, 0, 561, 0, -177, 0, 33, 49, 0, 0,
+ 0, 0, 53, 55, 417, 0, -33, 0, 0, 0,
+ 0, 27, -188, 0, 0, 0, 57, 0, 0, 0,
+};
+static const YYINT grammar_rindex[] = { 99,
+ 0, 0, 275, 0, 0, -38, 0, 0, 481, 0,
+ 0, 0, 0, 509, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 30, 0, 0, 0, 0, 0, 101, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 343, 309,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 98, -182, 62, 0, 0, 133, 0, 64, 379, 0,
+ 0, 0, -5, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, -182, 0, 0, 0, -180, -19, 0,
+ 65, 0, 0, 68, 0, 0, 0, 0, 51, 9,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, -13,
+ 19, 0, 0, 0, 0, 0, 0, 52, 0, 0,
+ 0, 0, 0, 0, 0, 0, 35, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+#if YYBTYACC
+static const YYINT grammar_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+};
+#endif
+static const YYINT grammar_gindex[] = { 0,
+ 11, -17, 0, 0, 13, 0, 0, 0, 20, 8,
+ -43, -1, -8, -89, 0, -9, 0, 0, 0, -44,
+ 0, 0, 4, 0, 0, 0, 70, -53, 0, 0,
+ -18, 0, 0, 0, 0, 22, 0, 0, 0, 0,
+ 0,
+};
+#define YYTABLESIZE 924
+static const YYINT grammar_table[] = { 58,
+ 78, 58, 58, 58, 73, 58, 135, 61, 88, 57,
+ 34, 5, 56, 62, 85, 58, 68, 63, 96, 7,
+ 58, 98, 78, 64, 98, 84, 134, 107, 80, 3,
+ 107, 90, 17, 92, 17, 4, 17, 2, 75, 3,
+ 96, 71, 30, 89, 115, 147, 76, 106, 91, 93,
+ 79, 75, 70, 17, 121, 55, 32, 107, 34, 105,
+ 108, 114, 105, 83, 4, 68, 2, 70, 3, 68,
+ 80, 121, 86, 80, 122, 106, 105, 78, 106, 5,
+ 56, 68, 123, 99, 124, 125, 129, 130, 80, 131,
+ 80, 141, 142, 144, 110, 145, 149, 150, 1, 110,
+ 2, 30, 99, 32, 79, 92, 118, 79, 100, 21,
+ 22, 111, 137, 139, 133, 113, 126, 81, 0, 0,
+ 0, 0, 79, 57, 79, 0, 99, 0, 140, 0,
+ 0, 0, 0, 99, 0, 0, 0, 0, 0, 0,
+ 0, 70, 0, 0, 0, 99, 0, 0, 0, 148,
+ 0, 0, 0, 0, 0, 0, 70, 0, 0, 0,
+ 0, 0, 0, 0, 0, 4, 0, 2, 0, 0,
+ 65, 0, 65, 65, 65, 0, 65, 0, 0, 0,
+ 0, 0, 0, 0, 5, 6, 7, 8, 65, 10,
+ 11, 65, 13, 66, 15, 16, 17, 18, 19, 20,
+ 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+ 0, 4, 0, 116, 132, 3, 0, 0, 58, 58,
+ 58, 58, 58, 58, 58, 78, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ 58, 58, 58, 58, 58, 78, 4, 74, 116, 136,
+ 3, 17, 78, 1, 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,
+ 4, 54, 116, 5, 56, 0, 31, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+ 80, 80, 88, 80, 88, 88, 88, 0, 88, 0,
+ 80, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 79, 79, 79, 79,
+ 79, 79, 79, 79, 79, 79, 89, 79, 89, 89,
+ 89, 0, 89, 0, 79, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+ 86, 25, 86, 86, 5, 56, 86, 0, 25, 65,
+ 65, 65, 65, 65, 65, 65, 0, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 65, 65, 65, 65,
+ 65, 65, 65, 65, 65, 65, 75, 0, 75, 75,
+ 75, 0, 75, 0, 0, 0, 0, 0, 0, 0,
+ 5, 6, 7, 8, 65, 10, 11, 75, 13, 66,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 117, 146, 0, 0,
+ 0, 0, 0, 0, 0, 5, 6, 7, 8, 65,
+ 10, 11, 0, 13, 66, 15, 16, 17, 18, 19,
+ 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
+ 30, 117, 4, 0, 2, 0, 3, 0, 0, 5,
+ 56, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 67, 0, 0, 0, 0, 41, 0,
+ 41, 0, 41, 0, 0, 117, 0, 0, 0, 0,
+ 0, 88, 88, 0, 0, 0, 0, 0, 0, 41,
+ 0, 0, 0, 0, 0, 0, 45, 0, 45, 0,
+ 45, 0, 0, 0, 0, 0, 0, 88, 0, 0,
+ 0, 0, 0, 0, 0, 89, 89, 45, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 89, 0, 0, 0, 0, 0, 0, 0, 86,
+ 86, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 86, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 75, 75, 75, 75, 75,
+ 75, 75, 0, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
+ 75, 75, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 82, 7, 8, 65, 10, 11,
+ 0, 13, 66, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 5, 6, 7, 8, 65, 10, 11, 0, 13,
+ 66, 15, 16, 17, 18, 19, 20, 21, 22, 23,
+ 24, 25, 26, 27, 28, 29, 30, 41, 41, 41,
+ 41, 41, 41, 41, 0, 41, 41, 41, 41, 41,
+ 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+ 41, 41, 41, 0, 0, 45, 45, 45, 45, 45,
+ 45, 45, 0, 45, 45, 45, 45, 45, 45, 45,
+ 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+ 45, 82, 7, 8, 65, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
+ 25, 26, 27, 28, 29, 30, 0, 0, 82, 7,
+ 8, 65, 10, 11, 95, 13, 66, 15, 16, 17,
+ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 0, 0, 0, 138, 82, 7, 8,
+ 65, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+ 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
+ 29, 30, 0, 75, 82, 7, 8, 65, 10, 11,
+ 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
+ 22, 23, 24, 25, 26, 27, 28, 29, 30, 82,
+ 7, 8, 65, 10, 11, 0, 13, 66, 15, 16,
+ 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30,
+};
+static const YYINT grammar_check[] = { 38,
+ 44, 40, 41, 42, 40, 44, 40, 4, 62, 2,
+ 0, 257, 258, 288, 59, 3, 34, 264, 72, 259,
+ 59, 41, 61, 290, 44, 41, 116, 41, 47, 42,
+ 44, 59, 38, 44, 40, 38, 42, 40, 284, 42,
+ 94, 34, 282, 62, 98, 135, 43, 285, 59, 61,
+ 47, 284, 44, 59, 99, 59, 59, 76, 48, 41,
+ 79, 284, 44, 53, 38, 83, 40, 59, 42, 87,
+ 41, 116, 60, 44, 41, 41, 73, 121, 44, 257,
+ 258, 99, 44, 73, 41, 44, 287, 284, 59, 285,
+ 61, 59, 44, 41, 87, 41, 285, 41, 0, 92,
+ 0, 284, 41, 284, 41, 41, 99, 44, 41, 59,
+ 59, 92, 121, 123, 116, 94, 109, 48, -1, -1,
+ -1, -1, 59, 116, 61, -1, 116, -1, 125, -1,
+ -1, -1, -1, 123, -1, -1, -1, -1, -1, -1,
+ -1, 44, -1, -1, -1, 135, -1, -1, -1, 142,
+ -1, -1, -1, -1, -1, -1, 59, -1, -1, -1,
+ -1, -1, -1, -1, -1, 38, -1, 40, -1, -1,
+ 38, -1, 40, 41, 42, -1, 44, -1, -1, -1,
+ -1, -1, -1, -1, 257, 258, 259, 260, 261, 262,
+ 263, 59, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ -1, 38, -1, 40, 41, 42, -1, -1, 257, 258,
+ 259, 260, 261, 262, 263, 264, 265, 266, 267, 268,
+ 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
+ 279, 280, 281, 282, 283, 284, 38, 283, 40, 283,
+ 42, 257, 291, 256, 257, 258, 259, 260, 261, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ 38, 285, 40, 257, 258, -1, 289, 258, 259, 260,
+ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
+ 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
+ 281, 282, 38, 284, 40, 41, 42, -1, 44, -1,
+ 291, 258, 259, 260, 261, 262, 263, 264, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
+ 277, 278, 279, 280, 281, 282, 38, 284, 40, 41,
+ 42, -1, 44, -1, 291, 258, 259, 260, 261, 262,
+ 263, 264, 265, 266, 267, 268, 269, 270, 271, 272,
+ 273, 274, 275, 276, 277, 278, 279, 280, 281, 282,
+ 38, 284, 40, 41, 257, 258, 44, -1, 291, 257,
+ 258, 259, 260, 261, 262, 263, -1, 265, 266, 267,
+ 268, 269, 270, 271, 272, 273, 274, 275, 276, 277,
+ 278, 279, 280, 281, 282, 283, 38, -1, 40, 41,
+ 42, -1, 44, -1, -1, -1, -1, -1, -1, -1,
+ 257, 258, 259, 260, 261, 262, 263, 59, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
+ 277, 278, 279, 280, 281, 282, 283, 41, -1, -1,
+ -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
+ 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
+ 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
+ 282, 283, 38, -1, 40, -1, 42, -1, -1, 257,
+ 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 59, -1, -1, -1, -1, 38, -1,
+ 40, -1, 42, -1, -1, 283, -1, -1, -1, -1,
+ -1, 257, 258, -1, -1, -1, -1, -1, -1, 59,
+ -1, -1, -1, -1, -1, -1, 38, -1, 40, -1,
+ 42, -1, -1, -1, -1, -1, -1, 283, -1, -1,
+ -1, -1, -1, -1, -1, 257, 258, 59, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 283, -1, -1, -1, -1, -1, -1, -1, 257,
+ 258, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 283, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, 258, 259, 260, 261,
+ 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
+ 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
+ 282, 283, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, 258, 259, 260, 261, 262, 263,
+ -1, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+ 274, 275, 276, 277, 278, 279, 280, 281, 282, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 257, 258, 259, 260, 261, 262, 263, -1, 265,
+ 266, 267, 268, 269, 270, 271, 272, 273, 274, 275,
+ 276, 277, 278, 279, 280, 281, 282, 257, 258, 259,
+ 260, 261, 262, 263, -1, 265, 266, 267, 268, 269,
+ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
+ 280, 281, 282, -1, -1, 257, 258, 259, 260, 261,
+ 262, 263, -1, 265, 266, 267, 268, 269, 270, 271,
+ 272, 273, 274, 275, 276, 277, 278, 279, 280, 281,
+ 282, 258, 259, 260, 261, 262, 263, 264, 265, 266,
+ 267, 268, 269, 270, 271, 272, 273, 274, 275, 276,
+ 277, 278, 279, 280, 281, 282, -1, -1, 258, 259,
+ 260, 261, 262, 263, 291, 265, 266, 267, 268, 269,
+ 270, 271, 272, 273, 274, 275, 276, 277, 278, 279,
+ 280, 281, 282, -1, -1, -1, 286, 258, 259, 260,
+ 261, 262, 263, 264, 265, 266, 267, 268, 269, 270,
+ 271, 272, 273, 274, 275, 276, 277, 278, 279, 280,
+ 281, 282, -1, 284, 258, 259, 260, 261, 262, 263,
+ 264, 265, 266, 267, 268, 269, 270, 271, 272, 273,
+ 274, 275, 276, 277, 278, 279, 280, 281, 282, 258,
+ 259, 260, 261, 262, 263, -1, 265, 266, 267, 268,
+ 269, 270, 271, 272, 273, 274, 275, 276, 277, 278,
+ 279, 280, 281, 282,
+};
+#define YYFINAL 33
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 291
+#define YYUNDFTOKEN 335
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const grammar_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,"'&'",0,"'('","')'","'*'",0,"','",0,0,0,0,0,0,0,0,0,0,0,0,0,0,"';'",0,"'='",0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error",
+"T_IDENTIFIER","T_TYPEDEF_NAME","T_DEFINE_NAME","T_AUTO","T_EXTERN",
+"T_REGISTER","T_STATIC","T_TYPEDEF","T_INLINE","T_EXTENSION","T_CHAR",
+"T_DOUBLE","T_FLOAT","T_INT","T_VOID","T_LONG","T_SHORT","T_SIGNED",
+"T_UNSIGNED","T_ENUM","T_STRUCT","T_UNION","T_Bool","T_Complex","T_Imaginary",
+"T_TYPE_QUALIFIER","T_BRACKETS","T_LBRACE","T_MATCHRBRACE","T_ELLIPSIS",
+"T_INITIALIZER","T_STRING_LITERAL","T_ASM","T_ASMARG","T_VA_DCL","$accept",
+"program","decl_specifiers","decl_specifier","storage_class","type_specifier",
+"type_qualifier","struct_or_union_specifier","enum_specifier",
+"init_declarator_list","init_declarator","declarator","direct_declarator",
+"abs_declarator","direct_abs_declarator","parameter_type_list","parameter_list",
+"parameter_declaration","opt_identifier_list","identifier_list",
+"struct_or_union","pointer","opt_type_qualifiers","type_qualifier_list",
+"any_id","identifier_or_ref","enumeration","translation_unit",
+"external_declaration","declaration","function_definition",
+"linkage_specification","braces","any_typedef","opt_declarator_list","$$1",
+"declarator_list","opt_declaration_list","$$2","$$3","$$4","declaration_list",
+"$$5","illegal-symbol",
+};
+static const char *const grammar_rule[] = {
+"$accept : program",
+"program :",
+"program : translation_unit",
+"translation_unit : external_declaration",
+"translation_unit : translation_unit external_declaration",
+"external_declaration : declaration",
+"external_declaration : function_definition",
+"external_declaration : ';'",
+"external_declaration : linkage_specification",
+"external_declaration : T_ASM T_ASMARG ';'",
+"external_declaration : error T_MATCHRBRACE",
+"external_declaration : error ';'",
+"braces : T_LBRACE T_MATCHRBRACE",
+"linkage_specification : T_EXTERN T_STRING_LITERAL braces",
+"linkage_specification : T_EXTERN T_STRING_LITERAL declaration",
+"declaration : decl_specifiers ';'",
+"declaration : decl_specifiers init_declarator_list ';'",
+"$$1 :",
+"declaration : any_typedef decl_specifiers $$1 opt_declarator_list ';'",
+"any_typedef : T_EXTENSION T_TYPEDEF",
+"any_typedef : T_TYPEDEF",
+"opt_declarator_list :",
+"opt_declarator_list : declarator_list",
+"declarator_list : declarator",
+"declarator_list : declarator_list ',' declarator",
+"$$2 :",
+"$$3 :",
+"function_definition : decl_specifiers declarator $$2 opt_declaration_list T_LBRACE $$3 T_MATCHRBRACE",
+"$$4 :",
+"function_definition : declarator $$4 opt_declaration_list T_LBRACE T_MATCHRBRACE",
+"opt_declaration_list :",
+"opt_declaration_list : T_VA_DCL",
+"opt_declaration_list : declaration_list",
+"declaration_list : declaration",
+"declaration_list : declaration_list declaration",
+"decl_specifiers : decl_specifier",
+"decl_specifiers : decl_specifiers decl_specifier",
+"decl_specifier : storage_class",
+"decl_specifier : type_specifier",
+"decl_specifier : type_qualifier",
+"storage_class : T_AUTO",
+"storage_class : T_EXTERN",
+"storage_class : T_REGISTER",
+"storage_class : T_STATIC",
+"storage_class : T_INLINE",
+"storage_class : T_EXTENSION",
+"type_specifier : T_CHAR",
+"type_specifier : T_DOUBLE",
+"type_specifier : T_FLOAT",
+"type_specifier : T_INT",
+"type_specifier : T_LONG",
+"type_specifier : T_SHORT",
+"type_specifier : T_SIGNED",
+"type_specifier : T_UNSIGNED",
+"type_specifier : T_VOID",
+"type_specifier : T_Bool",
+"type_specifier : T_Complex",
+"type_specifier : T_Imaginary",
+"type_specifier : T_TYPEDEF_NAME",
+"type_specifier : struct_or_union_specifier",
+"type_specifier : enum_specifier",
+"type_qualifier : T_TYPE_QUALIFIER",
+"type_qualifier : T_DEFINE_NAME",
+"struct_or_union_specifier : struct_or_union any_id braces",
+"struct_or_union_specifier : struct_or_union braces",
+"struct_or_union_specifier : struct_or_union any_id",
+"struct_or_union : T_STRUCT",
+"struct_or_union : T_UNION",
+"init_declarator_list : init_declarator",
+"init_declarator_list : init_declarator_list ',' init_declarator",
+"init_declarator : declarator",
+"$$5 :",
+"init_declarator : declarator '=' $$5 T_INITIALIZER",
+"enum_specifier : enumeration any_id braces",
+"enum_specifier : enumeration braces",
+"enum_specifier : enumeration any_id",
+"enumeration : T_ENUM",
+"any_id : T_IDENTIFIER",
+"any_id : T_TYPEDEF_NAME",
+"declarator : pointer direct_declarator",
+"declarator : direct_declarator",
+"direct_declarator : identifier_or_ref",
+"direct_declarator : '(' declarator ')'",
+"direct_declarator : direct_declarator T_BRACKETS",
+"direct_declarator : direct_declarator '(' parameter_type_list ')'",
+"direct_declarator : direct_declarator '(' opt_identifier_list ')'",
+"pointer : '*' opt_type_qualifiers",
+"pointer : '*' opt_type_qualifiers pointer",
+"opt_type_qualifiers :",
+"opt_type_qualifiers : type_qualifier_list",
+"type_qualifier_list : type_qualifier",
+"type_qualifier_list : type_qualifier_list type_qualifier",
+"parameter_type_list : parameter_list",
+"parameter_type_list : parameter_list ',' T_ELLIPSIS",
+"parameter_list : parameter_declaration",
+"parameter_list : parameter_list ',' parameter_declaration",
+"parameter_declaration : decl_specifiers declarator",
+"parameter_declaration : decl_specifiers abs_declarator",
+"parameter_declaration : decl_specifiers",
+"opt_identifier_list :",
+"opt_identifier_list : identifier_list",
+"identifier_list : any_id",
+"identifier_list : identifier_list ',' any_id",
+"identifier_or_ref : any_id",
+"identifier_or_ref : '&' any_id",
+"abs_declarator : pointer",
+"abs_declarator : pointer direct_abs_declarator",
+"abs_declarator : direct_abs_declarator",
+"direct_abs_declarator : '(' abs_declarator ')'",
+"direct_abs_declarator : direct_abs_declarator T_BRACKETS",
+"direct_abs_declarator : T_BRACKETS",
+"direct_abs_declarator : direct_abs_declarator '(' parameter_type_list ')'",
+"direct_abs_declarator : direct_abs_declarator '(' ')'",
+"direct_abs_declarator : '(' parameter_type_list ')'",
+"direct_abs_declarator : '(' ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 1014 "grammar.y"
+
+/* lex.yy.c */
+#define BEGIN yy_start = 1 + 2 *
+
+#define CPP1 1
+#define INIT1 2
+#define INIT2 3
+#define CURLY 4
+#define LEXYACC 5
+#define ASM 6
+#define CPP_INLINE 7
+
+extern char *yytext;
+extern FILE *yyin, *yyout;
+
+static int curly; /* number of curly brace nesting levels */
+static int ly_count; /* number of occurances of %% */
+static int inc_depth; /* include nesting level */
+static SymbolTable *included_files; /* files already included */
+static int yy_start = 0; /* start state number */
+
+#define grammar_error(s) yaccError(s)
+
+static void
+yaccError (const char *msg)
+{
+ func_params = NULL;
+ put_error(); /* tell what line we're on, and what file */
+ fprintf(stderr, "%s at token '%s'\n", msg, yytext);
+}
+
+/* Initialize the table of type qualifier keywords recognized by the lexical
+ * analyzer.
+ */
+void
+init_parser (void)
+{
+ static const char *keywords[] = {
+ "const",
+ "restrict",
+ "volatile",
+ "interrupt",
+#ifdef vms
+ "noshare",
+ "readonly",
+#endif
+#if defined(MSDOS) || defined(OS2)
+ "__cdecl",
+ "__export",
+ "__far",
+ "__fastcall",
+ "__fortran",
+ "__huge",
+ "__inline",
+ "__interrupt",
+ "__loadds",
+ "__near",
+ "__pascal",
+ "__saveregs",
+ "__segment",
+ "__stdcall",
+ "__syscall",
+ "_cdecl",
+ "_cs",
+ "_ds",
+ "_es",
+ "_export",
+ "_far",
+ "_fastcall",
+ "_fortran",
+ "_huge",
+ "_interrupt",
+ "_loadds",
+ "_near",
+ "_pascal",
+ "_saveregs",
+ "_seg",
+ "_segment",
+ "_ss",
+ "cdecl",
+ "far",
+ "huge",
+ "near",
+ "pascal",
+#ifdef OS2
+ "__far16",
+#endif
+#endif
+#ifdef __GNUC__
+ /* gcc aliases */
+ "__builtin_va_arg",
+ "__builtin_va_list",
+ "__const",
+ "__const__",
+ "__inline",
+ "__inline__",
+ "__restrict",
+ "__restrict__",
+ "__volatile",
+ "__volatile__",
+#endif
+ };
+ unsigned i;
+
+ /* Initialize type qualifier table. */
+ type_qualifiers = new_symbol_table();
+ for (i = 0; i < sizeof(keywords)/sizeof(keywords[0]); ++i) {
+ new_symbol(type_qualifiers, keywords[i], NULL, DS_NONE);
+ }
+}
+
+/* Process the C source file. Write function prototypes to the standard
+ * output. Convert function definitions and write the converted source
+ * code to a temporary file.
+ */
+void
+process_file (FILE *infile, char *name)
+{
+ char *s;
+
+ if (strlen(name) > 2) {
+ s = name + strlen(name) - 2;
+ if (*s == '.') {
+ ++s;
+ if (*s == 'l' || *s == 'y')
+ BEGIN LEXYACC;
+#if defined(MSDOS) || defined(OS2)
+ if (*s == 'L' || *s == 'Y')
+ BEGIN LEXYACC;
+#endif
+ }
+ }
+
+ included_files = new_symbol_table();
+ typedef_names = new_symbol_table();
+ define_names = new_symbol_table();
+ inc_depth = -1;
+ curly = 0;
+ ly_count = 0;
+ func_params = NULL;
+ yyin = infile;
+ include_file(strcpy(base_file, name), func_style != FUNC_NONE);
+ if (file_comments) {
+#if OPT_LINTLIBRARY
+ if (lintLibrary()) {
+ put_blankline(stdout);
+ begin_tracking();
+ }
+#endif
+ put_string(stdout, "/* ");
+ put_string(stdout, cur_file_name());
+ put_string(stdout, " */\n");
+ }
+ yyparse();
+ free_symbol_table(define_names);
+ free_symbol_table(typedef_names);
+ free_symbol_table(included_files);
+}
+
+#ifdef NO_LEAKS
+void
+free_parser(void)
+{
+ free_symbol_table (type_qualifiers);
+#ifdef FLEX_SCANNER
+ if (yy_current_buffer != 0)
+ yy_delete_buffer(yy_current_buffer);
+#endif
+}
+#endif
+#line 1248 "grammar.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 10:
+#line 377 "grammar.y"
+ {
+ yyerrok;
+ }
+break;
+case 11:
+#line 381 "grammar.y"
+ {
+ yyerrok;
+ }
+break;
+case 13:
+#line 392 "grammar.y"
+ {
+ /* Provide an empty action here so bison will not complain about
+ * incompatible types in the default action it normally would
+ * have generated.
+ */
+ }
+break;
+case 14:
+#line 399 "grammar.y"
+ {
+ /* empty */
+ }
+break;
+case 15:
+#line 406 "grammar.y"
+ {
+#if OPT_LINTLIBRARY
+ if (types_out && want_typedef()) {
+ gen_declarations(&yystack.l_mark[-1].decl_spec, (DeclaratorList *)0);
+ flush_varargs();
+ }
+#endif
+ free_decl_spec(&yystack.l_mark[-1].decl_spec);
+ end_typedef();
+ }
+break;
+case 16:
+#line 417 "grammar.y"
+ {
+ if (func_params != NULL) {
+ set_param_types(func_params, &yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
+ } else {
+ gen_declarations(&yystack.l_mark[-2].decl_spec, &yystack.l_mark[-1].decl_list);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_list(&yystack.l_mark[-1].decl_list);
+ }
+ free_decl_spec(&yystack.l_mark[-2].decl_spec);
+ end_typedef();
+ }
+break;
+case 17:
+#line 431 "grammar.y"
+ {
+ cur_decl_spec_flags = yystack.l_mark[0].decl_spec.flags;
+ free_decl_spec(&yystack.l_mark[0].decl_spec);
+ }
+break;
+case 18:
+#line 436 "grammar.y"
+ {
+ end_typedef();
+ }
+break;
+case 19:
+#line 443 "grammar.y"
+ {
+ begin_typedef();
+ }
+break;
+case 20:
+#line 447 "grammar.y"
+ {
+ begin_typedef();
+ }
+break;
+case 23:
+#line 459 "grammar.y"
+ {
+ int flags = cur_decl_spec_flags;
+
+ /* If the typedef is a pointer type, then reset the short type
+ * flags so it does not get promoted.
+ */
+ if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
+ flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
+ new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
+ free_declarator(yystack.l_mark[0].declarator);
+ }
+break;
+case 24:
+#line 471 "grammar.y"
+ {
+ int flags = cur_decl_spec_flags;
+
+ if (strcmp(yystack.l_mark[0].declarator->text, yystack.l_mark[0].declarator->name) != 0)
+ flags &= ~(DS_CHAR | DS_SHORT | DS_FLOAT);
+ new_symbol(typedef_names, yystack.l_mark[0].declarator->name, NULL, flags);
+ free_declarator(yystack.l_mark[0].declarator);
+ }
+break;
+case 25:
+#line 483 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[-1].decl_spec);
+ if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
+ yyerror("syntax error");
+ YYERROR;
+ }
+ func_params = &(yystack.l_mark[0].declarator->head->params);
+ func_params->begin_comment = cur_file->begin_comment;
+ func_params->end_comment = cur_file->end_comment;
+ }
+break;
+case 26:
+#line 494 "grammar.y"
+ {
+ /* If we're converting to K&R and we've got a nominally K&R
+ * function which has a parameter which is ANSI (i.e., a prototyped
+ * function pointer), then we must override the deciphered value of
+ * 'func_def' so that the parameter will be converted.
+ */
+ if (func_style == FUNC_TRADITIONAL
+ && haveAnsiParam()
+ && yystack.l_mark[-3].declarator->head->func_def == func_style) {
+ yystack.l_mark[-3].declarator->head->func_def = FUNC_BOTH;
+ }
+
+ func_params = NULL;
+
+ if (cur_file->convert)
+ gen_func_definition(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
+ gen_prototype(&yystack.l_mark[-4].decl_spec, yystack.l_mark[-3].declarator);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_spec(&yystack.l_mark[-4].decl_spec);
+ free_declarator(yystack.l_mark[-3].declarator);
+ }
+break;
+case 28:
+#line 519 "grammar.y"
+ {
+ if (yystack.l_mark[0].declarator->func_def == FUNC_NONE) {
+ yyerror("syntax error");
+ YYERROR;
+ }
+ func_params = &(yystack.l_mark[0].declarator->head->params);
+ func_params->begin_comment = cur_file->begin_comment;
+ func_params->end_comment = cur_file->end_comment;
+ }
+break;
+case 29:
+#line 529 "grammar.y"
+ {
+ DeclSpec decl_spec;
+
+ func_params = NULL;
+
+ new_decl_spec(&decl_spec, dft_decl_spec(), yystack.l_mark[-4].declarator->begin, DS_NONE);
+ if (cur_file->convert)
+ gen_func_definition(&decl_spec, yystack.l_mark[-4].declarator);
+ gen_prototype(&decl_spec, yystack.l_mark[-4].declarator);
+#if OPT_LINTLIBRARY
+ flush_varargs();
+#endif
+ free_decl_spec(&decl_spec);
+ free_declarator(yystack.l_mark[-4].declarator);
+ }
+break;
+case 36:
+#line 560 "grammar.y"
+ {
+ join_decl_specs(&yyval.decl_spec, &yystack.l_mark[-1].decl_spec, &yystack.l_mark[0].decl_spec);
+ free(yystack.l_mark[-1].decl_spec.text);
+ free(yystack.l_mark[0].decl_spec.text);
+ }
+break;
+case 40:
+#line 575 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 41:
+#line 579 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_EXTERN);
+ }
+break;
+case 42:
+#line 583 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 43:
+#line 587 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_STATIC);
+ }
+break;
+case 44:
+#line 591 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_INLINE);
+ }
+break;
+case 45:
+#line 595 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_JUNK);
+ }
+break;
+case 46:
+#line 602 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
+ }
+break;
+case 47:
+#line 606 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 48:
+#line 610 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_FLOAT);
+ }
+break;
+case 49:
+#line 614 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 50:
+#line 618 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 51:
+#line 622 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_SHORT);
+ }
+break;
+case 52:
+#line 626 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 53:
+#line 630 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 54:
+#line 634 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 55:
+#line 638 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_CHAR);
+ }
+break;
+case 56:
+#line 642 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 57:
+#line 646 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 58:
+#line 650 "grammar.y"
+ {
+ Symbol *s;
+ s = find_symbol(typedef_names, yystack.l_mark[0].text.text);
+ if (s != NULL)
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
+ }
+break;
+case 61:
+#line 662 "grammar.y"
+ {
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, DS_NONE);
+ }
+break;
+case 62:
+#line 666 "grammar.y"
+ {
+ /* This rule allows the <pointer> nonterminal to scan #define
+ * names as if they were type modifiers.
+ */
+ Symbol *s;
+ s = find_symbol(define_names, yystack.l_mark[0].text.text);
+ if (s != NULL)
+ new_decl_spec(&yyval.decl_spec, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin, s->flags);
+ }
+break;
+case 63:
+#line 679 "grammar.y"
+ {
+ char *s;
+ if ((s = implied_typedef()) == 0)
+ (void)sprintf(s = buf, "%s %s", yystack.l_mark[-2].text.text, yystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
+ }
+break;
+case 64:
+#line 686 "grammar.y"
+ {
+ char *s;
+ if ((s = implied_typedef()) == 0)
+ (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
+ }
+break;
+case 65:
+#line 693 "grammar.y"
+ {
+ (void)sprintf(buf, "%s %s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
+ new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
+ }
+break;
+case 66:
+#line 701 "grammar.y"
+ {
+ imply_typedef(yyval.text.text);
+ }
+break;
+case 67:
+#line 705 "grammar.y"
+ {
+ imply_typedef(yyval.text.text);
+ }
+break;
+case 68:
+#line 712 "grammar.y"
+ {
+ new_decl_list(&yyval.decl_list, yystack.l_mark[0].declarator);
+ }
+break;
+case 69:
+#line 716 "grammar.y"
+ {
+ add_decl_list(&yyval.decl_list, &yystack.l_mark[-2].decl_list, yystack.l_mark[0].declarator);
+ }
+break;
+case 70:
+#line 723 "grammar.y"
+ {
+ if (yystack.l_mark[0].declarator->func_def != FUNC_NONE && func_params == NULL &&
+ func_style == FUNC_TRADITIONAL && cur_file->convert) {
+ gen_func_declarator(yystack.l_mark[0].declarator);
+ fputs(cur_text(), cur_file->tmp_file);
+ }
+ cur_declarator = yyval.declarator;
+ }
+break;
+case 71:
+#line 732 "grammar.y"
+ {
+ if (yystack.l_mark[-1].declarator->func_def != FUNC_NONE && func_params == NULL &&
+ func_style == FUNC_TRADITIONAL && cur_file->convert) {
+ gen_func_declarator(yystack.l_mark[-1].declarator);
+ fputs(" =", cur_file->tmp_file);
+ }
+ }
+break;
+case 73:
+#line 744 "grammar.y"
+ {
+ char *s;
+ if ((s = implied_typedef()) == 0)
+ (void)sprintf(s = buf, "enum %s", yystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-2].text.begin, DS_NONE);
+ }
+break;
+case 74:
+#line 751 "grammar.y"
+ {
+ char *s;
+ if ((s = implied_typedef()) == 0)
+ (void)sprintf(s = buf, "%s {}", yystack.l_mark[-1].text.text);
+ new_decl_spec(&yyval.decl_spec, s, yystack.l_mark[-1].text.begin, DS_NONE);
+ }
+break;
+case 75:
+#line 758 "grammar.y"
+ {
+ (void)sprintf(buf, "enum %s", yystack.l_mark[0].text.text);
+ new_decl_spec(&yyval.decl_spec, buf, yystack.l_mark[-1].text.begin, DS_NONE);
+ }
+break;
+case 76:
+#line 766 "grammar.y"
+ {
+ imply_typedef("enum");
+ yyval.text = yystack.l_mark[0].text;
+ }
+break;
+case 79:
+#line 779 "grammar.y"
+ {
+ yyval.declarator = yystack.l_mark[0].declarator;
+ (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text = xstrdup(buf);
+ yyval.declarator->begin = yystack.l_mark[-1].text.begin;
+ yyval.declarator->pointer = TRUE;
+ }
+break;
+case 81:
+#line 792 "grammar.y"
+ {
+ yyval.declarator = new_declarator(yystack.l_mark[0].text.text, yystack.l_mark[0].text.text, yystack.l_mark[0].text.begin);
+ }
+break;
+case 82:
+#line 796 "grammar.y"
+ {
+ yyval.declarator = yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "(%s)", yyval.declarator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text = xstrdup(buf);
+ yyval.declarator->begin = yystack.l_mark[-2].text.begin;
+ }
+break;
+case 83:
+#line 804 "grammar.y"
+ {
+ yyval.declarator = yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
+ free(yyval.declarator->text);
+ yyval.declarator->text = xstrdup(buf);
+ }
+break;
+case 84:
+#line 811 "grammar.y"
+ {
+ yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
+ yyval.declarator->params = yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
+ yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
+ yyval.declarator->func_def = FUNC_ANSI;
+ }
+break;
+case 85:
+#line 819 "grammar.y"
+ {
+ yyval.declarator = new_declarator("%s()", yystack.l_mark[-3].declarator->name, yystack.l_mark[-3].declarator->begin);
+ yyval.declarator->params = yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
+ yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
+ yyval.declarator->func_def = FUNC_TRADITIONAL;
+ }
+break;
+case 86:
+#line 830 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "*%s", yystack.l_mark[0].text.text);
+ yyval.text.begin = yystack.l_mark[-1].text.begin;
+ }
+break;
+case 87:
+#line 835 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "*%s%s", yystack.l_mark[-1].text.text, yystack.l_mark[0].text.text);
+ yyval.text.begin = yystack.l_mark[-2].text.begin;
+ }
+break;
+case 88:
+#line 843 "grammar.y"
+ {
+ strcpy(yyval.text.text, "");
+ yyval.text.begin = 0L;
+ }
+break;
+case 90:
+#line 852 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "%s ", yystack.l_mark[0].decl_spec.text);
+ yyval.text.begin = yystack.l_mark[0].decl_spec.begin;
+ free(yystack.l_mark[0].decl_spec.text);
+ }
+break;
+case 91:
+#line 858 "grammar.y"
+ {
+ (void)sprintf(yyval.text.text, "%s%s ", yystack.l_mark[-1].text.text, yystack.l_mark[0].decl_spec.text);
+ yyval.text.begin = yystack.l_mark[-1].text.begin;
+ free(yystack.l_mark[0].decl_spec.text);
+ }
+break;
+case 93:
+#line 868 "grammar.y"
+ {
+ add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, "...");
+ }
+break;
+case 94:
+#line 875 "grammar.y"
+ {
+ new_param_list(&yyval.param_list, yystack.l_mark[0].parameter);
+ }
+break;
+case 95:
+#line 879 "grammar.y"
+ {
+ add_param_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].parameter);
+ }
+break;
+case 96:
+#line 886 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[-1].decl_spec);
+ yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
+ }
+break;
+case 97:
+#line 891 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[-1].decl_spec);
+ yyval.parameter = new_parameter(&yystack.l_mark[-1].decl_spec, yystack.l_mark[0].declarator);
+ }
+break;
+case 98:
+#line 896 "grammar.y"
+ {
+ check_untagged(&yystack.l_mark[0].decl_spec);
+ yyval.parameter = new_parameter(&yystack.l_mark[0].decl_spec, (Declarator *)0);
+ }
+break;
+case 99:
+#line 904 "grammar.y"
+ {
+ new_ident_list(&yyval.param_list);
+ }
+break;
+case 101:
+#line 912 "grammar.y"
+ {
+ new_ident_list(&yyval.param_list);
+ add_ident_list(&yyval.param_list, &yyval.param_list, yystack.l_mark[0].text.text);
+ }
+break;
+case 102:
+#line 917 "grammar.y"
+ {
+ add_ident_list(&yyval.param_list, &yystack.l_mark[-2].param_list, yystack.l_mark[0].text.text);
+ }
+break;
+case 103:
+#line 924 "grammar.y"
+ {
+ yyval.text = yystack.l_mark[0].text;
+ }
+break;
+case 104:
+#line 928 "grammar.y"
+ {
+#if OPT_LINTLIBRARY
+ if (lintLibrary()) { /* Lint doesn't grok C++ ref variables */
+ yyval.text = yystack.l_mark[0].text;
+ } else
+#endif
+ (void)sprintf(yyval.text.text, "&%s", yystack.l_mark[0].text.text);
+ yyval.text.begin = yystack.l_mark[-1].text.begin;
+ }
+break;
+case 105:
+#line 941 "grammar.y"
+ {
+ yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
+ }
+break;
+case 106:
+#line 945 "grammar.y"
+ {
+ yyval.declarator = yystack.l_mark[0].declarator;
+ (void)sprintf(buf, "%s%s", yystack.l_mark[-1].text.text, yyval.declarator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text = xstrdup(buf);
+ yyval.declarator->begin = yystack.l_mark[-1].text.begin;
+ }
+break;
+case 108:
+#line 957 "grammar.y"
+ {
+ yyval.declarator = yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "(%s)", yyval.declarator->text);
+ free(yyval.declarator->text);
+ yyval.declarator->text = xstrdup(buf);
+ yyval.declarator->begin = yystack.l_mark[-2].text.begin;
+ }
+break;
+case 109:
+#line 965 "grammar.y"
+ {
+ yyval.declarator = yystack.l_mark[-1].declarator;
+ (void)sprintf(buf, "%s%s", yyval.declarator->text, yystack.l_mark[0].text.text);
+ free(yyval.declarator->text);
+ yyval.declarator->text = xstrdup(buf);
+ }
+break;
+case 110:
+#line 972 "grammar.y"
+ {
+ yyval.declarator = new_declarator(yystack.l_mark[0].text.text, "", yystack.l_mark[0].text.begin);
+ }
+break;
+case 111:
+#line 976 "grammar.y"
+ {
+ yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-3].declarator->begin);
+ yyval.declarator->params = yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack = yystack.l_mark[-3].declarator;
+ yyval.declarator->head = (yystack.l_mark[-3].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-3].declarator->head;
+ yyval.declarator->func_def = FUNC_ANSI;
+ }
+break;
+case 112:
+#line 984 "grammar.y"
+ {
+ yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].declarator->begin);
+ yyval.declarator->func_stack = yystack.l_mark[-2].declarator;
+ yyval.declarator->head = (yystack.l_mark[-2].declarator->func_stack == NULL) ? yyval.declarator : yystack.l_mark[-2].declarator->head;
+ yyval.declarator->func_def = FUNC_ANSI;
+ }
+break;
+case 113:
+#line 991 "grammar.y"
+ {
+ Declarator *d;
+
+ d = new_declarator("", "", yystack.l_mark[-2].text.begin);
+ yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-2].text.begin);
+ yyval.declarator->params = yystack.l_mark[-1].param_list;
+ yyval.declarator->func_stack = d;
+ yyval.declarator->head = yyval.declarator;
+ yyval.declarator->func_def = FUNC_ANSI;
+ }
+break;
+case 114:
+#line 1002 "grammar.y"
+ {
+ Declarator *d;
+
+ d = new_declarator("", "", yystack.l_mark[-1].text.begin);
+ yyval.declarator = new_declarator("%s()", "", yystack.l_mark[-1].text.begin);
+ yyval.declarator->func_stack = d;
+ yyval.declarator->head = yyval.declarator;
+ yyval.declarator->func_def = FUNC_ANSI;
+ }
+break;
+#line 2579 "grammar.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/grammar.tab.h b/contrib/byacc/test/btyacc/grammar.tab.h
new file mode 100644
index 000000000000..f82e0d3f410f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/grammar.tab.h
@@ -0,0 +1,40 @@
+#ifndef _grammar__defines_h_
+#define _grammar__defines_h_
+
+#define T_IDENTIFIER 257
+#define T_TYPEDEF_NAME 258
+#define T_DEFINE_NAME 259
+#define T_AUTO 260
+#define T_EXTERN 261
+#define T_REGISTER 262
+#define T_STATIC 263
+#define T_TYPEDEF 264
+#define T_INLINE 265
+#define T_EXTENSION 266
+#define T_CHAR 267
+#define T_DOUBLE 268
+#define T_FLOAT 269
+#define T_INT 270
+#define T_VOID 271
+#define T_LONG 272
+#define T_SHORT 273
+#define T_SIGNED 274
+#define T_UNSIGNED 275
+#define T_ENUM 276
+#define T_STRUCT 277
+#define T_UNION 278
+#define T_Bool 279
+#define T_Complex 280
+#define T_Imaginary 281
+#define T_TYPE_QUALIFIER 282
+#define T_BRACKETS 283
+#define T_LBRACE 284
+#define T_MATCHRBRACE 285
+#define T_ELLIPSIS 286
+#define T_INITIALIZER 287
+#define T_STRING_LITERAL 288
+#define T_ASM 289
+#define T_ASMARG 290
+#define T_VA_DCL 291
+
+#endif /* _grammar__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/help.error b/contrib/byacc/test/btyacc/help.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/help.error
diff --git a/contrib/byacc/test/btyacc/help.output b/contrib/byacc/test/btyacc/help.output
new file mode 100644
index 000000000000..28e455543be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/help.output
@@ -0,0 +1,19 @@
+Usage: YACC [options] filename
+
+Options:
+ -b file_prefix set filename prefix (default "y.")
+ -B create a backtracking parser
+ -d write definitions (.tab.h)
+ -D enable value stack memory reclamation
+ -i write interface (y.tab.i)
+ -g write a graphical description
+ -l suppress #line directives
+ -L enable position processing, e.g., "%locations"
+ -o output_file (default ".tab.c")
+ -p symbol_prefix set symbol prefix (default "yy")
+ -P create a reentrant parser, e.g., "%pure-parser"
+ -r produce separate code and table files (y.code.c)
+ -s suppress #define's for quoted names in %token lines
+ -t add debugging support
+ -v write description (y.output)
+ -V show version information and exit
diff --git a/contrib/byacc/test/btyacc/inherit0.error b/contrib/byacc/test/btyacc/inherit0.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit0.error
diff --git a/contrib/byacc/test/btyacc/inherit0.output b/contrib/byacc/test/btyacc/inherit0.output
new file mode 100644
index 000000000000..ee5ca2e500be
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit0.output
@@ -0,0 +1,165 @@
+ 0 $accept : declaration $end
+
+ 1 declaration : class type namelist
+ 2 | type locnamelist
+
+ 3 class : GLOBAL
+ 4 | LOCAL
+
+ 5 type : REAL
+ 6 | INTEGER
+
+ 7 namelist : namelist NAME
+ 8 | NAME
+
+ 9 $$1 :
+
+ 10 $$2 :
+
+ 11 locnamelist : $$1 $$2 namelist
+
+state 0
+ $accept : . declaration $end (0)
+
+ GLOBAL shift 1
+ LOCAL shift 2
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ declaration goto 5
+ class goto 6
+ type goto 7
+
+
+state 1
+ class : GLOBAL . (3)
+
+ . reduce 3
+
+
+state 2
+ class : LOCAL . (4)
+
+ . reduce 4
+
+
+state 3
+ type : REAL . (5)
+
+ . reduce 5
+
+
+state 4
+ type : INTEGER . (6)
+
+ . reduce 6
+
+
+state 5
+ $accept : declaration . $end (0)
+
+ $end accept
+
+
+state 6
+ declaration : class . type namelist (1)
+
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ type goto 8
+
+
+state 7
+ declaration : type . locnamelist (2)
+ $$1 : . (9)
+
+ . reduce 9
+
+ locnamelist goto 9
+ $$1 goto 10
+
+
+state 8
+ declaration : class type . namelist (1)
+
+ NAME shift 11
+ . error
+
+ namelist goto 12
+
+
+state 9
+ declaration : type locnamelist . (2)
+
+ . reduce 2
+
+
+state 10
+ locnamelist : $$1 . $$2 namelist (11)
+ $$2 : . (10)
+
+ . reduce 10
+
+ $$2 goto 13
+
+
+state 11
+ namelist : NAME . (8)
+
+ . reduce 8
+
+
+state 12
+ declaration : class type namelist . (1)
+ namelist : namelist . NAME (7)
+
+ NAME shift 14
+ $end reduce 1
+
+
+state 13
+ locnamelist : $$1 $$2 . namelist (11)
+
+ NAME shift 11
+ . error
+
+ namelist goto 15
+
+
+state 14
+ namelist : namelist NAME . (7)
+
+ . reduce 7
+
+
+state 15
+ namelist : namelist . NAME (7)
+ locnamelist : $$1 $$2 namelist . (11)
+
+ NAME shift 14
+ $end reduce 11
+
+
+7 terminals, 8 nonterminals
+12 grammar rules, 16 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 GLOBAL
+ 3 258 LOCAL
+ 4 259 REAL
+ 5 260 INTEGER
+ 6 261 NAME
+ 7 262 $accept
+ 8 263 declaration
+ 9 264 class
+ 10 265 type
+ 11 266 namelist
+ 12 267 locnamelist
+ 13 268 $$1
+ 14 269 $$2
diff --git a/contrib/byacc/test/btyacc/inherit0.tab.c b/contrib/byacc/test/btyacc/inherit0.tab.c
new file mode 100644
index 000000000000..238d5ab60fbb
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit0.tab.c
@@ -0,0 +1,1321 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse inherit0_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex inherit0_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror inherit0_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar inherit0_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval inherit0_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval inherit0_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug inherit0_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs inherit0_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag inherit0_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs inherit0_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen inherit0_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred inherit0_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos inherit0_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto inherit0_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex inherit0_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex inherit0_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex inherit0_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable inherit0_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck inherit0_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname inherit0_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule inherit0_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex inherit0_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable inherit0_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "inherit0_"
+
+#define YYPURE 0
+
+#line 2 "inherit0.y"
+extern void mksymbol(int t, int c, int id);
+
+#ifdef YYBISON
+#define YYLEX_DECL() yylex(void)
+#define YYERROR_DECL() yyerror(const char *s)
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+#endif
+#line 130 "inherit0.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT inherit0_lhs[] = { -1,
+ 0, 0, 1, 1, 2, 2, 3, 3, 5, 6,
+ 4,
+};
+static const YYINT inherit0_len[] = { 2,
+ 3, 2, 1, 1, 1, 1, 2, 1, 0, 0,
+ 3,
+};
+static const YYINT inherit0_defred[] = { 0,
+ 3, 4, 5, 6, 0, 0, 9, 0, 2, 10,
+ 8, 0, 0, 7, 0,
+};
+static const YYINT inherit0_stos[] = { 0,
+ 257, 258, 259, 260, 263, 264, 265, 265, 267, 268,
+ 261, 266, 269, 261, 266,
+};
+static const YYINT inherit0_dgoto[] = { 5,
+ 6, 7, 12, 9, 10, 13,
+};
+static const YYINT inherit0_sindex[] = { -257,
+ 0, 0, 0, 0, 0, -255, 0, -254, 0, 0,
+ 0, -253, -254, 0, -253,
+};
+static const YYINT inherit0_rindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 6, 0, 0, 9,
+};
+#if YYBTYACC
+static const YYINT inherit0_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+};
+#endif
+static const YYINT inherit0_gindex[] = { 0,
+ 0, 4, -2, 0, 0, 0,
+};
+#define YYTABLESIZE 11
+static const YYINT inherit0_table[] = { 1,
+ 2, 3, 4, 3, 4, 1, 11, 14, 11, 8,
+ 15,
+};
+static const YYINT inherit0_check[] = { 257,
+ 258, 259, 260, 259, 260, 0, 261, 261, 0, 6,
+ 13,
+};
+#define YYFINAL 5
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 261
+#define YYUNDFTOKEN 270
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const inherit0_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
+"NAME","$accept","declaration","class","type","namelist","locnamelist","$$1",
+"$$2","illegal-symbol",
+};
+static const char *const inherit0_rule[] = {
+"$accept : declaration",
+"declaration : class type namelist",
+"declaration : type locnamelist",
+"class : GLOBAL",
+"class : LOCAL",
+"type : REAL",
+"type : INTEGER",
+"namelist : namelist NAME",
+"namelist : NAME",
+"$$1 :",
+"$$2 :",
+"locnamelist : $$1 $$2 namelist",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 46 "inherit0.y"
+
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+#line 386 "inherit0.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 20 "inherit0.y"
+ { yyval = yystack.l_mark[0]; }
+break;
+case 2:
+#line 22 "inherit0.y"
+ { yyval = yystack.l_mark[0]; }
+break;
+case 3:
+#line 25 "inherit0.y"
+ { yyval = 1; }
+break;
+case 4:
+#line 26 "inherit0.y"
+ { yyval = 2; }
+break;
+case 5:
+#line 29 "inherit0.y"
+ { yyval = 1; }
+break;
+case 6:
+#line 30 "inherit0.y"
+ { yyval = 2; }
+break;
+case 7:
+#line 34 "inherit0.y"
+ { mksymbol(yystack.l_mark[-2], yystack.l_mark[-3], yystack.l_mark[0]); }
+break;
+case 8:
+#line 36 "inherit0.y"
+ { mksymbol(yystack.l_mark[-1], yystack.l_mark[-2], yystack.l_mark[0]); }
+break;
+case 9:
+#line 40 "inherit0.y"
+ { yyval = 2; }
+break;
+case 10:
+#line 41 "inherit0.y"
+ { yyval = yystack.l_mark[-2]; }
+break;
+case 11:
+#line 43 "inherit0.y"
+ { yyval = yystack.l_mark[0]; }
+break;
+#line 1087 "inherit0.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/inherit0.tab.h b/contrib/byacc/test/btyacc/inherit0.tab.h
new file mode 100644
index 000000000000..50ecd392f8bd
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit0.tab.h
@@ -0,0 +1,10 @@
+#ifndef _inherit0__defines_h_
+#define _inherit0__defines_h_
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+
+#endif /* _inherit0__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/inherit1.error b/contrib/byacc/test/btyacc/inherit1.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit1.error
diff --git a/contrib/byacc/test/btyacc/inherit1.output b/contrib/byacc/test/btyacc/inherit1.output
new file mode 100644
index 000000000000..349f1657d945
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit1.output
@@ -0,0 +1,165 @@
+ 0 $accept : declaration $end
+
+ 1 declaration : class type namelist
+ 2 | type locnamelist
+
+ 3 class : GLOBAL
+ 4 | LOCAL
+
+ 5 type : REAL
+ 6 | INTEGER
+
+ 7 namelist : namelist NAME
+ 8 | NAME
+
+ 9 $$1 :
+
+ 10 $$2 :
+
+ 11 locnamelist : $$1 $$2 namelist
+
+state 0
+ $accept : . declaration $end (0)
+
+ GLOBAL shift 1
+ LOCAL shift 2
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ declaration goto 5
+ class goto 6
+ type goto 7
+
+
+state 1
+ class : GLOBAL . (3)
+
+ . reduce 3
+
+
+state 2
+ class : LOCAL . (4)
+
+ . reduce 4
+
+
+state 3
+ type : REAL . (5)
+
+ . reduce 5
+
+
+state 4
+ type : INTEGER . (6)
+
+ . reduce 6
+
+
+state 5
+ $accept : declaration . $end (0)
+
+ $end accept
+
+
+state 6
+ declaration : class . type namelist (1)
+
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ type goto 8
+
+
+state 7
+ declaration : type . locnamelist (2)
+ $$1 : . (9)
+
+ . reduce 9
+
+ locnamelist goto 9
+ $$1 goto 10
+
+
+state 8
+ declaration : class type . namelist (1)
+
+ NAME shift 11
+ . error
+
+ namelist goto 12
+
+
+state 9
+ declaration : type locnamelist . (2)
+
+ . reduce 2
+
+
+state 10
+ locnamelist : $$1 . $$2 namelist (11)
+ $$2 : . (10)
+
+ . reduce 10
+
+ $$2 goto 13
+
+
+state 11
+ namelist : NAME . (8)
+
+ . reduce 8
+
+
+state 12
+ declaration : class type namelist . (1)
+ namelist : namelist . NAME (7)
+
+ NAME shift 14
+ $end reduce 1
+
+
+state 13
+ locnamelist : $$1 $$2 . namelist (11)
+
+ NAME shift 11
+ . error
+
+ namelist goto 15
+
+
+state 14
+ namelist : namelist NAME . (7)
+
+ . reduce 7
+
+
+state 15
+ namelist : namelist . NAME (7)
+ locnamelist : $$1 $$2 namelist . (11)
+
+ NAME shift 14
+ $end reduce 11
+
+
+7 terminals, 8 nonterminals
+12 grammar rules, 16 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 GLOBAL
+ 3 258 LOCAL
+ 4 259 REAL
+ 5 260 INTEGER
+ 6 261 NAME
+ 7 262 $accept
+ 8 263 declaration
+ 9 264 namelist
+ 10 265 locnamelist
+ 11 266 class
+ 12 267 type
+ 13 268 $$1
+ 14 269 $$2
diff --git a/contrib/byacc/test/btyacc/inherit1.tab.c b/contrib/byacc/test/btyacc/inherit1.tab.c
new file mode 100644
index 000000000000..126812e229cb
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit1.tab.c
@@ -0,0 +1,1346 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse inherit1_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex inherit1_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror inherit1_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar inherit1_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval inherit1_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval inherit1_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug inherit1_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs inherit1_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag inherit1_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs inherit1_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen inherit1_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred inherit1_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos inherit1_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto inherit1_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex inherit1_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex inherit1_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex inherit1_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable inherit1_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck inherit1_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname inherit1_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule inherit1_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex inherit1_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable inherit1_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "inherit1_"
+
+#define YYPURE 0
+
+#line 2 "inherit1.y"
+#include <stdlib.h>
+
+typedef enum {cGLOBAL, cLOCAL} class;
+typedef enum {tREAL, tINTEGER} type;
+typedef char * name;
+
+struct symbol { class c; type t; name id; };
+typedef struct symbol symbol;
+
+struct namelist { symbol *s; struct namelist *next; };
+typedef struct namelist namelist;
+
+extern symbol *mksymbol(type t, class c, name id);
+
+#ifdef YYBISON
+#define YYLEX_DECL() yylex(void)
+#define YYERROR_DECL() yyerror(const char *s)
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+#endif
+#line 32 "inherit1.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 157 "inherit1.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT inherit1_lhs[] = { -1,
+ 0, 0, 3, 3, 4, 4, 1, 1, 5, 6,
+ 2,
+};
+static const YYINT inherit1_len[] = { 2,
+ 3, 2, 1, 1, 1, 1, 2, 1, 0, 0,
+ 3,
+};
+static const YYINT inherit1_defred[] = { 0,
+ 3, 4, 5, 6, 0, 0, 9, 0, 2, 10,
+ 8, 0, 0, 7, 0,
+};
+static const YYINT inherit1_stos[] = { 0,
+ 257, 258, 259, 260, 263, 266, 267, 267, 265, 268,
+ 261, 264, 269, 261, 264,
+};
+static const YYINT inherit1_dgoto[] = { 5,
+ 12, 9, 6, 7, 10, 13,
+};
+static const YYINT inherit1_sindex[] = { -257,
+ 0, 0, 0, 0, 0, -255, 0, -254, 0, 0,
+ 0, -253, -254, 0, -253,
+};
+static const YYINT inherit1_rindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 6, 0, 0, 9,
+};
+#if YYBTYACC
+static const YYINT inherit1_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0,
+};
+#endif
+static const YYINT inherit1_gindex[] = { 0,
+ -3, 0, 0, 5, 0, 0,
+};
+#define YYTABLESIZE 11
+static const YYINT inherit1_table[] = { 1,
+ 2, 3, 4, 3, 4, 1, 11, 14, 11, 15,
+ 8,
+};
+static const YYINT inherit1_check[] = { 257,
+ 258, 259, 260, 259, 260, 0, 261, 261, 0, 13,
+ 6,
+};
+#define YYFINAL 5
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 261
+#define YYUNDFTOKEN 270
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const inherit1_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
+"NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
+"$$2","illegal-symbol",
+};
+static const char *const inherit1_rule[] = {
+"$accept : declaration",
+"declaration : class type namelist",
+"declaration : type locnamelist",
+"class : GLOBAL",
+"class : LOCAL",
+"type : REAL",
+"type : INTEGER",
+"namelist : namelist NAME",
+"namelist : NAME",
+"$$1 :",
+"$$2 :",
+"locnamelist : $$1 $$2 namelist",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 74 "inherit1.y"
+
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+#line 407 "inherit1.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 44 "inherit1.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 2:
+#line 46 "inherit1.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 3:
+#line 49 "inherit1.y"
+ { yyval.cval = cGLOBAL; }
+break;
+case 4:
+#line 50 "inherit1.y"
+ { yyval.cval = cLOCAL; }
+break;
+case 5:
+#line 53 "inherit1.y"
+ { yyval.tval = tREAL; }
+break;
+case 6:
+#line 54 "inherit1.y"
+ { yyval.tval = tINTEGER; }
+break;
+case 7:
+#line 58 "inherit1.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
+ yyval.nlist->next = yystack.l_mark[-1].nlist;
+ }
+break;
+case 8:
+#line 62 "inherit1.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
+ yyval.nlist->next = NULL;
+ }
+break;
+case 9:
+#line 68 "inherit1.y"
+ { yyval.cval = cLOCAL; }
+break;
+case 10:
+#line 69 "inherit1.y"
+ { yyval.tval = yystack.l_mark[-2].tval; }
+break;
+case 11:
+#line 71 "inherit1.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+#line 1112 "inherit1.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/inherit1.tab.h b/contrib/byacc/test/btyacc/inherit1.tab.h
new file mode 100644
index 000000000000..3b8aa3d2a914
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit1.tab.h
@@ -0,0 +1,25 @@
+#ifndef _inherit1__defines_h_
+#define _inherit1__defines_h_
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE inherit1_lval;
+
+#endif /* _inherit1__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/inherit2.error b/contrib/byacc/test/btyacc/inherit2.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit2.error
diff --git a/contrib/byacc/test/btyacc/inherit2.output b/contrib/byacc/test/btyacc/inherit2.output
new file mode 100644
index 000000000000..70ffb0592f6f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit2.output
@@ -0,0 +1,199 @@
+ 0 $accept : declaration $end
+
+ 1 $$1 :
+
+ 2 $$2 :
+
+ 3 declaration : class type $$1 $$2 namelist
+
+ 4 $$3 :
+
+ 5 declaration : type $$3 locnamelist
+
+ 6 class : GLOBAL
+ 7 | LOCAL
+
+ 8 type : REAL
+ 9 | INTEGER
+
+ 10 namelist : namelist NAME
+ 11 | NAME
+
+ 12 $$4 :
+
+ 13 locnamelist : $$4 $$2 namelist
+
+state 0
+ $accept : . declaration $end (0)
+
+ GLOBAL shift 1
+ LOCAL shift 2
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ declaration goto 5
+ class goto 6
+ type goto 7
+
+
+state 1
+ class : GLOBAL . (6)
+
+ . reduce 6
+
+
+state 2
+ class : LOCAL . (7)
+
+ . reduce 7
+
+
+state 3
+ type : REAL . (8)
+
+ . reduce 8
+
+
+state 4
+ type : INTEGER . (9)
+
+ . reduce 9
+
+
+state 5
+ $accept : declaration . $end (0)
+
+ $end accept
+
+
+state 6
+ declaration : class . type $$1 $$2 namelist (3)
+
+ REAL shift 3
+ INTEGER shift 4
+ . error
+
+ type goto 8
+
+
+state 7
+ declaration : type . $$3 locnamelist (5)
+ $$3 : . (4)
+
+ . reduce 4
+
+ $$3 goto 9
+
+
+state 8
+ declaration : class type . $$1 $$2 namelist (3)
+ $$1 : . (1)
+
+ . reduce 1
+
+ $$1 goto 10
+
+
+state 9
+ declaration : type $$3 . locnamelist (5)
+ $$4 : . (12)
+
+ . reduce 12
+
+ locnamelist goto 11
+ $$4 goto 12
+
+
+state 10
+ declaration : class type $$1 . $$2 namelist (3)
+ $$2 : . (2)
+
+ . reduce 2
+
+ $$2 goto 13
+
+
+state 11
+ declaration : type $$3 locnamelist . (5)
+
+ . reduce 5
+
+
+state 12
+ locnamelist : $$4 . $$2 namelist (13)
+ $$2 : . (2)
+
+ . reduce 2
+
+ $$2 goto 14
+
+
+state 13
+ declaration : class type $$1 $$2 . namelist (3)
+
+ NAME shift 15
+ . error
+
+ namelist goto 16
+
+
+state 14
+ locnamelist : $$4 $$2 . namelist (13)
+
+ NAME shift 15
+ . error
+
+ namelist goto 17
+
+
+state 15
+ namelist : NAME . (11)
+
+ . reduce 11
+
+
+state 16
+ declaration : class type $$1 $$2 namelist . (3)
+ namelist : namelist . NAME (10)
+
+ NAME shift 18
+ $end reduce 3
+
+
+state 17
+ namelist : namelist . NAME (10)
+ locnamelist : $$4 $$2 namelist . (13)
+
+ NAME shift 18
+ $end reduce 13
+
+
+state 18
+ namelist : namelist NAME . (10)
+
+ . reduce 10
+
+
+7 terminals, 10 nonterminals
+14 grammar rules, 19 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 GLOBAL
+ 3 258 LOCAL
+ 4 259 REAL
+ 5 260 INTEGER
+ 6 261 NAME
+ 7 262 $accept
+ 8 263 declaration
+ 9 264 namelist
+ 10 265 locnamelist
+ 11 266 class
+ 12 267 type
+ 13 268 $$1
+ 14 269 $$2
+ 15 270 $$3
+ 16 271 $$4
diff --git a/contrib/byacc/test/btyacc/inherit2.tab.c b/contrib/byacc/test/btyacc/inherit2.tab.c
new file mode 100644
index 000000000000..d32cbe760ed6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit2.tab.c
@@ -0,0 +1,1409 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse inherit2_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex inherit2_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror inherit2_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar inherit2_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval inherit2_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval inherit2_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug inherit2_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs inherit2_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag inherit2_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs inherit2_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen inherit2_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred inherit2_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos inherit2_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto inherit2_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex inherit2_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex inherit2_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex inherit2_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable inherit2_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck inherit2_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname inherit2_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule inherit2_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex inherit2_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable inherit2_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "inherit2_"
+
+#define YYPURE 0
+
+#line 2 "inherit2.y"
+#include <stdlib.h>
+
+typedef enum {cGLOBAL, cLOCAL} class;
+typedef enum {tREAL, tINTEGER} type;
+typedef char * name;
+
+struct symbol { class c; type t; name id; };
+typedef struct symbol symbol;
+
+struct namelist { symbol *s; struct namelist *next; };
+typedef struct namelist namelist;
+
+extern symbol *mksymbol(type t, class c, name id);
+
+#ifdef YYBISON
+#define YYLEX_DECL() yylex(void)
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#line 39 "inherit2.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 155 "inherit2.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+#ifndef YYDESTRUCT_DECL
+#define YYDESTRUCT_DECL() yydestruct(const char *msg, int psymb, YYSTYPE *val)
+#endif
+#ifndef YYDESTRUCT_CALL
+#define YYDESTRUCT_CALL(msg, psymb, val) yydestruct(msg, psymb, val)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT inherit2_lhs[] = { -1,
+ 5, 6, 0, 7, 0, 3, 3, 4, 4, 1,
+ 1, 8, 2,
+};
+static const YYINT inherit2_len[] = { 2,
+ 0, 0, 5, 0, 3, 1, 1, 1, 1, 2,
+ 1, 0, 3,
+};
+static const YYINT inherit2_defred[] = { 0,
+ 6, 7, 8, 9, 0, 0, 4, 1, 12, 2,
+ 5, 2, 0, 0, 11, 0, 0, 10,
+};
+static const YYINT inherit2_stos[] = { 0,
+ 257, 258, 259, 260, 263, 266, 267, 267, 270, 268,
+ 265, 271, 269, 269, 261, 264, 264, 261,
+};
+static const YYINT inherit2_dgoto[] = { 5,
+ 16, 11, 6, 7, 10, 13, 9, 12,
+};
+static const YYINT inherit2_sindex[] = { -257,
+ 0, 0, 0, 0, 0, -255, 0, 0, 0, 0,
+ 0, 0, -254, -254, 0, -253, -253, 0,
+};
+static const YYINT inherit2_rindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 6, 9, 0,
+};
+#if YYBTYACC
+static const YYINT inherit2_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0,
+};
+#endif
+static const YYINT inherit2_gindex[] = { 0,
+ -4, 0, 0, 5, 0, 1, 0, 0,
+};
+#define YYTABLESIZE 13
+static const YYINT inherit2_table[] = { 1,
+ 2, 3, 4, 3, 4, 3, 15, 18, 13, 17,
+ 8, 0, 14,
+};
+static const YYINT inherit2_check[] = { 257,
+ 258, 259, 260, 259, 260, 0, 261, 261, 0, 14,
+ 6, -1, 12,
+};
+#define YYFINAL 5
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 261
+#define YYUNDFTOKEN 272
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const inherit2_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","GLOBAL","LOCAL","REAL","INTEGER",
+"NAME","$accept","declaration","namelist","locnamelist","class","type","$$1",
+"$$2","$$3","$$4","illegal-symbol",
+};
+static const char *const inherit2_rule[] = {
+"$accept : declaration",
+"$$1 :",
+"$$2 :",
+"declaration : class type $$1 $$2 namelist",
+"$$3 :",
+"declaration : type $$3 locnamelist",
+"class : GLOBAL",
+"class : LOCAL",
+"type : REAL",
+"type : INTEGER",
+"namelist : namelist NAME",
+"namelist : NAME",
+"$$4 :",
+"locnamelist : $$4 $$2 namelist",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 78 "inherit2.y"
+
+extern int YYLEX_DECL();
+extern void YYERROR_DECL();
+#line 414 "inherit2.tab.c"
+
+/* Release memory associated with symbol. */
+#if ! defined YYDESTRUCT_IS_DECLARED
+static void
+YYDESTRUCT_DECL()
+{
+ switch (psymb)
+ {
+ case 263:
+#line 30 "inherit2.y"
+ {
+ namelist *p = (*val).nlist;
+ while (p != NULL)
+ { namelist *pp = p;
+ p = p->next;
+ free(pp->s); free(pp);
+ }
+ }
+ break;
+#line 434 "inherit2.tab.c"
+ case 264:
+#line 30 "inherit2.y"
+ {
+ namelist *p = (*val).nlist;
+ while (p != NULL)
+ { namelist *pp = p;
+ p = p->next;
+ free(pp->s); free(pp);
+ }
+ }
+ break;
+#line 446 "inherit2.tab.c"
+ case 265:
+#line 30 "inherit2.y"
+ {
+ namelist *p = (*val).nlist;
+ while (p != NULL)
+ { namelist *pp = p;
+ p = p->next;
+ free(pp->s); free(pp);
+ }
+ }
+ break;
+#line 458 "inherit2.tab.c"
+ }
+}
+#define YYDESTRUCT_IS_DECLARED 1
+#endif
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 1:
+#line 50 "inherit2.y"
+yyval.cval = yystack.l_mark[-1].cval;
+break;
+case 2:
+#line 50 "inherit2.y"
+yyval.tval = yystack.l_mark[-1].tval;
+break;
+case 3:
+#line 51 "inherit2.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 4:
+#line 52 "inherit2.y"
+yyval.tval = yystack.l_mark[0].tval;
+break;
+case 5:
+#line 53 "inherit2.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+case 6:
+#line 56 "inherit2.y"
+ { yyval.cval = cGLOBAL; }
+break;
+case 7:
+#line 57 "inherit2.y"
+ { yyval.cval = cLOCAL; }
+break;
+case 8:
+#line 60 "inherit2.y"
+ { yyval.tval = tREAL; }
+break;
+case 9:
+#line 61 "inherit2.y"
+ { yyval.tval = tINTEGER; }
+break;
+case 10:
+#line 65 "inherit2.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-2].tval, yystack.l_mark[-3].cval, yystack.l_mark[0].id);
+ yyval.nlist->next = yystack.l_mark[-1].nlist;
+ }
+break;
+case 11:
+#line 69 "inherit2.y"
+ { yyval.nlist->s = mksymbol(yystack.l_mark[-1].tval, yystack.l_mark[-2].cval, yystack.l_mark[0].id);
+ yyval.nlist->next = NULL;
+ }
+break;
+case 12:
+#line 74 "inherit2.y"
+yyval.cval = cLOCAL;
+break;
+case 13:
+#line 75 "inherit2.y"
+ { yyval.nlist = yystack.l_mark[0].nlist; }
+break;
+#line 1175 "inherit2.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/inherit2.tab.h b/contrib/byacc/test/btyacc/inherit2.tab.h
new file mode 100644
index 000000000000..efaf4555d6dd
--- /dev/null
+++ b/contrib/byacc/test/btyacc/inherit2.tab.h
@@ -0,0 +1,25 @@
+#ifndef _inherit2__defines_h_
+#define _inherit2__defines_h_
+
+#define GLOBAL 257
+#define LOCAL 258
+#define REAL 259
+#define INTEGER 260
+#define NAME 261
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ class cval;
+ type tval;
+ namelist * nlist;
+ name id;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE inherit2_lval;
+
+#endif /* _inherit2__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/no_b_opt.error b/contrib/byacc/test/btyacc/no_b_opt.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_b_opt.error
diff --git a/contrib/byacc/test/btyacc/no_b_opt.output b/contrib/byacc/test/btyacc/no_b_opt.output
new file mode 100644
index 000000000000..28e455543be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_b_opt.output
@@ -0,0 +1,19 @@
+Usage: YACC [options] filename
+
+Options:
+ -b file_prefix set filename prefix (default "y.")
+ -B create a backtracking parser
+ -d write definitions (.tab.h)
+ -D enable value stack memory reclamation
+ -i write interface (y.tab.i)
+ -g write a graphical description
+ -l suppress #line directives
+ -L enable position processing, e.g., "%locations"
+ -o output_file (default ".tab.c")
+ -p symbol_prefix set symbol prefix (default "yy")
+ -P create a reentrant parser, e.g., "%pure-parser"
+ -r produce separate code and table files (y.code.c)
+ -s suppress #define's for quoted names in %token lines
+ -t add debugging support
+ -v write description (y.output)
+ -V show version information and exit
diff --git a/contrib/byacc/test/btyacc/no_b_opt1.error b/contrib/byacc/test/btyacc/no_b_opt1.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_b_opt1.error
diff --git a/contrib/byacc/test/btyacc/no_b_opt1.output b/contrib/byacc/test/btyacc/no_b_opt1.output
new file mode 100644
index 000000000000..87286c2661e6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_b_opt1.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.c"
diff --git a/contrib/byacc/test/btyacc/no_code_c.error b/contrib/byacc/test/btyacc/no_code_c.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_code_c.error
diff --git a/contrib/byacc/test/btyacc/no_code_c.output b/contrib/byacc/test/btyacc/no_code_c.output
new file mode 100644
index 000000000000..87286c2661e6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_code_c.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.c"
diff --git a/contrib/byacc/test/btyacc/no_defines.error b/contrib/byacc/test/btyacc/no_defines.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_defines.error
diff --git a/contrib/byacc/test/btyacc/no_defines.output b/contrib/byacc/test/btyacc/no_defines.output
new file mode 100644
index 000000000000..773985d66f33
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_defines.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.h"
diff --git a/contrib/byacc/test/btyacc/no_graph.error b/contrib/byacc/test/btyacc/no_graph.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_graph.error
diff --git a/contrib/byacc/test/btyacc/no_graph.output b/contrib/byacc/test/btyacc/no_graph.output
new file mode 100644
index 000000000000..d5575f400421
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_graph.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.dot"
diff --git a/contrib/byacc/test/btyacc/no_include.error b/contrib/byacc/test/btyacc/no_include.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_include.error
diff --git a/contrib/byacc/test/btyacc/no_include.output b/contrib/byacc/test/btyacc/no_include.output
new file mode 100644
index 000000000000..3ece4a454e39
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_include.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.i"
diff --git a/contrib/byacc/test/btyacc/no_opts.error b/contrib/byacc/test/btyacc/no_opts.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_opts.error
diff --git a/contrib/byacc/test/btyacc/no_opts.output b/contrib/byacc/test/btyacc/no_opts.output
new file mode 100644
index 000000000000..ad3131a69ab6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_opts.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.y"
diff --git a/contrib/byacc/test/btyacc/no_output.error b/contrib/byacc/test/btyacc/no_output.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_output.error
diff --git a/contrib/byacc/test/btyacc/no_output.output b/contrib/byacc/test/btyacc/no_output.output
new file mode 100644
index 000000000000..a2f142a9d531
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_output.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.output"
diff --git a/contrib/byacc/test/btyacc/no_output1.error b/contrib/byacc/test/btyacc/no_output1.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_output1.error
diff --git a/contrib/byacc/test/btyacc/no_output1.output b/contrib/byacc/test/btyacc/no_output1.output
new file mode 100644
index 000000000000..a2f142a9d531
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_output1.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.output"
diff --git a/contrib/byacc/test/btyacc/no_output2.error b/contrib/byacc/test/btyacc/no_output2.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_output2.error
diff --git a/contrib/byacc/test/btyacc/no_output2.output b/contrib/byacc/test/btyacc/no_output2.output
new file mode 100644
index 000000000000..28e455543be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_output2.output
@@ -0,0 +1,19 @@
+Usage: YACC [options] filename
+
+Options:
+ -b file_prefix set filename prefix (default "y.")
+ -B create a backtracking parser
+ -d write definitions (.tab.h)
+ -D enable value stack memory reclamation
+ -i write interface (y.tab.i)
+ -g write a graphical description
+ -l suppress #line directives
+ -L enable position processing, e.g., "%locations"
+ -o output_file (default ".tab.c")
+ -p symbol_prefix set symbol prefix (default "yy")
+ -P create a reentrant parser, e.g., "%pure-parser"
+ -r produce separate code and table files (y.code.c)
+ -s suppress #define's for quoted names in %token lines
+ -t add debugging support
+ -v write description (y.output)
+ -V show version information and exit
diff --git a/contrib/byacc/test/btyacc/no_p_opt.error b/contrib/byacc/test/btyacc/no_p_opt.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_p_opt.error
diff --git a/contrib/byacc/test/btyacc/no_p_opt.output b/contrib/byacc/test/btyacc/no_p_opt.output
new file mode 100644
index 000000000000..28e455543be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_p_opt.output
@@ -0,0 +1,19 @@
+Usage: YACC [options] filename
+
+Options:
+ -b file_prefix set filename prefix (default "y.")
+ -B create a backtracking parser
+ -d write definitions (.tab.h)
+ -D enable value stack memory reclamation
+ -i write interface (y.tab.i)
+ -g write a graphical description
+ -l suppress #line directives
+ -L enable position processing, e.g., "%locations"
+ -o output_file (default ".tab.c")
+ -p symbol_prefix set symbol prefix (default "yy")
+ -P create a reentrant parser, e.g., "%pure-parser"
+ -r produce separate code and table files (y.code.c)
+ -s suppress #define's for quoted names in %token lines
+ -t add debugging support
+ -v write description (y.output)
+ -V show version information and exit
diff --git a/contrib/byacc/test/btyacc/no_p_opt1.error b/contrib/byacc/test/btyacc/no_p_opt1.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_p_opt1.error
diff --git a/contrib/byacc/test/btyacc/no_p_opt1.output b/contrib/byacc/test/btyacc/no_p_opt1.output
new file mode 100644
index 000000000000..87286c2661e6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_p_opt1.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.c"
diff --git a/contrib/byacc/test/btyacc/no_verbose.error b/contrib/byacc/test/btyacc/no_verbose.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_verbose.error
diff --git a/contrib/byacc/test/btyacc/no_verbose.output b/contrib/byacc/test/btyacc/no_verbose.output
new file mode 100644
index 000000000000..a2f142a9d531
--- /dev/null
+++ b/contrib/byacc/test/btyacc/no_verbose.output
@@ -0,0 +1 @@
+YACC: f - cannot open "nosuchfile.output"
diff --git a/contrib/byacc/test/btyacc/nostdin.error b/contrib/byacc/test/btyacc/nostdin.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/nostdin.error
diff --git a/contrib/byacc/test/btyacc/nostdin.output b/contrib/byacc/test/btyacc/nostdin.output
new file mode 100644
index 000000000000..28e455543be0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/nostdin.output
@@ -0,0 +1,19 @@
+Usage: YACC [options] filename
+
+Options:
+ -b file_prefix set filename prefix (default "y.")
+ -B create a backtracking parser
+ -d write definitions (.tab.h)
+ -D enable value stack memory reclamation
+ -i write interface (y.tab.i)
+ -g write a graphical description
+ -l suppress #line directives
+ -L enable position processing, e.g., "%locations"
+ -o output_file (default ".tab.c")
+ -p symbol_prefix set symbol prefix (default "yy")
+ -P create a reentrant parser, e.g., "%pure-parser"
+ -r produce separate code and table files (y.code.c)
+ -s suppress #define's for quoted names in %token lines
+ -t add debugging support
+ -v write description (y.output)
+ -V show version information and exit
diff --git a/contrib/byacc/test/btyacc/ok_syntax1.error b/contrib/byacc/test/btyacc/ok_syntax1.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/ok_syntax1.error
diff --git a/contrib/byacc/test/btyacc/ok_syntax1.output b/contrib/byacc/test/btyacc/ok_syntax1.output
new file mode 100644
index 000000000000..61935519b0c4
--- /dev/null
+++ b/contrib/byacc/test/btyacc/ok_syntax1.output
@@ -0,0 +1,511 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr '+' expr
+ 8 | expr '-' expr
+ 9 | expr '*' expr
+ 10 | expr '/' expr
+ 11 | expr '%' expr
+ 12 | expr '&' expr
+ 13 | expr '|' expr
+ 14 | '-' expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ DIGIT shift 3
+ LETTER shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 4
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 11
+ '\n' reduce 15
+ '|' reduce 15
+ '&' reduce 15
+ '+' reduce 15
+ '-' reduce 15
+ '*' reduce 15
+ '/' reduce 15
+ '%' reduce 15
+
+
+state 5
+ expr : '-' . expr (14)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 13
+ number goto 9
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ '\n' reduce 16
+ '|' reduce 16
+ '&' reduce 16
+ '+' reduce 16
+ '-' reduce 16
+ '*' reduce 16
+ '/' reduce 16
+ '%' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ stat : LETTER '=' . expr (5)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 12
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+state 13
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : '-' expr . (14)
+
+ . reduce 14
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr '|' . expr (13)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr '&' . expr (12)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr '+' . expr (7)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr '-' . expr (8)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr '*' . expr (9)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr '/' . expr (10)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '%' . expr (11)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+state 26
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 13
+ '|' reduce 13
+ ')' reduce 13
+
+
+state 27
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr '&' expr . (12)
+ expr : expr . '|' expr (13)
+
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 12
+ '|' reduce 12
+ '&' reduce 12
+ ')' reduce 12
+
+
+state 28
+ expr : expr . '+' expr (7)
+ expr : expr '+' expr . (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 7
+ '|' reduce 7
+ '&' reduce 7
+ '+' reduce 7
+ '-' reduce 7
+ ')' reduce 7
+
+
+state 29
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr '-' expr . (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 8
+ '|' reduce 8
+ '&' reduce 8
+ '+' reduce 8
+ '-' reduce 8
+ ')' reduce 8
+
+
+state 30
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr '*' expr . (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 9
+
+
+state 31
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr '/' expr . (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 10
+
+
+state 32
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr '%' expr . (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 11
+
+
+42 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DIGIT
+ 3 258 LETTER
+ 4 259 OCT1
+ 5 127 '\177'
+ 6 260 HEX1
+ 7 255 '\377'
+ 8 261 HEX2
+ 9 262 HEX3
+ 10 263 STR1
+ 11 264 "\177\177\\\n"
+ 12 265 STR2
+ 13 266 BELL
+ 14 7 '\a'
+ 15 267 BS
+ 16 8 '\b'
+ 17 268 NL
+ 18 10 '\n'
+ 19 269 LF
+ 20 12 '\f'
+ 21 270 CR
+ 22 13 '\r'
+ 23 271 TAB
+ 24 9 '\t'
+ 25 272 VT
+ 26 11 '\v'
+ 27 64 '@'
+ 28 126 '~'
+ 29 94 '^'
+ 30 35 '#'
+ 31 124 '|'
+ 32 38 '&'
+ 33 43 '+'
+ 34 45 '-'
+ 35 42 '*'
+ 36 47 '/'
+ 37 37 '%'
+ 38 273 UMINUS
+ 39 61 '='
+ 40 40 '('
+ 41 41 ')'
+ 42 274 $accept
+ 43 275 list
+ 44 276 stat
+ 45 277 expr
+ 46 278 number
diff --git a/contrib/byacc/test/btyacc/ok_syntax1.tab.c b/contrib/byacc/test/btyacc/ok_syntax1.tab.c
new file mode 100644
index 000000000000..37e08284b78c
--- /dev/null
+++ b/contrib/byacc/test/btyacc/ok_syntax1.tab.c
@@ -0,0 +1,1472 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse ok_syntax1_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex ok_syntax1_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror ok_syntax1_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar ok_syntax1_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval ok_syntax1_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval ok_syntax1_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug ok_syntax1_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs ok_syntax1_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag ok_syntax1_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs ok_syntax1_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen ok_syntax1_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred ok_syntax1_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos ok_syntax1_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto ok_syntax1_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex ok_syntax1_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex ok_syntax1_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex ok_syntax1_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable ok_syntax1_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck ok_syntax1_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname ok_syntax1_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule ok_syntax1_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex ok_syntax1_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable ok_syntax1_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "ok_syntax1_"
+
+#define YYPURE 1
+
+#line 9 "ok_syntax1.y"
+# include <stdio.h>
+# include <ctype.h>
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM base
+#define YYLEX_DECL() yylex(YYSTYPE *yylval, int *YYLEX_PARAM)
+#define YYERROR_DECL() yyerror(int regs[26], int *base, const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 43 "ok_syntax1.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ char * cval;
+ int ival;
+ double dval;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 148 "ok_syntax1.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(int regs[26], int * base)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
+# define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, int * base)
+# define YYLEX yylex(&yylval, base)
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(int regs[26], int * base, const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(regs, base, msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define OCT1 259
+#define HEX1 260
+#define HEX2 261
+#define HEX3 262
+#define STR1 263
+#define STR2 265
+#define BELL 266
+#define BS 267
+#define NL 268
+#define LF 269
+#define CR 270
+#define TAB 271
+#define VT 272
+#define UMINUS 273
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT ok_syntax1_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT ok_syntax1_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT ok_syntax1_defred[] = { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const YYINT ok_syntax1_stos[] = { 0,
+ 275, 256, 257, 258, 45, 40, 276, 277, 278, 10,
+ 61, 258, 277, 277, 10, 124, 38, 43, 45, 42,
+ 47, 37, 257, 277, 41, 277, 277, 277, 277, 277,
+ 277, 277,
+};
+static const YYINT ok_syntax1_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT ok_syntax1_sindex[] = { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const YYINT ok_syntax1_rindex[] = { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT ok_syntax1_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT ok_syntax1_gindex[] = { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const YYINT ok_syntax1_table[] = { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const YYINT ok_syntax1_check[] = { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 273
+#define YYUNDFTOKEN 279
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const ok_syntax1_name[] = {
+
+"$end",0,0,0,0,0,0,"'\\a'","'\\b'","'\\t'","'\\n'","'\\v'","'\\f'","'\\r'",0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'#'",0,"'%'","'&'",0,"'('","')'","'*'",
+"'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,0,"'='",0,0,"'@'",0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'^'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,"'~'","'\\177'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'\\377'",
+"error","DIGIT","LETTER","OCT1","HEX1","HEX2","HEX3","STR1",
+"\"\\177\\177\\\\\\n\"","STR2","BELL","BS","NL","LF","CR","TAB","VT","UMINUS",
+"$accept","list","stat","expr","number","illegal-symbol",
+};
+static const char *const ok_syntax1_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+#line 104 "ok_syntax1.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ int regs[26];
+ int base = 10;
+
+ while(!feof(stdin)) {
+ yyparse(regs, &base);
+ }
+ return 0;
+}
+
+#define UNUSED(x) ((void)(x))
+
+static void
+YYERROR_DECL()
+{
+ UNUSED(regs); /* %parse-param regs is not actually used here */
+ UNUSED(base); /* %parse-param base is not actually used here */
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval->ival = (c - 'a');
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval->ival = (c - '0') % (*base);
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 471 "ok_syntax1.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yyerrflag;
+ int yychar;
+ YYSTYPE yyval;
+ YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyloc; /* position returned by actions */
+ YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+ /* variables for the parser stack */
+ YYSTACKDATA yystack;
+#if YYBTYACC
+
+ /* Current parser state */
+ static YYParseState *yyps = 0;
+
+ /* yypath != NULL: do the full parse, starting at *yypath parser state. */
+ static YYParseState *yypath = 0;
+
+ /* Base of the lexical value queue */
+ static YYSTYPE *yylvals = 0;
+
+ /* Current position at lexical value queue */
+ static YYSTYPE *yylvp = 0;
+
+ /* End position of lexical value queue */
+ static YYSTYPE *yylve = 0;
+
+ /* The last allocated position at the lexical value queue */
+ static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* Base of the lexical position queue */
+ static YYLTYPE *yylpsns = 0;
+
+ /* Current position at lexical position queue */
+ static YYLTYPE *yylpp = 0;
+
+ /* End position of lexical position queue */
+ static YYLTYPE *yylpe = 0;
+
+ /* The last allocated position at the lexical position queue */
+ static YYLTYPE *yylplim = 0;
+#endif
+
+ /* Current position at lexical token queue */
+ static short *yylexp = 0;
+
+ static short *yylexemes = 0;
+#endif /* YYBTYACC */
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 66 "ok_syntax1.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 70 "ok_syntax1.y"
+ { printf("%d\n",yystack.l_mark[0].ival);}
+break;
+case 5:
+#line 72 "ok_syntax1.y"
+ { regs[yystack.l_mark[-2].ival] = yystack.l_mark[0].ival; }
+break;
+case 6:
+#line 76 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-1].ival; }
+break;
+case 7:
+#line 78 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-2].ival + yystack.l_mark[0].ival; }
+break;
+case 8:
+#line 80 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-2].ival - yystack.l_mark[0].ival; }
+break;
+case 9:
+#line 82 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-2].ival * yystack.l_mark[0].ival; }
+break;
+case 10:
+#line 84 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-2].ival / yystack.l_mark[0].ival; }
+break;
+case 11:
+#line 86 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-2].ival % yystack.l_mark[0].ival; }
+break;
+case 12:
+#line 88 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-2].ival & yystack.l_mark[0].ival; }
+break;
+case 13:
+#line 90 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[-2].ival | yystack.l_mark[0].ival; }
+break;
+case 14:
+#line 92 "ok_syntax1.y"
+ { yyval.ival = - yystack.l_mark[0].ival; }
+break;
+case 15:
+#line 94 "ok_syntax1.y"
+ { yyval.ival = regs[yystack.l_mark[0].ival]; }
+break;
+case 17:
+#line 99 "ok_syntax1.y"
+ { yyval.ival = yystack.l_mark[0].ival; (*base) = (yystack.l_mark[0].ival==0) ? 8 : 10; }
+break;
+case 18:
+#line 101 "ok_syntax1.y"
+ { yyval.ival = (*base) * yystack.l_mark[-1].ival + yystack.l_mark[0].ival; }
+break;
+#line 1238 "ok_syntax1.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/ok_syntax1.tab.h b/contrib/byacc/test/btyacc/ok_syntax1.tab.h
new file mode 100644
index 000000000000..75e9a96c9bf9
--- /dev/null
+++ b/contrib/byacc/test/btyacc/ok_syntax1.tab.h
@@ -0,0 +1,35 @@
+#ifndef _ok_syntax1__defines_h_
+#define _ok_syntax1__defines_h_
+
+#define DIGIT 257
+#define LETTER 258
+#define OCT1 259
+#define HEX1 260
+#define HEX2 261
+#define HEX3 262
+#define STR1 263
+#define STR2 265
+#define BELL 266
+#define BS 267
+#define NL 268
+#define LF 269
+#define CR 270
+#define TAB 271
+#define VT 272
+#define UMINUS 273
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ char * cval;
+ int ival;
+ double dval;
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE ok_syntax1_lval;
+
+#endif /* _ok_syntax1__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/pure_calc.error b/contrib/byacc/test/btyacc/pure_calc.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_calc.error
diff --git a/contrib/byacc/test/btyacc/pure_calc.output b/contrib/byacc/test/btyacc/pure_calc.output
new file mode 100644
index 000000000000..c689eec0535a
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_calc.output
@@ -0,0 +1,485 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr '+' expr
+ 8 | expr '-' expr
+ 9 | expr '*' expr
+ 10 | expr '/' expr
+ 11 | expr '%' expr
+ 12 | expr '&' expr
+ 13 | expr '|' expr
+ 14 | '-' expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ DIGIT shift 3
+ LETTER shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 4
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 11
+ '|' reduce 15
+ '&' reduce 15
+ '+' reduce 15
+ '-' reduce 15
+ '*' reduce 15
+ '/' reduce 15
+ '%' reduce 15
+ '\n' reduce 15
+
+
+state 5
+ expr : '-' . expr (14)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 13
+ number goto 9
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ '|' reduce 16
+ '&' reduce 16
+ '+' reduce 16
+ '-' reduce 16
+ '*' reduce 16
+ '/' reduce 16
+ '%' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ stat : LETTER '=' . expr (5)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 12
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+state 13
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : '-' expr . (14)
+
+ . reduce 14
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr '|' . expr (13)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr '&' . expr (12)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr '+' . expr (7)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr '-' . expr (8)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr '*' . expr (9)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr '/' . expr (10)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '%' . expr (11)
+
+ DIGIT shift 3
+ LETTER shift 12
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '|' shift 16
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+state 26
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ '&' shift 17
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+state 27
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr '&' expr . (12)
+ expr : expr . '|' expr (13)
+
+ '+' shift 18
+ '-' shift 19
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 12
+ '&' reduce 12
+ '\n' reduce 12
+ ')' reduce 12
+
+
+state 28
+ expr : expr . '+' expr (7)
+ expr : expr '+' expr . (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 7
+ '&' reduce 7
+ '+' reduce 7
+ '-' reduce 7
+ '\n' reduce 7
+ ')' reduce 7
+
+
+state 29
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr '-' expr . (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ '*' shift 20
+ '/' shift 21
+ '%' shift 22
+ '|' reduce 8
+ '&' reduce 8
+ '+' reduce 8
+ '-' reduce 8
+ '\n' reduce 8
+ ')' reduce 8
+
+
+state 30
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr '*' expr . (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 9
+
+
+state 31
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr '/' expr . (10)
+ expr : expr . '%' expr (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 10
+
+
+state 32
+ expr : expr . '+' expr (7)
+ expr : expr . '-' expr (8)
+ expr : expr . '*' expr (9)
+ expr : expr . '/' expr (10)
+ expr : expr . '%' expr (11)
+ expr : expr '%' expr . (11)
+ expr : expr . '&' expr (12)
+ expr : expr . '|' expr (13)
+
+ . reduce 11
+
+
+16 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DIGIT
+ 3 258 LETTER
+ 4 124 '|'
+ 5 38 '&'
+ 6 43 '+'
+ 7 45 '-'
+ 8 42 '*'
+ 9 47 '/'
+ 10 37 '%'
+ 11 259 UMINUS
+ 12 10 '\n'
+ 13 61 '='
+ 14 40 '('
+ 15 41 ')'
+ 16 260 $accept
+ 17 261 list
+ 18 262 stat
+ 19 263 expr
+ 20 264 number
diff --git a/contrib/byacc/test/btyacc/pure_calc.tab.c b/contrib/byacc/test/btyacc/pure_calc.tab.c
new file mode 100644
index 000000000000..28de5d6ac983
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_calc.tab.c
@@ -0,0 +1,1445 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse calc_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex calc_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror calc_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar calc_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval calc_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval calc_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug calc_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs calc_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag calc_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs calc_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen calc_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred calc_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos calc_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto calc_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex calc_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex calc_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex calc_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable calc_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck calc_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname calc_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule calc_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex calc_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable calc_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "calc_"
+
+#define YYPURE 1
+
+#line 2 "pure_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 137 "pure_calc.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
+# define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval)
+# define YYLEX yylex(&yylval)
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT calc_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT calc_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT calc_defred[] = { 1,
+ 0, 0, 17, 0, 0, 0, 0, 0, 0, 3,
+ 0, 15, 14, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 9,
+ 10, 11,
+};
+static const YYINT calc_stos[] = { 0,
+ 261, 256, 257, 258, 45, 40, 262, 263, 264, 10,
+ 61, 258, 263, 263, 10, 124, 38, 43, 45, 42,
+ 47, 37, 257, 263, 41, 263, 263, 263, 263, 263,
+ 263, 263,
+};
+static const YYINT calc_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT calc_sindex[] = { 0,
+ -40, -7, 0, -55, -38, -38, 1, -29, -247, 0,
+ -38, 0, 0, 22, 0, -38, -38, -38, -38, -38,
+ -38, -38, 0, -29, 0, 51, 60, -20, -20, 0,
+ 0, 0,
+};
+static const YYINT calc_rindex[] = { 0,
+ 0, 0, 0, 2, 0, 0, 0, 9, -9, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 10, 0, -6, 14, 5, 13, 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT calc_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT calc_gindex[] = { 0,
+ 0, 65, 0,
+};
+#define YYTABLESIZE 220
+static const YYINT calc_table[] = { 6,
+ 16, 6, 10, 13, 5, 11, 5, 22, 17, 23,
+ 15, 15, 20, 18, 7, 19, 22, 21, 4, 5,
+ 0, 20, 8, 12, 0, 0, 21, 16, 16, 0,
+ 0, 16, 16, 16, 13, 16, 0, 16, 15, 15,
+ 0, 0, 7, 15, 15, 7, 15, 7, 15, 7,
+ 8, 12, 0, 8, 12, 8, 0, 8, 22, 17,
+ 0, 0, 25, 20, 18, 0, 19, 0, 21, 13,
+ 14, 0, 0, 0, 0, 24, 0, 0, 0, 0,
+ 26, 27, 28, 29, 30, 31, 32, 22, 17, 0,
+ 0, 0, 20, 18, 16, 19, 22, 21, 0, 0,
+ 0, 20, 18, 0, 19, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 16, 0, 0, 13, 0, 0,
+ 0, 0, 0, 0, 0, 15, 0, 0, 7, 0,
+ 0, 0, 0, 0, 0, 0, 8, 12, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 2, 3, 4, 3, 12,
+};
+static const YYINT calc_check[] = { 40,
+ 10, 40, 10, 10, 45, 61, 45, 37, 38, 257,
+ 10, 10, 42, 43, 10, 45, 37, 47, 10, 10,
+ -1, 42, 10, 10, -1, -1, 47, 37, 38, -1,
+ -1, 41, 42, 43, 41, 45, -1, 47, 37, 38,
+ -1, -1, 38, 42, 43, 41, 45, 43, 47, 45,
+ 38, 38, -1, 41, 41, 43, -1, 45, 37, 38,
+ -1, -1, 41, 42, 43, -1, 45, -1, 47, 5,
+ 6, -1, -1, -1, -1, 11, -1, -1, -1, -1,
+ 16, 17, 18, 19, 20, 21, 22, 37, 38, -1,
+ -1, -1, 42, 43, 124, 45, 37, 47, -1, -1,
+ -1, 42, 43, -1, 45, -1, 47, -1, -1, -1,
+ -1, -1, -1, -1, 124, -1, -1, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, 124, -1,
+ -1, -1, -1, -1, -1, -1, 124, 124, -1, -1,
+ -1, -1, -1, -1, -1, 124, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 257, 258,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 259
+#define YYUNDFTOKEN 265
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const calc_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","DIGIT","LETTER","UMINUS","$accept","list","stat","expr","number",
+"illegal-symbol",
+};
+static const char *const calc_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr '+' expr",
+"expr : expr '-' expr",
+"expr : expr '*' expr",
+"expr : expr '/' expr",
+"expr : expr '%' expr",
+"expr : expr '&' expr",
+"expr : expr '|' expr",
+"expr : '-' expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+#line 72 "pure_calc.y"
+ /* start of programs */
+
+#ifdef YYBYACC
+static int YYLEX_DECL();
+#endif
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+YYERROR_DECL()
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+YYLEX_DECL()
+{
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ *yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ *yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 444 "pure_calc.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yyerrflag;
+ int yychar;
+ YYSTYPE yyval;
+ YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyloc; /* position returned by actions */
+ YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+ /* variables for the parser stack */
+ YYSTACKDATA yystack;
+#if YYBTYACC
+
+ /* Current parser state */
+ static YYParseState *yyps = 0;
+
+ /* yypath != NULL: do the full parse, starting at *yypath parser state. */
+ static YYParseState *yypath = 0;
+
+ /* Base of the lexical value queue */
+ static YYSTYPE *yylvals = 0;
+
+ /* Current position at lexical value queue */
+ static YYSTYPE *yylvp = 0;
+
+ /* End position of lexical value queue */
+ static YYSTYPE *yylve = 0;
+
+ /* The last allocated position at the lexical value queue */
+ static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* Base of the lexical position queue */
+ static YYLTYPE *yylpsns = 0;
+
+ /* Current position at lexical position queue */
+ static YYLTYPE *yylpp = 0;
+
+ /* End position of lexical position queue */
+ static YYLTYPE *yylpe = 0;
+
+ /* The last allocated position at the lexical position queue */
+ static YYLTYPE *yylplim = 0;
+#endif
+
+ /* Current position at lexical token queue */
+ static short *yylexp = 0;
+
+ static short *yylexemes = 0;
+#endif /* YYBTYACC */
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 34 "pure_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 38 "pure_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 40 "pure_calc.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 44 "pure_calc.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 46 "pure_calc.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 48 "pure_calc.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 50 "pure_calc.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 52 "pure_calc.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 54 "pure_calc.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 56 "pure_calc.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 58 "pure_calc.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 60 "pure_calc.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 62 "pure_calc.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 67 "pure_calc.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 69 "pure_calc.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1211 "pure_calc.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/pure_calc.tab.h b/contrib/byacc/test/btyacc/pure_calc.tab.h
new file mode 100644
index 000000000000..48f8993b83f6
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_calc.tab.h
@@ -0,0 +1,8 @@
+#ifndef _calc__defines_h_
+#define _calc__defines_h_
+
+#define DIGIT 257
+#define LETTER 258
+#define UMINUS 259
+
+#endif /* _calc__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/pure_error.error b/contrib/byacc/test/btyacc/pure_error.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_error.error
diff --git a/contrib/byacc/test/btyacc/pure_error.output b/contrib/byacc/test/btyacc/pure_error.output
new file mode 100644
index 000000000000..1e56c214a6cc
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_error.output
@@ -0,0 +1,34 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+2 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 $accept
+ 3 258 S
diff --git a/contrib/byacc/test/btyacc/pure_error.tab.c b/contrib/byacc/test/btyacc/pure_error.tab.c
new file mode 100644
index 000000000000..2f3b697aa0ae
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_error.tab.c
@@ -0,0 +1,1274 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse error_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex error_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror error_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar error_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval error_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval error_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug error_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs error_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag error_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs error_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen error_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred error_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos error_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto error_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex error_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex error_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex error_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable error_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck error_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname error_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule error_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex error_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable error_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "error_"
+
+#define YYPURE 1
+
+#line 2 "pure_error.y"
+
+#ifdef YYBISON
+#define YYSTYPE int
+#define YYLEX_PARAM &yylval
+#define YYLEX_DECL() yylex(YYSTYPE *yylval)
+#define YYERROR_DECL() yyerror(const char *s)
+int YYLEX_DECL();
+static void YYERROR_DECL();
+#endif
+
+#line 132 "pure_error.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# ifdef YYLEX_PARAM_TYPE
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, YYLEX_PARAM_TYPE YYLEX_PARAM)
+# else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval, void * YYLEX_PARAM)
+# endif
+# define YYLEX yylex(&yylval, YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(YYSTYPE *yylval)
+# define YYLEX yylex(&yylval)
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT error_lhs[] = { -1,
+ 0,
+};
+static const YYINT error_len[] = { 2,
+ 1,
+};
+static const YYINT error_defred[] = { 0,
+ 1, 0,
+};
+static const YYINT error_stos[] = { 0,
+ 256, 258,
+};
+static const YYINT error_dgoto[] = { 2,
+};
+static const YYINT error_sindex[] = { -256,
+ 0, 0,
+};
+static const YYINT error_rindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT error_cindex[] = { 0,
+ 0, 0,
+};
+#endif
+static const YYINT error_gindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT error_table[] = { 1,
+};
+static const YYINT error_check[] = { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const error_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
+};
+static const char *const error_rule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+#line 17 "pure_error.y"
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(YYSTYPE *value)
+{
+ return value ? 0 : -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 334 "pure_error.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yyerrflag;
+ int yychar;
+ YYSTYPE yyval;
+ YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyloc; /* position returned by actions */
+ YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+ /* variables for the parser stack */
+ YYSTACKDATA yystack;
+#if YYBTYACC
+
+ /* Current parser state */
+ static YYParseState *yyps = 0;
+
+ /* yypath != NULL: do the full parse, starting at *yypath parser state. */
+ static YYParseState *yypath = 0;
+
+ /* Base of the lexical value queue */
+ static YYSTYPE *yylvals = 0;
+
+ /* Current position at lexical value queue */
+ static YYSTYPE *yylvp = 0;
+
+ /* End position of lexical value queue */
+ static YYSTYPE *yylve = 0;
+
+ /* The last allocated position at the lexical value queue */
+ static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* Base of the lexical position queue */
+ static YYLTYPE *yylpsns = 0;
+
+ /* Current position at lexical position queue */
+ static YYLTYPE *yylpp = 0;
+
+ /* End position of lexical position queue */
+ static YYLTYPE *yylpe = 0;
+
+ /* The last allocated position at the lexical position queue */
+ static YYLTYPE *yylplim = 0;
+#endif
+
+ /* Current position at lexical token queue */
+ static short *yylexp = 0;
+
+ static short *yylexemes = 0;
+#endif /* YYBTYACC */
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/pure_error.tab.h b/contrib/byacc/test/btyacc/pure_error.tab.h
new file mode 100644
index 000000000000..f9e5ad278cc4
--- /dev/null
+++ b/contrib/byacc/test/btyacc/pure_error.tab.h
@@ -0,0 +1,5 @@
+#ifndef _error__defines_h_
+#define _error__defines_h_
+
+
+#endif /* _error__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc-s.error b/contrib/byacc/test/btyacc/quote_calc-s.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc-s.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc-s.output b/contrib/byacc/test/btyacc/quote_calc-s.output
new file mode 100644
index 000000000000..6c25d091109b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc-s.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD"
+ 4 259 OP_SUB
+ 5 260 "SUB"
+ 6 261 OP_MUL
+ 7 262 "MUL"
+ 8 263 OP_DIV
+ 9 264 "DIV"
+ 10 265 OP_MOD
+ 11 266 "MOD"
+ 12 267 OP_AND
+ 13 268 "AND"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc-s.tab.c b/contrib/byacc/test/btyacc/quote_calc-s.tab.c
new file mode 100644
index 000000000000..93d94adbdc12
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc-s.tab.c
@@ -0,0 +1,1445 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc-s.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc_stos[] = { 0,
+ 273, 256, 259, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 257, 259, 261, 263, 265,
+ 267, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const YYINT quote_calc_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+"$accept","list","stat","expr","number","illegal-symbol",
+};
+static const char *const quote_calc_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 494 "quote_calc-s.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1211 "quote_calc-s.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc-s.tab.h b/contrib/byacc/test/btyacc/quote_calc-s.tab.h
new file mode 100644
index 000000000000..827bd8d11b26
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc-s.tab.h
@@ -0,0 +1,14 @@
+#ifndef _quote_calc__defines_h_
+#define _quote_calc__defines_h_
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc.error b/contrib/byacc/test/btyacc/quote_calc.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc.output b/contrib/byacc/test/btyacc/quote_calc.output
new file mode 100644
index 000000000000..6c25d091109b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD"
+ 4 259 OP_SUB
+ 5 260 "SUB"
+ 6 261 OP_MUL
+ 7 262 "MUL"
+ 8 263 OP_DIV
+ 9 264 "DIV"
+ 10 265 OP_MOD
+ 11 266 "MOD"
+ 12 267 OP_AND
+ 13 268 "AND"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc.tab.c b/contrib/byacc/test/btyacc/quote_calc.tab.c
new file mode 100644
index 000000000000..56c7abcf5f6e
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc.tab.c
@@ -0,0 +1,1451 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc_stos[] = { 0,
+ 273, 256, 259, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 257, 259, 261, 263, 265,
+ 267, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const YYINT quote_calc_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+"$accept","list","stat","expr","number","illegal-symbol",
+};
+static const char *const quote_calc_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 500 "quote_calc.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1217 "quote_calc.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc.tab.h b/contrib/byacc/test/btyacc/quote_calc.tab.h
new file mode 100644
index 000000000000..2067aeea9093
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc.tab.h
@@ -0,0 +1,20 @@
+#ifndef _quote_calc__defines_h_
+#define _quote_calc__defines_h_
+
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc2-s.error b/contrib/byacc/test/btyacc/quote_calc2-s.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2-s.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc2-s.output b/contrib/byacc/test/btyacc/quote_calc2-s.output
new file mode 100644
index 000000000000..ce0b8f1baf51
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2-s.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD" expr
+ 8 | expr "SUB" expr
+ 9 | expr "MUL" expr
+ 10 | expr "DIV" expr
+ 11 | expr "MOD" expr
+ 12 | expr "AND" expr
+ 13 | expr '|' expr
+ 14 | "SUB" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB" . expr (14)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD" reduce 15
+ "SUB" reduce 15
+ "MUL" reduce 15
+ "DIV" reduce 15
+ "MOD" reduce 15
+ "AND" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD" reduce 16
+ "SUB" reduce 16
+ "MUL" reduce 16
+ "DIV" reduce 16
+ "MOD" reduce 16
+ "AND" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND"
+state 12
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB" expr . (14)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD" . expr (7)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB" . expr (8)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL" . expr (9)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV" . expr (10)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD" . expr (11)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND" . expr (12)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD" expr (7)
+ expr : expr "ADD" expr . (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr "SUB" expr . (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr "MUL" expr . (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr "DIV" expr . (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr "MOD" expr . (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr "AND" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND"
+state 32
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD"
+ 4 259 OP_SUB
+ 5 260 "SUB"
+ 6 261 OP_MUL
+ 7 262 "MUL"
+ 8 263 OP_DIV
+ 9 264 "DIV"
+ 10 265 OP_MOD
+ 11 266 "MOD"
+ 12 267 OP_AND
+ 13 268 "AND"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc2-s.tab.c b/contrib/byacc/test/btyacc/quote_calc2-s.tab.c
new file mode 100644
index 000000000000..be41425e8685
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2-s.tab.c
@@ -0,0 +1,1445 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc2_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc2_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc2_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc2_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc2_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc2_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc2_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc2_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc2_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc2_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc2_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc2_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc2_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc2_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc2_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc2_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc2_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc2_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc2_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc2_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc2_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc2_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc2_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc2_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc2.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc2-s.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc2_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc2_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc2_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc2_stos[] = { 0,
+ 273, 256, 260, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 258, 260, 262, 264, 266,
+ 268, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc2_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc2_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc2_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc2_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc2_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const YYINT quote_calc2_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc2_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc2_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+"$accept","list","stat","expr","number","illegal-symbol",
+};
+static const char *const quote_calc2_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD\" expr",
+"expr : expr \"SUB\" expr",
+"expr : expr \"MUL\" expr",
+"expr : expr \"DIV\" expr",
+"expr : expr \"MOD\" expr",
+"expr : expr \"AND\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc2.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 494 "quote_calc2-s.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc2.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc2.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc2.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc2.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc2.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc2.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc2.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc2.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1211 "quote_calc2-s.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc2-s.tab.h b/contrib/byacc/test/btyacc/quote_calc2-s.tab.h
new file mode 100644
index 000000000000..90c0c1a2d4c2
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2-s.tab.h
@@ -0,0 +1,14 @@
+#ifndef _quote_calc2__defines_h_
+#define _quote_calc2__defines_h_
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc2__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc2.error b/contrib/byacc/test/btyacc/quote_calc2.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc2.output b/contrib/byacc/test/btyacc/quote_calc2.output
new file mode 100644
index 000000000000..ce0b8f1baf51
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD" expr
+ 8 | expr "SUB" expr
+ 9 | expr "MUL" expr
+ 10 | expr "DIV" expr
+ 11 | expr "MOD" expr
+ 12 | expr "AND" expr
+ 13 | expr '|' expr
+ 14 | "SUB" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB" . expr (14)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD" reduce 15
+ "SUB" reduce 15
+ "MUL" reduce 15
+ "DIV" reduce 15
+ "MOD" reduce 15
+ "AND" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD" reduce 16
+ "SUB" reduce 16
+ "MUL" reduce 16
+ "DIV" reduce 16
+ "MOD" reduce 16
+ "AND" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND"
+state 12
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB" expr . (14)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD" . expr (7)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB" . expr (8)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL" . expr (9)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV" . expr (10)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD" . expr (11)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND" . expr (12)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD" expr (7)
+ expr : expr "ADD" expr . (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr "SUB" expr . (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr "MUL" expr . (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr "DIV" expr . (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr "MOD" expr . (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr "AND" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND"
+state 32
+ expr : expr . "ADD" expr (7)
+ expr : expr . "SUB" expr (8)
+ expr : expr . "MUL" expr (9)
+ expr : expr . "DIV" expr (10)
+ expr : expr . "MOD" expr (11)
+ expr : expr . "AND" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD" shift 16
+ "SUB" shift 17
+ "MUL" shift 18
+ "DIV" shift 19
+ "MOD" shift 20
+ "AND" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD"
+ 4 259 OP_SUB
+ 5 260 "SUB"
+ 6 261 OP_MUL
+ 7 262 "MUL"
+ 8 263 OP_DIV
+ 9 264 "DIV"
+ 10 265 OP_MOD
+ 11 266 "MOD"
+ 12 267 OP_AND
+ 13 268 "AND"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc2.tab.c b/contrib/byacc/test/btyacc/quote_calc2.tab.c
new file mode 100644
index 000000000000..496926ec343c
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2.tab.c
@@ -0,0 +1,1451 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc2_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc2_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc2_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc2_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc2_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc2_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc2_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc2_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc2_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc2_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc2_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc2_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc2_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc2_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc2_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc2_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc2_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc2_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc2_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc2_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc2_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc2_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc2_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc2_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc2.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc2.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc2_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc2_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc2_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc2_stos[] = { 0,
+ 273, 256, 260, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 258, 260, 262, 264, 266,
+ 268, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc2_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc2_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc2_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc2_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc2_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const YYINT quote_calc2_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc2_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc2_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD\"","OP_SUB","\"SUB\"","OP_MUL","\"MUL\"","OP_DIV",
+"\"DIV\"","OP_MOD","\"MOD\"","OP_AND","\"AND\"","DIGIT","LETTER","UMINUS",
+"$accept","list","stat","expr","number","illegal-symbol",
+};
+static const char *const quote_calc2_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD\" expr",
+"expr : expr \"SUB\" expr",
+"expr : expr \"MUL\" expr",
+"expr : expr \"DIV\" expr",
+"expr : expr \"MOD\" expr",
+"expr : expr \"AND\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc2.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 500 "quote_calc2.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc2.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc2.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc2.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc2.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc2.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc2.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc2.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc2.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc2.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1217 "quote_calc2.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc2.tab.h b/contrib/byacc/test/btyacc/quote_calc2.tab.h
new file mode 100644
index 000000000000..0c9db245c3cf
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc2.tab.h
@@ -0,0 +1,20 @@
+#ifndef _quote_calc2__defines_h_
+#define _quote_calc2__defines_h_
+
+#define OP_ADD 257
+#define ADD 258
+#define OP_SUB 259
+#define SUB 260
+#define OP_MUL 261
+#define MUL 262
+#define OP_DIV 263
+#define DIV 264
+#define OP_MOD 265
+#define MOD 266
+#define OP_AND 267
+#define AND 268
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc2__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc3-s.error b/contrib/byacc/test/btyacc/quote_calc3-s.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3-s.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc3-s.output b/contrib/byacc/test/btyacc/quote_calc3-s.output
new file mode 100644
index 000000000000..4809ca4c8105
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3-s.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD-operator"
+ 4 259 OP_SUB
+ 5 260 "SUB-operator"
+ 6 261 OP_MUL
+ 7 262 "MUL-operator"
+ 8 263 OP_DIV
+ 9 264 "DIV-operator"
+ 10 265 OP_MOD
+ 11 266 "MOD-operator"
+ 12 267 OP_AND
+ 13 268 "AND-operator"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc3-s.tab.c b/contrib/byacc/test/btyacc/quote_calc3-s.tab.c
new file mode 100644
index 000000000000..a7072f9dab61
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3-s.tab.c
@@ -0,0 +1,1446 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc3_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc3_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc3_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc3_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc3_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc3_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc3_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc3_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc3_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc3_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc3_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc3_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc3_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc3_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc3_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc3_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc3_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc3_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc3_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc3_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc3_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc3_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc3_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc3_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc3.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc3-s.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc3_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc3_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc3_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc3_stos[] = { 0,
+ 273, 256, 259, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 257, 259, 261, 263, 265,
+ 267, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc3_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc3_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc3_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc3_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc3_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const YYINT quote_calc3_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc3_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc3_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","$accept","list","stat",
+"expr","number","illegal-symbol",
+};
+static const char *const quote_calc3_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc3.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 495 "quote_calc3-s.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc3.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc3.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc3.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc3.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc3.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc3.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc3.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc3.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1212 "quote_calc3-s.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc3-s.tab.h b/contrib/byacc/test/btyacc/quote_calc3-s.tab.h
new file mode 100644
index 000000000000..022d59c6782f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3-s.tab.h
@@ -0,0 +1,14 @@
+#ifndef _quote_calc3__defines_h_
+#define _quote_calc3__defines_h_
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc3__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc3.error b/contrib/byacc/test/btyacc/quote_calc3.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc3.output b/contrib/byacc/test/btyacc/quote_calc3.output
new file mode 100644
index 000000000000..4809ca4c8105
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr OP_ADD expr
+ 8 | expr OP_SUB expr
+ 9 | expr OP_MUL expr
+ 10 | expr OP_DIV expr
+ 11 | expr OP_MOD expr
+ 12 | expr OP_AND expr
+ 13 | expr '|' expr
+ 14 | OP_SUB expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : OP_SUB . expr (14)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ OP_ADD reduce 15
+ OP_SUB reduce 15
+ OP_MUL reduce 15
+ OP_DIV reduce 15
+ OP_MOD reduce 15
+ OP_AND reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ OP_ADD reduce 16
+ OP_SUB reduce 16
+ OP_MUL reduce 16
+ OP_DIV reduce 16
+ OP_MOD reduce 16
+ OP_AND reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on OP_ADD
+12: shift/reduce conflict (shift 17, reduce 14) on OP_SUB
+12: shift/reduce conflict (shift 18, reduce 14) on OP_MUL
+12: shift/reduce conflict (shift 19, reduce 14) on OP_DIV
+12: shift/reduce conflict (shift 20, reduce 14) on OP_MOD
+12: shift/reduce conflict (shift 21, reduce 14) on OP_AND
+state 12
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : OP_SUB expr . (14)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr OP_ADD . expr (7)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr OP_SUB . expr (8)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr OP_MUL . expr (9)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr OP_DIV . expr (10)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr OP_MOD . expr (11)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr OP_AND . expr (12)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ OP_SUB shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on OP_ADD
+26: shift/reduce conflict (shift 17, reduce 7) on OP_SUB
+26: shift/reduce conflict (shift 18, reduce 7) on OP_MUL
+26: shift/reduce conflict (shift 19, reduce 7) on OP_DIV
+26: shift/reduce conflict (shift 20, reduce 7) on OP_MOD
+26: shift/reduce conflict (shift 21, reduce 7) on OP_AND
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . OP_ADD expr (7)
+ expr : expr OP_ADD expr . (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on OP_ADD
+27: shift/reduce conflict (shift 17, reduce 8) on OP_SUB
+27: shift/reduce conflict (shift 18, reduce 8) on OP_MUL
+27: shift/reduce conflict (shift 19, reduce 8) on OP_DIV
+27: shift/reduce conflict (shift 20, reduce 8) on OP_MOD
+27: shift/reduce conflict (shift 21, reduce 8) on OP_AND
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr OP_SUB expr . (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on OP_ADD
+28: shift/reduce conflict (shift 17, reduce 9) on OP_SUB
+28: shift/reduce conflict (shift 18, reduce 9) on OP_MUL
+28: shift/reduce conflict (shift 19, reduce 9) on OP_DIV
+28: shift/reduce conflict (shift 20, reduce 9) on OP_MOD
+28: shift/reduce conflict (shift 21, reduce 9) on OP_AND
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr OP_MUL expr . (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on OP_ADD
+29: shift/reduce conflict (shift 17, reduce 10) on OP_SUB
+29: shift/reduce conflict (shift 18, reduce 10) on OP_MUL
+29: shift/reduce conflict (shift 19, reduce 10) on OP_DIV
+29: shift/reduce conflict (shift 20, reduce 10) on OP_MOD
+29: shift/reduce conflict (shift 21, reduce 10) on OP_AND
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr OP_DIV expr . (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on OP_ADD
+30: shift/reduce conflict (shift 17, reduce 11) on OP_SUB
+30: shift/reduce conflict (shift 18, reduce 11) on OP_MUL
+30: shift/reduce conflict (shift 19, reduce 11) on OP_DIV
+30: shift/reduce conflict (shift 20, reduce 11) on OP_MOD
+30: shift/reduce conflict (shift 21, reduce 11) on OP_AND
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr OP_MOD expr . (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on OP_ADD
+31: shift/reduce conflict (shift 17, reduce 12) on OP_SUB
+31: shift/reduce conflict (shift 18, reduce 12) on OP_MUL
+31: shift/reduce conflict (shift 19, reduce 12) on OP_DIV
+31: shift/reduce conflict (shift 20, reduce 12) on OP_MOD
+31: shift/reduce conflict (shift 21, reduce 12) on OP_AND
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr OP_AND expr . (12)
+ expr : expr . '|' expr (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on OP_ADD
+32: shift/reduce conflict (shift 17, reduce 13) on OP_SUB
+32: shift/reduce conflict (shift 18, reduce 13) on OP_MUL
+32: shift/reduce conflict (shift 19, reduce 13) on OP_DIV
+32: shift/reduce conflict (shift 20, reduce 13) on OP_MOD
+32: shift/reduce conflict (shift 21, reduce 13) on OP_AND
+state 32
+ expr : expr . OP_ADD expr (7)
+ expr : expr . OP_SUB expr (8)
+ expr : expr . OP_MUL expr (9)
+ expr : expr . OP_DIV expr (10)
+ expr : expr . OP_MOD expr (11)
+ expr : expr . OP_AND expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ OP_ADD shift 16
+ OP_SUB shift 17
+ OP_MUL shift 18
+ OP_DIV shift 19
+ OP_MOD shift 20
+ OP_AND shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD-operator"
+ 4 259 OP_SUB
+ 5 260 "SUB-operator"
+ 6 261 OP_MUL
+ 7 262 "MUL-operator"
+ 8 263 OP_DIV
+ 9 264 "DIV-operator"
+ 10 265 OP_MOD
+ 11 266 "MOD-operator"
+ 12 267 OP_AND
+ 13 268 "AND-operator"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc3.tab.c b/contrib/byacc/test/btyacc/quote_calc3.tab.c
new file mode 100644
index 000000000000..6b1331403d97
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3.tab.c
@@ -0,0 +1,1446 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc3_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc3_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc3_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc3_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc3_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc3_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc3_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc3_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc3_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc3_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc3_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc3_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc3_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc3_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc3_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc3_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc3_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc3_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc3_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc3_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc3_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc3_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc3_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc3_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc3.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc3.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc3_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc3_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc3_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc3_stos[] = { 0,
+ 273, 256, 259, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 257, 259, 261, 263, 265,
+ 267, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc3_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc3_sindex[] = { 0,
+ -38, 5, -36, 0, -51, -36, 7, -121, -248, 0,
+ 0, -243, -36, -22, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc3_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 13, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 15, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc3_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc3_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 258
+static const YYINT quote_calc3_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 16, 10, 17, 15, 18, 25, 19,
+ 23, 20, 4, 21, 5, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 16, 0, 17, 0, 18,
+ 0, 19, 0, 20, 0, 21, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 3, 0, 3, 0, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 16, 15, 16, 15,
+ 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc3_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 257, 10, 259, 10, 261, 41, 263,
+ 269, 265, 10, 267, 10, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, 124, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 257, -1, 259, -1, 261,
+ -1, 263, -1, 265, -1, 267, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ 259, -1, 259, -1, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 257, -1, 259, -1, 261, -1,
+ 263, -1, 265, -1, 267, -1, 257, 257, 259, 259,
+ 261, 261, 263, 263, 265, 265, 267, 267,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc3_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","$accept","list","stat",
+"expr","number","illegal-symbol",
+};
+static const char *const quote_calc3_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr OP_ADD expr",
+"expr : expr OP_SUB expr",
+"expr : expr OP_MUL expr",
+"expr : expr OP_DIV expr",
+"expr : expr OP_MOD expr",
+"expr : expr OP_AND expr",
+"expr : expr '|' expr",
+"expr : OP_SUB expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc3.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 495 "quote_calc3.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc3.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc3.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc3.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc3.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc3.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc3.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc3.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc3.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc3.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1212 "quote_calc3.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc3.tab.h b/contrib/byacc/test/btyacc/quote_calc3.tab.h
new file mode 100644
index 000000000000..022d59c6782f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc3.tab.h
@@ -0,0 +1,14 @@
+#ifndef _quote_calc3__defines_h_
+#define _quote_calc3__defines_h_
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc3__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc4-s.error b/contrib/byacc/test/btyacc/quote_calc4-s.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4-s.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc4-s.output b/contrib/byacc/test/btyacc/quote_calc4-s.output
new file mode 100644
index 000000000000..5f1f610d8cb0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4-s.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD-operator" expr
+ 8 | expr "SUB-operator" expr
+ 9 | expr "MUL-operator" expr
+ 10 | expr "DIV-operator" expr
+ 11 | expr "MOD-operator" expr
+ 12 | expr "AND-operator" expr
+ 13 | expr '|' expr
+ 14 | "SUB-operator" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB-operator" . expr (14)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD-operator" reduce 15
+ "SUB-operator" reduce 15
+ "MUL-operator" reduce 15
+ "DIV-operator" reduce 15
+ "MOD-operator" reduce 15
+ "AND-operator" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD-operator" reduce 16
+ "SUB-operator" reduce 16
+ "MUL-operator" reduce 16
+ "DIV-operator" reduce 16
+ "MOD-operator" reduce 16
+ "AND-operator" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD-operator"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB-operator"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL-operator"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV-operator"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD-operator"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND-operator"
+state 12
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB-operator" expr . (14)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD-operator" . expr (7)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB-operator" . expr (8)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL-operator" . expr (9)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV-operator" . expr (10)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD-operator" . expr (11)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND-operator" . expr (12)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD-operator"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB-operator"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL-operator"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV-operator"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD-operator"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND-operator"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr "ADD-operator" expr . (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD-operator"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB-operator"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL-operator"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV-operator"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD-operator"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND-operator"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr "SUB-operator" expr . (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD-operator"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB-operator"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL-operator"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV-operator"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD-operator"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND-operator"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr "MUL-operator" expr . (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD-operator"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB-operator"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL-operator"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV-operator"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD-operator"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND-operator"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr "DIV-operator" expr . (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD-operator"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB-operator"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL-operator"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV-operator"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD-operator"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND-operator"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr "MOD-operator" expr . (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD-operator"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB-operator"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL-operator"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV-operator"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD-operator"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND-operator"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr "AND-operator" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD-operator"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB-operator"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL-operator"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV-operator"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD-operator"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND-operator"
+state 32
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD-operator"
+ 4 259 OP_SUB
+ 5 260 "SUB-operator"
+ 6 261 OP_MUL
+ 7 262 "MUL-operator"
+ 8 263 OP_DIV
+ 9 264 "DIV-operator"
+ 10 265 OP_MOD
+ 11 266 "MOD-operator"
+ 12 267 OP_AND
+ 13 268 "AND-operator"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc4-s.tab.c b/contrib/byacc/test/btyacc/quote_calc4-s.tab.c
new file mode 100644
index 000000000000..df8a95789b1b
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4-s.tab.c
@@ -0,0 +1,1446 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc4_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc4_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc4_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc4_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc4_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc4_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc4_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc4_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc4_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc4_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc4_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc4_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc4_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc4_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc4_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc4_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc4_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc4_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc4_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc4_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc4_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc4_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc4_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc4_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc4.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc4-s.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc4_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc4_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc4_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc4_stos[] = { 0,
+ 273, 256, 260, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 258, 260, 262, 264, 266,
+ 268, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc4_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc4_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc4_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc4_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc4_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const YYINT quote_calc4_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc4_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc4_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","$accept","list","stat",
+"expr","number","illegal-symbol",
+};
+static const char *const quote_calc4_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD-operator\" expr",
+"expr : expr \"SUB-operator\" expr",
+"expr : expr \"MUL-operator\" expr",
+"expr : expr \"DIV-operator\" expr",
+"expr : expr \"MOD-operator\" expr",
+"expr : expr \"AND-operator\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB-operator\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc4.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 495 "quote_calc4-s.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc4.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc4.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc4.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc4.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc4.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc4.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc4.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc4.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1212 "quote_calc4-s.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc4-s.tab.h b/contrib/byacc/test/btyacc/quote_calc4-s.tab.h
new file mode 100644
index 000000000000..9279e7019cac
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4-s.tab.h
@@ -0,0 +1,14 @@
+#ifndef _quote_calc4__defines_h_
+#define _quote_calc4__defines_h_
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc4__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/quote_calc4.error b/contrib/byacc/test/btyacc/quote_calc4.error
new file mode 100644
index 000000000000..729d01c0abba
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4.error
@@ -0,0 +1 @@
+YACC: 54 shift/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/quote_calc4.output b/contrib/byacc/test/btyacc/quote_calc4.output
new file mode 100644
index 000000000000..5f1f610d8cb0
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4.output
@@ -0,0 +1,593 @@
+ 0 $accept : list $end
+
+ 1 list :
+ 2 | list stat '\n'
+ 3 | list error '\n'
+
+ 4 stat : expr
+ 5 | LETTER '=' expr
+
+ 6 expr : '(' expr ')'
+ 7 | expr "ADD-operator" expr
+ 8 | expr "SUB-operator" expr
+ 9 | expr "MUL-operator" expr
+ 10 | expr "DIV-operator" expr
+ 11 | expr "MOD-operator" expr
+ 12 | expr "AND-operator" expr
+ 13 | expr '|' expr
+ 14 | "SUB-operator" expr
+ 15 | LETTER
+ 16 | number
+
+ 17 number : DIGIT
+ 18 | number DIGIT
+
+state 0
+ $accept : . list $end (0)
+ list : . (1)
+
+ . reduce 1
+
+ list goto 1
+
+
+state 1
+ $accept : list . $end (0)
+ list : list . stat '\n' (2)
+ list : list . error '\n' (3)
+
+ $end accept
+ error shift 2
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 5
+ '(' shift 6
+ . error
+
+ stat goto 7
+ expr goto 8
+ number goto 9
+
+
+state 2
+ list : list error . '\n' (3)
+
+ '\n' shift 10
+ . error
+
+
+state 3
+ expr : "SUB-operator" . expr (14)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 12
+ number goto 9
+
+
+state 4
+ number : DIGIT . (17)
+
+ . reduce 17
+
+
+state 5
+ stat : LETTER . '=' expr (5)
+ expr : LETTER . (15)
+
+ '=' shift 13
+ "ADD-operator" reduce 15
+ "SUB-operator" reduce 15
+ "MUL-operator" reduce 15
+ "DIV-operator" reduce 15
+ "MOD-operator" reduce 15
+ "AND-operator" reduce 15
+ '|' reduce 15
+ '\n' reduce 15
+
+
+state 6
+ expr : '(' . expr ')' (6)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 14
+ number goto 9
+
+
+state 7
+ list : list stat . '\n' (2)
+
+ '\n' shift 15
+ . error
+
+
+state 8
+ stat : expr . (4)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 4
+
+
+state 9
+ expr : number . (16)
+ number : number . DIGIT (18)
+
+ DIGIT shift 23
+ "ADD-operator" reduce 16
+ "SUB-operator" reduce 16
+ "MUL-operator" reduce 16
+ "DIV-operator" reduce 16
+ "MOD-operator" reduce 16
+ "AND-operator" reduce 16
+ '|' reduce 16
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 10
+ list : list error '\n' . (3)
+
+ . reduce 3
+
+
+state 11
+ expr : LETTER . (15)
+
+ . reduce 15
+
+
+12: shift/reduce conflict (shift 16, reduce 14) on "ADD-operator"
+12: shift/reduce conflict (shift 17, reduce 14) on "SUB-operator"
+12: shift/reduce conflict (shift 18, reduce 14) on "MUL-operator"
+12: shift/reduce conflict (shift 19, reduce 14) on "DIV-operator"
+12: shift/reduce conflict (shift 20, reduce 14) on "MOD-operator"
+12: shift/reduce conflict (shift 21, reduce 14) on "AND-operator"
+state 12
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : "SUB-operator" expr . (14)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 14
+ '\n' reduce 14
+ ')' reduce 14
+
+
+state 13
+ stat : LETTER '=' . expr (5)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 24
+ number goto 9
+
+
+state 14
+ expr : '(' expr . ')' (6)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ ')' shift 25
+ . error
+
+
+state 15
+ list : list stat '\n' . (2)
+
+ . reduce 2
+
+
+state 16
+ expr : expr "ADD-operator" . expr (7)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 26
+ number goto 9
+
+
+state 17
+ expr : expr "SUB-operator" . expr (8)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 27
+ number goto 9
+
+
+state 18
+ expr : expr "MUL-operator" . expr (9)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 28
+ number goto 9
+
+
+state 19
+ expr : expr "DIV-operator" . expr (10)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 29
+ number goto 9
+
+
+state 20
+ expr : expr "MOD-operator" . expr (11)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 30
+ number goto 9
+
+
+state 21
+ expr : expr "AND-operator" . expr (12)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 31
+ number goto 9
+
+
+state 22
+ expr : expr '|' . expr (13)
+
+ "SUB-operator" shift 3
+ DIGIT shift 4
+ LETTER shift 11
+ '(' shift 6
+ . error
+
+ expr goto 32
+ number goto 9
+
+
+state 23
+ number : number DIGIT . (18)
+
+ . reduce 18
+
+
+state 24
+ stat : LETTER '=' expr . (5)
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 5
+
+
+state 25
+ expr : '(' expr ')' . (6)
+
+ . reduce 6
+
+
+26: shift/reduce conflict (shift 16, reduce 7) on "ADD-operator"
+26: shift/reduce conflict (shift 17, reduce 7) on "SUB-operator"
+26: shift/reduce conflict (shift 18, reduce 7) on "MUL-operator"
+26: shift/reduce conflict (shift 19, reduce 7) on "DIV-operator"
+26: shift/reduce conflict (shift 20, reduce 7) on "MOD-operator"
+26: shift/reduce conflict (shift 21, reduce 7) on "AND-operator"
+26: shift/reduce conflict (shift 22, reduce 7) on '|'
+state 26
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr "ADD-operator" expr . (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 7
+ ')' reduce 7
+
+
+27: shift/reduce conflict (shift 16, reduce 8) on "ADD-operator"
+27: shift/reduce conflict (shift 17, reduce 8) on "SUB-operator"
+27: shift/reduce conflict (shift 18, reduce 8) on "MUL-operator"
+27: shift/reduce conflict (shift 19, reduce 8) on "DIV-operator"
+27: shift/reduce conflict (shift 20, reduce 8) on "MOD-operator"
+27: shift/reduce conflict (shift 21, reduce 8) on "AND-operator"
+27: shift/reduce conflict (shift 22, reduce 8) on '|'
+state 27
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr "SUB-operator" expr . (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 8
+ ')' reduce 8
+
+
+28: shift/reduce conflict (shift 16, reduce 9) on "ADD-operator"
+28: shift/reduce conflict (shift 17, reduce 9) on "SUB-operator"
+28: shift/reduce conflict (shift 18, reduce 9) on "MUL-operator"
+28: shift/reduce conflict (shift 19, reduce 9) on "DIV-operator"
+28: shift/reduce conflict (shift 20, reduce 9) on "MOD-operator"
+28: shift/reduce conflict (shift 21, reduce 9) on "AND-operator"
+28: shift/reduce conflict (shift 22, reduce 9) on '|'
+state 28
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr "MUL-operator" expr . (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 9
+ ')' reduce 9
+
+
+29: shift/reduce conflict (shift 16, reduce 10) on "ADD-operator"
+29: shift/reduce conflict (shift 17, reduce 10) on "SUB-operator"
+29: shift/reduce conflict (shift 18, reduce 10) on "MUL-operator"
+29: shift/reduce conflict (shift 19, reduce 10) on "DIV-operator"
+29: shift/reduce conflict (shift 20, reduce 10) on "MOD-operator"
+29: shift/reduce conflict (shift 21, reduce 10) on "AND-operator"
+29: shift/reduce conflict (shift 22, reduce 10) on '|'
+state 29
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr "DIV-operator" expr . (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 10
+ ')' reduce 10
+
+
+30: shift/reduce conflict (shift 16, reduce 11) on "ADD-operator"
+30: shift/reduce conflict (shift 17, reduce 11) on "SUB-operator"
+30: shift/reduce conflict (shift 18, reduce 11) on "MUL-operator"
+30: shift/reduce conflict (shift 19, reduce 11) on "DIV-operator"
+30: shift/reduce conflict (shift 20, reduce 11) on "MOD-operator"
+30: shift/reduce conflict (shift 21, reduce 11) on "AND-operator"
+30: shift/reduce conflict (shift 22, reduce 11) on '|'
+state 30
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr "MOD-operator" expr . (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 11
+ ')' reduce 11
+
+
+31: shift/reduce conflict (shift 16, reduce 12) on "ADD-operator"
+31: shift/reduce conflict (shift 17, reduce 12) on "SUB-operator"
+31: shift/reduce conflict (shift 18, reduce 12) on "MUL-operator"
+31: shift/reduce conflict (shift 19, reduce 12) on "DIV-operator"
+31: shift/reduce conflict (shift 20, reduce 12) on "MOD-operator"
+31: shift/reduce conflict (shift 21, reduce 12) on "AND-operator"
+31: shift/reduce conflict (shift 22, reduce 12) on '|'
+state 31
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr "AND-operator" expr . (12)
+ expr : expr . '|' expr (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' shift 22
+ '\n' reduce 12
+ ')' reduce 12
+
+
+32: shift/reduce conflict (shift 16, reduce 13) on "ADD-operator"
+32: shift/reduce conflict (shift 17, reduce 13) on "SUB-operator"
+32: shift/reduce conflict (shift 18, reduce 13) on "MUL-operator"
+32: shift/reduce conflict (shift 19, reduce 13) on "DIV-operator"
+32: shift/reduce conflict (shift 20, reduce 13) on "MOD-operator"
+32: shift/reduce conflict (shift 21, reduce 13) on "AND-operator"
+state 32
+ expr : expr . "ADD-operator" expr (7)
+ expr : expr . "SUB-operator" expr (8)
+ expr : expr . "MUL-operator" expr (9)
+ expr : expr . "DIV-operator" expr (10)
+ expr : expr . "MOD-operator" expr (11)
+ expr : expr . "AND-operator" expr (12)
+ expr : expr . '|' expr (13)
+ expr : expr '|' expr . (13)
+
+ "ADD-operator" shift 16
+ "SUB-operator" shift 17
+ "MUL-operator" shift 18
+ "DIV-operator" shift 19
+ "MOD-operator" shift 20
+ "AND-operator" shift 21
+ '|' reduce 13
+ '\n' reduce 13
+ ')' reduce 13
+
+
+State 12 contains 6 shift/reduce conflicts.
+State 26 contains 7 shift/reduce conflicts.
+State 27 contains 7 shift/reduce conflicts.
+State 28 contains 7 shift/reduce conflicts.
+State 29 contains 7 shift/reduce conflicts.
+State 30 contains 7 shift/reduce conflicts.
+State 31 contains 7 shift/reduce conflicts.
+State 32 contains 6 shift/reduce conflicts.
+
+
+28 terminals, 5 nonterminals
+19 grammar rules, 33 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 OP_ADD
+ 3 258 "ADD-operator"
+ 4 259 OP_SUB
+ 5 260 "SUB-operator"
+ 6 261 OP_MUL
+ 7 262 "MUL-operator"
+ 8 263 OP_DIV
+ 9 264 "DIV-operator"
+ 10 265 OP_MOD
+ 11 266 "MOD-operator"
+ 12 267 OP_AND
+ 13 268 "AND-operator"
+ 14 269 DIGIT
+ 15 270 LETTER
+ 16 124 '|'
+ 17 38 '&'
+ 18 43 '+'
+ 19 45 '-'
+ 20 42 '*'
+ 21 47 '/'
+ 22 37 '%'
+ 23 271 UMINUS
+ 24 10 '\n'
+ 25 61 '='
+ 26 40 '('
+ 27 41 ')'
+ 28 272 $accept
+ 29 273 list
+ 30 274 stat
+ 31 275 expr
+ 32 276 number
diff --git a/contrib/byacc/test/btyacc/quote_calc4.tab.c b/contrib/byacc/test/btyacc/quote_calc4.tab.c
new file mode 100644
index 000000000000..59e6d1f4f50e
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4.tab.c
@@ -0,0 +1,1446 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse quote_calc4_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex quote_calc4_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror quote_calc4_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar quote_calc4_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval quote_calc4_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval quote_calc4_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug quote_calc4_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs quote_calc4_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag quote_calc4_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs quote_calc4_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen quote_calc4_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred quote_calc4_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos quote_calc4_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto quote_calc4_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex quote_calc4_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex quote_calc4_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex quote_calc4_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable quote_calc4_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck quote_calc4_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname quote_calc4_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule quote_calc4_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex quote_calc4_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable quote_calc4_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "quote_calc4_"
+
+#define YYPURE 0
+
+#line 2 "quote_calc4.y"
+# include <stdio.h>
+# include <ctype.h>
+
+int regs[26];
+int base;
+
+int yylex(void);
+static void yyerror(const char *s);
+
+#line 131 "quote_calc4.tab.c"
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT quote_calc4_lhs[] = { -1,
+ 0, 0, 0, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 3, 3,
+};
+static const YYINT quote_calc4_len[] = { 2,
+ 0, 3, 3, 1, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 2, 1, 1, 1, 2,
+};
+static const YYINT quote_calc4_defred[] = { 1,
+ 0, 0, 0, 17, 0, 0, 0, 0, 0, 3,
+ 15, 0, 0, 0, 2, 0, 0, 0, 0, 0,
+ 0, 0, 18, 0, 6, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+static const YYINT quote_calc4_stos[] = { 0,
+ 273, 256, 260, 269, 270, 40, 274, 275, 276, 10,
+ 270, 275, 61, 275, 10, 258, 260, 262, 264, 266,
+ 268, 124, 269, 275, 41, 275, 275, 275, 275, 275,
+ 275, 275,
+};
+static const YYINT quote_calc4_dgoto[] = { 1,
+ 7, 8, 9,
+};
+static const YYINT quote_calc4_sindex[] = { 0,
+ -38, 4, -36, 0, -51, -36, 6, -121, -249, 0,
+ 0, -243, -36, -23, 0, -36, -36, -36, -36, -36,
+ -36, -36, 0, -121, 0, -121, -121, -121, -121, -121,
+ -121, -243,
+};
+static const YYINT quote_calc4_rindex[] = { 0,
+ 0, 0, 0, 0, -9, 0, 0, 12, -10, 0,
+ 0, -5, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 14, 0, -3, -2, -1, 1, 2,
+ 3, -4,
+};
+#if YYBTYACC
+static const YYINT quote_calc4_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT quote_calc4_gindex[] = { 0,
+ 0, 42, 0,
+};
+#define YYTABLESIZE 259
+static const YYINT quote_calc4_table[] = { 16,
+ 15, 6, 22, 6, 14, 13, 7, 8, 9, 13,
+ 10, 11, 12, 10, 16, 15, 17, 25, 18, 23,
+ 19, 4, 20, 5, 21, 0, 0, 0, 0, 0,
+ 16, 0, 0, 0, 0, 14, 13, 7, 8, 9,
+ 0, 10, 11, 12, 12, 0, 0, 14, 0, 0,
+ 0, 0, 0, 0, 24, 0, 0, 26, 27, 28,
+ 29, 30, 31, 32, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 22, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 16, 15, 0, 0, 0, 14, 13,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 16, 0, 17, 0,
+ 18, 0, 19, 0, 20, 0, 21, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 2, 0, 0,
+ 0, 3, 0, 3, 0, 0, 0, 0, 0, 0,
+ 4, 5, 4, 11, 16, 0, 17, 0, 18, 0,
+ 19, 0, 20, 0, 21, 0, 0, 16, 15, 16,
+ 15, 16, 15, 16, 15, 16, 15, 16, 15,
+};
+static const YYINT quote_calc4_check[] = { 10,
+ 10, 40, 124, 40, 10, 10, 10, 10, 10, 61,
+ 10, 10, 10, 10, 258, 10, 260, 41, 262, 269,
+ 264, 10, 266, 10, 268, -1, -1, -1, -1, -1,
+ 41, -1, -1, -1, -1, 41, 41, 41, 41, 41,
+ -1, 41, 41, 41, 3, -1, -1, 6, -1, -1,
+ -1, -1, -1, -1, 13, -1, -1, 16, 17, 18,
+ 19, 20, 21, 22, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 124, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, 124, 124, -1, -1, -1, 124, 124,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, 258, -1, 260, -1,
+ 262, -1, 264, -1, 266, -1, 268, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, 256, -1, -1,
+ -1, 260, -1, 260, -1, -1, -1, -1, -1, -1,
+ 269, 270, 269, 270, 258, -1, 260, -1, 262, -1,
+ 264, -1, 266, -1, 268, -1, -1, 258, 258, 260,
+ 260, 262, 262, 264, 264, 266, 266, 268, 268,
+};
+#define YYFINAL 1
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 271
+#define YYUNDFTOKEN 277
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const quote_calc4_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'%'","'&'",0,"'('","')'","'*'","'+'",0,"'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,
+0,0,0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'|'",0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,"error","OP_ADD","\"ADD-operator\"","OP_SUB","\"SUB-operator\"","OP_MUL",
+"\"MUL-operator\"","OP_DIV","\"DIV-operator\"","OP_MOD","\"MOD-operator\"",
+"OP_AND","\"AND-operator\"","DIGIT","LETTER","UMINUS","$accept","list","stat",
+"expr","number","illegal-symbol",
+};
+static const char *const quote_calc4_rule[] = {
+"$accept : list",
+"list :",
+"list : list stat '\\n'",
+"list : list error '\\n'",
+"stat : expr",
+"stat : LETTER '=' expr",
+"expr : '(' expr ')'",
+"expr : expr \"ADD-operator\" expr",
+"expr : expr \"SUB-operator\" expr",
+"expr : expr \"MUL-operator\" expr",
+"expr : expr \"DIV-operator\" expr",
+"expr : expr \"MOD-operator\" expr",
+"expr : expr \"AND-operator\" expr",
+"expr : expr '|' expr",
+"expr : \"SUB-operator\" expr",
+"expr : LETTER",
+"expr : number",
+"number : DIGIT",
+"number : number DIGIT",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 73 "quote_calc4.y"
+ /* start of programs */
+
+int
+main (void)
+{
+ while(!feof(stdin)) {
+ yyparse();
+ }
+ return 0;
+}
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void) {
+ /* lexical analysis routine */
+ /* returns LETTER for a lower case letter, yylval = 0 through 25 */
+ /* return DIGIT for a digit, yylval = 0 through 9 */
+ /* all other characters are returned immediately */
+
+ int c;
+
+ while( (c=getchar()) == ' ' ) { /* skip blanks */ }
+
+ /* c is now nonblank */
+
+ if( islower( c )) {
+ yylval = c - 'a';
+ return ( LETTER );
+ }
+ if( isdigit( c )) {
+ yylval = c - '0';
+ return ( DIGIT );
+ }
+ return( c );
+}
+#line 495 "quote_calc4.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 35 "quote_calc4.y"
+ { yyerrok ; }
+break;
+case 4:
+#line 39 "quote_calc4.y"
+ { printf("%d\n",yystack.l_mark[0]);}
+break;
+case 5:
+#line 41 "quote_calc4.y"
+ { regs[yystack.l_mark[-2]] = yystack.l_mark[0]; }
+break;
+case 6:
+#line 45 "quote_calc4.y"
+ { yyval = yystack.l_mark[-1]; }
+break;
+case 7:
+#line 47 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] + yystack.l_mark[0]; }
+break;
+case 8:
+#line 49 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] - yystack.l_mark[0]; }
+break;
+case 9:
+#line 51 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] * yystack.l_mark[0]; }
+break;
+case 10:
+#line 53 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] / yystack.l_mark[0]; }
+break;
+case 11:
+#line 55 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] % yystack.l_mark[0]; }
+break;
+case 12:
+#line 57 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] & yystack.l_mark[0]; }
+break;
+case 13:
+#line 59 "quote_calc4.y"
+ { yyval = yystack.l_mark[-2] | yystack.l_mark[0]; }
+break;
+case 14:
+#line 61 "quote_calc4.y"
+ { yyval = - yystack.l_mark[0]; }
+break;
+case 15:
+#line 63 "quote_calc4.y"
+ { yyval = regs[yystack.l_mark[0]]; }
+break;
+case 17:
+#line 68 "quote_calc4.y"
+ { yyval = yystack.l_mark[0]; base = (yystack.l_mark[0]==0) ? 8 : 10; }
+break;
+case 18:
+#line 70 "quote_calc4.y"
+ { yyval = base * yystack.l_mark[-1] + yystack.l_mark[0]; }
+break;
+#line 1212 "quote_calc4.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/quote_calc4.tab.h b/contrib/byacc/test/btyacc/quote_calc4.tab.h
new file mode 100644
index 000000000000..9279e7019cac
--- /dev/null
+++ b/contrib/byacc/test/btyacc/quote_calc4.tab.h
@@ -0,0 +1,14 @@
+#ifndef _quote_calc4__defines_h_
+#define _quote_calc4__defines_h_
+
+#define OP_ADD 257
+#define OP_SUB 259
+#define OP_MUL 261
+#define OP_DIV 263
+#define OP_MOD 265
+#define OP_AND 267
+#define DIGIT 269
+#define LETTER 270
+#define UMINUS 271
+
+#endif /* _quote_calc4__defines_h_ */
diff --git a/contrib/byacc/test/btyacc/rename_debug.c b/contrib/byacc/test/btyacc/rename_debug.c
new file mode 100644
index 000000000000..330e725a4713
--- /dev/null
+++ b/contrib/byacc/test/btyacc/rename_debug.c
@@ -0,0 +1,1121 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+#line 20 "rename_debug.c"
+#include "rename_debug.i"
+#include "rename_debug.h"
+typedef short YYINT;
+static const YYINT yylhs[] = { -1,
+ 0,
+};
+static const YYINT yylen[] = { 2,
+ 1,
+};
+static const YYINT yydefred[] = { 0,
+ 1, 0,
+};
+static const YYINT yystos[] = { 0,
+ 256, 258,
+};
+static const YYINT yydgoto[] = { 2,
+};
+static const YYINT yysindex[] = { -256,
+ 0, 0,
+};
+static const YYINT yyrindex[] = { 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT yycindex[] = { 0,
+ 0, 0,
+};
+#endif
+static const YYINT yygindex[] = { 0,
+};
+#define YYTABLESIZE 0
+static const YYINT yytable[] = { 1,
+};
+static const YYINT yycheck[] = { 256,
+};
+#define YYFINAL 2
+#ifndef YYDEBUG
+#define YYDEBUG 1
+#endif
+#define YYMAXTOKEN 256
+#define YYUNDFTOKEN 259
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const yyname[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"error","$accept","S","illegal-symbol",
+};
+static const char *const yyrule[] = {
+"$accept : S",
+"S : error",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 12 "code_debug.y"
+
+#include <stdio.h>
+
+#ifdef YYBYACC
+extern int YYLEX_DECL();
+#endif
+
+int
+main(void)
+{
+ printf("yyparse() = %d\n", yyparse());
+ return 0;
+}
+
+int
+yylex(void)
+{
+ return -1;
+}
+
+static void
+yyerror(const char* s)
+{
+ printf("%s\n", s);
+}
+#line 232 "rename_debug.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/rename_debug.error b/contrib/byacc/test/btyacc/rename_debug.error
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/contrib/byacc/test/btyacc/rename_debug.error
diff --git a/contrib/byacc/test/btyacc/rename_debug.h b/contrib/byacc/test/btyacc/rename_debug.h
new file mode 100644
index 000000000000..ba44e7d75a77
--- /dev/null
+++ b/contrib/byacc/test/btyacc/rename_debug.h
@@ -0,0 +1,6 @@
+#ifndef _yy_defines_h_
+#define _yy_defines_h_
+
+#define YYERRCODE 256
+
+#endif /* _yy_defines_h_ */
diff --git a/contrib/byacc/test/btyacc/rename_debug.i b/contrib/byacc/test/btyacc/rename_debug.i
new file mode 100644
index 000000000000..b8f2144e197f
--- /dev/null
+++ b/contrib/byacc/test/btyacc/rename_debug.i
@@ -0,0 +1,60 @@
+#define YYPREFIX "yy"
+
+#define YYPURE 0
+
+#line 2 "code_debug.y"
+
+#ifdef YYBISON
+int yylex(void);
+static void yyerror(const char *);
+#endif
+
+
+#if ! defined(YYSTYPE) && ! defined(YYSTYPE_IS_DECLARED)
+/* Default: YYSTYPE is the semantic value type. */
+typedef int YYSTYPE;
+# define YYSTYPE_IS_DECLARED 1
+#endif
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+extern int yydebug;
+extern int yynerrs;
+
+extern int yyerrflag;
+extern int yychar;
+extern YYSTYPE yyval;
+extern YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+extern YYLTYPE yyloc; /* position returned by actions */
+extern YYLTYPE yylloc; /* position from the lexer */
+#endif
diff --git a/contrib/byacc/test/btyacc/rename_debug.output b/contrib/byacc/test/btyacc/rename_debug.output
new file mode 100644
index 000000000000..1e56c214a6cc
--- /dev/null
+++ b/contrib/byacc/test/btyacc/rename_debug.output
@@ -0,0 +1,34 @@
+ 0 $accept : S $end
+
+ 1 S : error
+
+state 0
+ $accept : . S $end (0)
+
+ error shift 1
+ . error
+
+ S goto 2
+
+
+state 1
+ S : error . (1)
+
+ . reduce 1
+
+
+state 2
+ $accept : S . $end (0)
+
+ $end accept
+
+
+2 terminals, 2 nonterminals
+2 grammar rules, 3 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 $accept
+ 3 258 S
diff --git a/contrib/byacc/test/btyacc/varsyntax_calc1.error b/contrib/byacc/test/btyacc/varsyntax_calc1.error
new file mode 100644
index 000000000000..9c1f7152c30e
--- /dev/null
+++ b/contrib/byacc/test/btyacc/varsyntax_calc1.error
@@ -0,0 +1,2 @@
+YACC: 2 rules never reduced
+YACC: 18 shift/reduce conflicts, 26 reduce/reduce conflicts.
diff --git a/contrib/byacc/test/btyacc/varsyntax_calc1.output b/contrib/byacc/test/btyacc/varsyntax_calc1.output
new file mode 100644
index 000000000000..d6a869f6d353
--- /dev/null
+++ b/contrib/byacc/test/btyacc/varsyntax_calc1.output
@@ -0,0 +1,900 @@
+ 0 $accept : line $end
+
+ 1 lines :
+ 2 | lines line
+
+ 3 line : dexp '\n'
+ 4 | vexp '\n'
+ 5 | DREG '=' dexp '\n'
+ 6 | VREG '=' vexp '\n'
+ 7 | error '\n'
+
+ 8 dexp : CONST
+ 9 | DREG
+ 10 | dexp '+' dexp
+ 11 | dexp '-' dexp
+ 12 | dexp '*' dexp
+ 13 | dexp '/' dexp
+ 14 | '-' dexp
+ 15 | '(' dexp ')'
+
+ 16 vexp : dexp
+ 17 | '(' dexp ',' dexp ')'
+ 18 | VREG
+ 19 | vexp '+' vexp
+ 20 | dexp '+' vexp
+ 21 | vexp '-' vexp
+ 22 | dexp '-' vexp
+ 23 | vexp '*' vexp
+ 24 | dexp '*' vexp
+ 25 | vexp '/' vexp
+ 26 | dexp '/' vexp
+ 27 | '-' vexp
+ 28 | '(' vexp ')'
+
+state 0
+ $accept : . line $end (0)
+
+ error shift 1
+ DREG shift 2
+ VREG shift 3
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ line goto 7
+ dexp goto 8
+ vexp goto 9
+
+
+state 1
+ line : error . '\n' (7)
+
+ '\n' shift 10
+ . error
+
+
+state 2
+ line : DREG . '=' dexp '\n' (5)
+ dexp : DREG . (9)
+
+ '=' shift 11
+ '+' reduce 9
+ '-' reduce 9
+ '*' reduce 9
+ '/' reduce 9
+ '\n' reduce 9
+
+
+state 3
+ line : VREG . '=' vexp '\n' (6)
+ vexp : VREG . (18)
+
+ '=' shift 12
+ '+' reduce 18
+ '-' reduce 18
+ '*' reduce 18
+ '/' reduce 18
+ '\n' reduce 18
+
+
+state 4
+ dexp : CONST . (8)
+
+ . reduce 8
+
+
+state 5
+ dexp : '-' . dexp (14)
+ vexp : '-' . vexp (27)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 15
+ vexp goto 16
+
+
+state 6
+ dexp : '(' . dexp ')' (15)
+ vexp : '(' . dexp ',' dexp ')' (17)
+ vexp : '(' . vexp ')' (28)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 17
+ vexp goto 18
+
+
+state 7
+ $accept : line . $end (0)
+
+ $end accept
+
+
+8: shift/reduce conflict (shift 19, reduce 16) on '+'
+8: shift/reduce conflict (shift 20, reduce 16) on '-'
+8: shift/reduce conflict (shift 21, reduce 16) on '*'
+8: shift/reduce conflict (shift 22, reduce 16) on '/'
+8: shift/reduce conflict (shift 23, reduce 16) on '\n'
+state 8
+ line : dexp . '\n' (3)
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' shift 19
+ '-' shift 20
+ '*' shift 21
+ '/' shift 22
+ '\n' shift 23
+
+
+state 9
+ line : vexp . '\n' (4)
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ '\n' shift 28
+ . error
+
+
+state 10
+ line : error '\n' . (7)
+
+ . reduce 7
+
+
+state 11
+ line : DREG '=' . dexp '\n' (5)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 31
+
+
+state 12
+ line : VREG '=' . vexp '\n' (6)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 33
+
+
+state 13
+ dexp : DREG . (9)
+
+ . reduce 9
+
+
+state 14
+ vexp : VREG . (18)
+
+ . reduce 18
+
+
+15: reduce/reduce conflict (reduce 14, reduce 16) on '+'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '-'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '*'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '/'
+15: reduce/reduce conflict (reduce 14, reduce 16) on '\n'
+15: reduce/reduce conflict (reduce 14, reduce 16) on ')'
+state 15
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '-' dexp . (14)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ . reduce 14
+
+
+state 16
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : '-' vexp . (27)
+
+ . reduce 27
+
+
+17: shift/reduce conflict (shift 19, reduce 16) on '+'
+17: shift/reduce conflict (shift 20, reduce 16) on '-'
+17: shift/reduce conflict (shift 21, reduce 16) on '*'
+17: shift/reduce conflict (shift 22, reduce 16) on '/'
+17: shift/reduce conflict (shift 34, reduce 16) on ')'
+state 17
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '(' dexp . ')' (15)
+ vexp : dexp . (16)
+ vexp : '(' dexp . ',' dexp ')' (17)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' shift 19
+ '-' shift 20
+ '*' shift 21
+ '/' shift 22
+ ')' shift 34
+ ',' shift 35
+
+
+state 18
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : '(' vexp . ')' (28)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ ')' shift 36
+ . error
+
+
+state 19
+ dexp : dexp '+' . dexp (10)
+ vexp : dexp '+' . vexp (20)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 37
+ vexp goto 38
+
+
+state 20
+ dexp : dexp '-' . dexp (11)
+ vexp : dexp '-' . vexp (22)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 39
+ vexp goto 40
+
+
+state 21
+ dexp : dexp '*' . dexp (12)
+ vexp : dexp '*' . vexp (24)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 41
+ vexp goto 42
+
+
+state 22
+ dexp : dexp '/' . dexp (13)
+ vexp : dexp '/' . vexp (26)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 43
+ vexp goto 44
+
+
+state 23
+ line : dexp '\n' . (3)
+
+ . reduce 3
+
+
+state 24
+ vexp : vexp '+' . vexp (19)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 45
+
+
+state 25
+ vexp : vexp '-' . vexp (21)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 46
+
+
+state 26
+ vexp : vexp '*' . vexp (23)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 47
+
+
+state 27
+ vexp : vexp '/' . vexp (25)
+
+ DREG shift 13
+ VREG shift 14
+ CONST shift 4
+ '-' shift 5
+ '(' shift 6
+ . error
+
+ dexp goto 32
+ vexp goto 48
+
+
+state 28
+ line : vexp '\n' . (4)
+
+ . reduce 4
+
+
+state 29
+ dexp : '-' . dexp (14)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 49
+
+
+state 30
+ dexp : '(' . dexp ')' (15)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 50
+
+
+state 31
+ line : DREG '=' dexp . '\n' (5)
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ '\n' shift 55
+ . error
+
+
+32: shift/reduce conflict (shift 19, reduce 16) on '+'
+32: shift/reduce conflict (shift 20, reduce 16) on '-'
+32: shift/reduce conflict (shift 21, reduce 16) on '*'
+32: shift/reduce conflict (shift 22, reduce 16) on '/'
+state 32
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '+' shift 19
+ '-' shift 20
+ '*' shift 21
+ '/' shift 22
+ '\n' reduce 16
+ ')' reduce 16
+
+
+state 33
+ line : VREG '=' vexp . '\n' (6)
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '+' shift 24
+ '-' shift 25
+ '*' shift 26
+ '/' shift 27
+ '\n' shift 56
+ . error
+
+
+state 34
+ dexp : '(' dexp ')' . (15)
+
+ . reduce 15
+
+
+state 35
+ vexp : '(' dexp ',' . dexp ')' (17)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 57
+
+
+state 36
+ vexp : '(' vexp ')' . (28)
+
+ . reduce 28
+
+
+37: reduce/reduce conflict (reduce 10, reduce 16) on '+'
+37: reduce/reduce conflict (reduce 10, reduce 16) on '-'
+37: shift/reduce conflict (shift 21, reduce 16) on '*'
+37: shift/reduce conflict (shift 22, reduce 16) on '/'
+37: reduce/reduce conflict (reduce 10, reduce 16) on '\n'
+37: reduce/reduce conflict (reduce 10, reduce 16) on ')'
+state 37
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp '+' dexp . (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '*' shift 21
+ '/' shift 22
+ '+' reduce 10
+ '-' reduce 10
+ '\n' reduce 10
+ ')' reduce 10
+ ',' reduce 10
+
+
+state 38
+ vexp : vexp . '+' vexp (19)
+ vexp : dexp '+' vexp . (20)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 20
+ '-' reduce 20
+ '\n' reduce 20
+ ')' reduce 20
+
+
+39: reduce/reduce conflict (reduce 11, reduce 16) on '+'
+39: reduce/reduce conflict (reduce 11, reduce 16) on '-'
+39: shift/reduce conflict (shift 21, reduce 16) on '*'
+39: shift/reduce conflict (shift 22, reduce 16) on '/'
+39: reduce/reduce conflict (reduce 11, reduce 16) on '\n'
+39: reduce/reduce conflict (reduce 11, reduce 16) on ')'
+state 39
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp '-' dexp . (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ '*' shift 21
+ '/' shift 22
+ '+' reduce 11
+ '-' reduce 11
+ '\n' reduce 11
+ ')' reduce 11
+ ',' reduce 11
+
+
+state 40
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : dexp '-' vexp . (22)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 22
+ '-' reduce 22
+ '\n' reduce 22
+ ')' reduce 22
+
+
+41: reduce/reduce conflict (reduce 12, reduce 16) on '+'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '-'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '*'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '/'
+41: reduce/reduce conflict (reduce 12, reduce 16) on '\n'
+41: reduce/reduce conflict (reduce 12, reduce 16) on ')'
+state 41
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp '*' dexp . (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ . reduce 12
+
+
+state 42
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : dexp '*' vexp . (24)
+ vexp : vexp . '/' vexp (25)
+
+ . reduce 24
+
+
+43: reduce/reduce conflict (reduce 13, reduce 16) on '+'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '-'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '*'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '/'
+43: reduce/reduce conflict (reduce 13, reduce 16) on '\n'
+43: reduce/reduce conflict (reduce 13, reduce 16) on ')'
+state 43
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : dexp '/' dexp . (13)
+ vexp : dexp . (16)
+ vexp : dexp . '+' vexp (20)
+ vexp : dexp . '-' vexp (22)
+ vexp : dexp . '*' vexp (24)
+ vexp : dexp . '/' vexp (26)
+
+ . reduce 13
+
+
+state 44
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : dexp '/' vexp . (26)
+
+ . reduce 26
+
+
+state 45
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp '+' vexp . (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 19
+ '-' reduce 19
+ '\n' reduce 19
+ ')' reduce 19
+
+
+state 46
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp '-' vexp . (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+
+ '*' shift 26
+ '/' shift 27
+ '+' reduce 21
+ '-' reduce 21
+ '\n' reduce 21
+ ')' reduce 21
+
+
+state 47
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp '*' vexp . (23)
+ vexp : vexp . '/' vexp (25)
+
+ . reduce 23
+
+
+state 48
+ vexp : vexp . '+' vexp (19)
+ vexp : vexp . '-' vexp (21)
+ vexp : vexp . '*' vexp (23)
+ vexp : vexp . '/' vexp (25)
+ vexp : vexp '/' vexp . (25)
+
+ . reduce 25
+
+
+state 49
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '-' dexp . (14)
+
+ . reduce 14
+
+
+state 50
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : '(' dexp . ')' (15)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ ')' shift 34
+ . error
+
+
+state 51
+ dexp : dexp '+' . dexp (10)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 58
+
+
+state 52
+ dexp : dexp '-' . dexp (11)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 59
+
+
+state 53
+ dexp : dexp '*' . dexp (12)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 60
+
+
+state 54
+ dexp : dexp '/' . dexp (13)
+
+ DREG shift 13
+ CONST shift 4
+ '-' shift 29
+ '(' shift 30
+ . error
+
+ dexp goto 61
+
+
+state 55
+ line : DREG '=' dexp '\n' . (5)
+
+ . reduce 5
+
+
+state 56
+ line : VREG '=' vexp '\n' . (6)
+
+ . reduce 6
+
+
+state 57
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ vexp : '(' dexp ',' dexp . ')' (17)
+
+ '+' shift 51
+ '-' shift 52
+ '*' shift 53
+ '/' shift 54
+ ')' shift 62
+ . error
+
+
+state 58
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp '+' dexp . (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '*' shift 53
+ '/' shift 54
+ '+' reduce 10
+ '-' reduce 10
+ '\n' reduce 10
+ ')' reduce 10
+
+
+state 59
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp '-' dexp . (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+
+ '*' shift 53
+ '/' shift 54
+ '+' reduce 11
+ '-' reduce 11
+ '\n' reduce 11
+ ')' reduce 11
+
+
+state 60
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp '*' dexp . (12)
+ dexp : dexp . '/' dexp (13)
+
+ . reduce 12
+
+
+state 61
+ dexp : dexp . '+' dexp (10)
+ dexp : dexp . '-' dexp (11)
+ dexp : dexp . '*' dexp (12)
+ dexp : dexp . '/' dexp (13)
+ dexp : dexp '/' dexp . (13)
+
+ . reduce 13
+
+
+state 62
+ vexp : '(' dexp ',' dexp ')' . (17)
+
+ . reduce 17
+
+
+Rules never reduced:
+ lines : (1)
+ lines : lines line (2)
+
+
+State 8 contains 5 shift/reduce conflicts.
+State 15 contains 6 reduce/reduce conflicts.
+State 17 contains 5 shift/reduce conflicts.
+State 32 contains 4 shift/reduce conflicts.
+State 37 contains 2 shift/reduce conflicts, 4 reduce/reduce conflicts.
+State 39 contains 2 shift/reduce conflicts, 4 reduce/reduce conflicts.
+State 41 contains 6 reduce/reduce conflicts.
+State 43 contains 6 reduce/reduce conflicts.
+
+
+15 terminals, 5 nonterminals
+29 grammar rules, 63 states
+
+grammar parser grammar
+symbol# value# symbol
+ 0 0 $end
+ 1 256 error
+ 2 257 DREG
+ 3 258 VREG
+ 4 259 CONST
+ 5 43 '+'
+ 6 45 '-'
+ 7 42 '*'
+ 8 47 '/'
+ 9 260 UMINUS
+ 10 10 '\n'
+ 11 61 '='
+ 12 40 '('
+ 13 41 ')'
+ 14 44 ','
+ 15 261 $accept
+ 16 262 line
+ 17 263 dexp
+ 18 264 vexp
+ 19 265 lines
diff --git a/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c b/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c
new file mode 100644
index 000000000000..afab81092897
--- /dev/null
+++ b/contrib/byacc/test/btyacc/varsyntax_calc1.tab.c
@@ -0,0 +1,1678 @@
+/* original parser id follows */
+/* yysccsid[] = "@(#)yaccpar 1.9 (Berkeley) 02/21/93" */
+/* (use YYMAJOR/YYMINOR for ifdefs dependent on parser version) */
+
+#define YYBYACC 1
+#define YYMAJOR 1
+#define YYMINOR 9
+#define YYCHECK "yyyymmdd"
+
+#define YYEMPTY (-1)
+#define yyclearin (yychar = YYEMPTY)
+#define yyerrok (yyerrflag = 0)
+#define YYRECOVERING() (yyerrflag != 0)
+#define YYENOMEM (-2)
+#define YYEOF 0
+#ident "check variant syntax features"
+#undef YYBTYACC
+#define YYBTYACC 0
+#define YYDEBUGSTR YYPREFIX "debug"
+
+#ifndef yyparse
+#define yyparse varsyntax_calc1_parse
+#endif /* yyparse */
+
+#ifndef yylex
+#define yylex varsyntax_calc1_lex
+#endif /* yylex */
+
+#ifndef yyerror
+#define yyerror varsyntax_calc1_error
+#endif /* yyerror */
+
+#ifndef yychar
+#define yychar varsyntax_calc1_char
+#endif /* yychar */
+
+#ifndef yyval
+#define yyval varsyntax_calc1_val
+#endif /* yyval */
+
+#ifndef yylval
+#define yylval varsyntax_calc1_lval
+#endif /* yylval */
+
+#ifndef yydebug
+#define yydebug varsyntax_calc1_debug
+#endif /* yydebug */
+
+#ifndef yynerrs
+#define yynerrs varsyntax_calc1_nerrs
+#endif /* yynerrs */
+
+#ifndef yyerrflag
+#define yyerrflag varsyntax_calc1_errflag
+#endif /* yyerrflag */
+
+#ifndef yylhs
+#define yylhs varsyntax_calc1_lhs
+#endif /* yylhs */
+
+#ifndef yylen
+#define yylen varsyntax_calc1_len
+#endif /* yylen */
+
+#ifndef yydefred
+#define yydefred varsyntax_calc1_defred
+#endif /* yydefred */
+
+#ifndef yystos
+#define yystos varsyntax_calc1_stos
+#endif /* yystos */
+
+#ifndef yydgoto
+#define yydgoto varsyntax_calc1_dgoto
+#endif /* yydgoto */
+
+#ifndef yysindex
+#define yysindex varsyntax_calc1_sindex
+#endif /* yysindex */
+
+#ifndef yyrindex
+#define yyrindex varsyntax_calc1_rindex
+#endif /* yyrindex */
+
+#ifndef yygindex
+#define yygindex varsyntax_calc1_gindex
+#endif /* yygindex */
+
+#ifndef yytable
+#define yytable varsyntax_calc1_table
+#endif /* yytable */
+
+#ifndef yycheck
+#define yycheck varsyntax_calc1_check
+#endif /* yycheck */
+
+#ifndef yyname
+#define yyname varsyntax_calc1_name
+#endif /* yyname */
+
+#ifndef yyrule
+#define yyrule varsyntax_calc1_rule
+#endif /* yyrule */
+
+#if YYBTYACC
+
+#ifndef yycindex
+#define yycindex varsyntax_calc1_cindex
+#endif /* yycindex */
+
+#ifndef yyctable
+#define yyctable varsyntax_calc1_ctable
+#endif /* yyctable */
+
+#endif /* YYBTYACC */
+
+#define YYPREFIX "varsyntax_calc1_"
+
+#define YYPURE 0
+
+#line 3 "varsyntax_calc1.y"
+
+/* http://dinosaur.compilertools.net/yacc/index.html * /*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <math.h>
+
+typedef struct interval
+{
+ double lo, hi;
+}
+INTERVAL;
+
+INTERVAL vmul(double, double, INTERVAL);
+INTERVAL vdiv(double, double, INTERVAL);
+
+extern int yylex(void);
+static void yyerror(const char *s);
+
+int dcheck(INTERVAL);
+
+double dreg[26];
+INTERVAL vreg[26];
+
+#line 32 "varsyntax_calc1.y"
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ int ival; /* dreg & vreg array index values*/
+ double dval; /* floating point values*/
+ INTERVAL vval; /* interval values*/
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+#line 162 "varsyntax_calc1.tab.c"
+
+/* compatibility with bison */
+#ifdef YYPARSE_PARAM
+/* compatibility with FreeBSD */
+# ifdef YYPARSE_PARAM_TYPE
+# define YYPARSE_DECL() yyparse(YYPARSE_PARAM_TYPE YYPARSE_PARAM)
+# else
+# define YYPARSE_DECL() yyparse(void *YYPARSE_PARAM)
+# endif
+#else
+# define YYPARSE_DECL() yyparse(void)
+#endif
+
+/* Parameters sent to lex. */
+#ifdef YYLEX_PARAM
+# define YYLEX_DECL() yylex(void *YYLEX_PARAM)
+# define YYLEX yylex(YYLEX_PARAM)
+#else
+# define YYLEX_DECL() yylex(void)
+# define YYLEX yylex()
+#endif
+
+/* Parameters sent to yyerror. */
+#ifndef YYERROR_DECL
+#define YYERROR_DECL() yyerror(const char *s)
+#endif
+#ifndef YYERROR_CALL
+#define YYERROR_CALL(msg) yyerror(msg)
+#endif
+
+extern int YYPARSE_DECL();
+
+#define DREG 257
+#define VREG 258
+#define CONST 259
+#define UMINUS 260
+#define YYERRCODE 256
+typedef short YYINT;
+static const YYINT varsyntax_calc1_lhs[] = { -1,
+ 3, 3, 0, 0, 0, 0, 0, 1, 1, 1,
+ 1, 1, 1, 1, 1, 2, 2, 2, 2, 2,
+ 2, 2, 2, 2, 2, 2, 2, 2,
+};
+static const YYINT varsyntax_calc1_len[] = { 2,
+ 0, 2, 2, 2, 4, 4, 2, 1, 1, 3,
+ 3, 3, 3, 2, 3, 1, 5, 1, 3, 3,
+ 3, 3, 3, 3, 3, 3, 2, 3,
+};
+static const YYINT varsyntax_calc1_defred[] = { 0,
+ 0, 0, 0, 8, 0, 0, 0, 0, 0, 7,
+ 0, 0, 9, 18, 14, 27, 0, 0, 0, 0,
+ 0, 0, 3, 0, 0, 0, 0, 4, 0, 0,
+ 0, 0, 0, 15, 0, 28, 0, 0, 0, 0,
+ 12, 24, 13, 26, 0, 0, 23, 25, 14, 0,
+ 0, 0, 0, 0, 5, 6, 0, 0, 0, 12,
+ 13, 17,
+};
+static const YYINT varsyntax_calc1_stos[] = { 0,
+ 256, 257, 258, 259, 45, 40, 262, 263, 264, 10,
+ 61, 61, 257, 258, 263, 264, 263, 264, 43, 45,
+ 42, 47, 10, 43, 45, 42, 47, 10, 45, 40,
+ 263, 263, 264, 41, 44, 41, 263, 264, 263, 264,
+ 263, 264, 263, 264, 264, 264, 264, 264, 263, 263,
+ 43, 45, 42, 47, 10, 10, 263, 263, 263, 263,
+ 263, 41,
+};
+static const YYINT varsyntax_calc1_dgoto[] = { 7,
+ 32, 9, 0,
+};
+static const YYINT varsyntax_calc1_sindex[] = { -40,
+ -8, -48, -47, 0, -37, -37, 0, 2, 17, 0,
+ -34, -37, 0, 0, 0, 0, -25, 90, -37, -37,
+ -37, -37, 0, -37, -37, -37, -37, 0, -34, -34,
+ 25, 125, 31, 0, -34, 0, -11, 37, -11, 37,
+ 0, 0, 0, 0, 37, 37, 0, 0, 0, 111,
+ -34, -34, -34, -34, 0, 0, 118, 69, 69, 0,
+ 0, 0,
+};
+static const YYINT varsyntax_calc1_rindex[] = { 0,
+ 0, 38, 44, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, -9, 0, 0, 0, 0, 51, -3, 56, 61,
+ 0, 0, 0, 0, 67, 72, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 78, 83, 0,
+ 0, 0,
+};
+#if YYBTYACC
+static const YYINT varsyntax_calc1_cindex[] = { 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0,
+};
+#endif
+static const YYINT varsyntax_calc1_gindex[] = { 0,
+ 4, 124, 0,
+};
+#define YYTABLESIZE 225
+static const YYINT varsyntax_calc1_table[] = { 6,
+ 16, 10, 6, 8, 5, 30, 20, 5, 15, 17,
+ 29, 23, 11, 12, 31, 34, 21, 19, 35, 20,
+ 0, 22, 37, 39, 41, 43, 28, 0, 0, 0,
+ 21, 16, 49, 50, 55, 22, 0, 20, 57, 20,
+ 56, 20, 0, 21, 19, 0, 20, 9, 22, 0,
+ 0, 0, 0, 18, 58, 59, 60, 61, 26, 24,
+ 10, 25, 0, 27, 0, 11, 53, 51, 0, 52,
+ 22, 54, 26, 24, 0, 25, 19, 27, 26, 9,
+ 9, 21, 9, 27, 9, 18, 18, 10, 18, 0,
+ 18, 10, 11, 10, 10, 10, 11, 0, 11, 11,
+ 11, 22, 0, 22, 0, 22, 0, 19, 0, 19,
+ 53, 19, 21, 0, 21, 54, 21, 0, 10, 0,
+ 10, 0, 10, 11, 0, 11, 0, 11, 16, 18,
+ 36, 26, 24, 0, 25, 33, 27, 0, 0, 0,
+ 0, 0, 38, 40, 42, 44, 0, 45, 46, 47,
+ 48, 34, 53, 51, 0, 52, 0, 54, 62, 53,
+ 51, 0, 52, 0, 54, 0, 21, 19, 0, 20,
+ 0, 22, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 1, 2, 3, 4, 13,
+ 14, 4, 13, 0, 4,
+};
+static const YYINT varsyntax_calc1_check[] = { 40,
+ 10, 10, 40, 0, 45, 40, 10, 45, 5, 6,
+ 45, 10, 61, 61, 11, 41, 42, 43, 44, 45,
+ -1, 47, 19, 20, 21, 22, 10, -1, -1, -1,
+ 42, 41, 29, 30, 10, 47, -1, 41, 35, 43,
+ 10, 45, -1, 42, 43, -1, 45, 10, 47, -1,
+ -1, -1, -1, 10, 51, 52, 53, 54, 42, 43,
+ 10, 45, -1, 47, -1, 10, 42, 43, -1, 45,
+ 10, 47, 42, 43, -1, 45, 10, 47, 42, 42,
+ 43, 10, 45, 47, 47, 42, 43, 10, 45, -1,
+ 47, 41, 10, 43, 44, 45, 41, -1, 43, 44,
+ 45, 41, -1, 43, -1, 45, -1, 41, -1, 43,
+ 42, 45, 41, -1, 43, 47, 45, -1, 41, -1,
+ 43, -1, 45, 41, -1, 43, -1, 45, 5, 6,
+ 41, 42, 43, -1, 45, 12, 47, -1, -1, -1,
+ -1, -1, 19, 20, 21, 22, -1, 24, 25, 26,
+ 27, 41, 42, 43, -1, 45, -1, 47, 41, 42,
+ 43, -1, 45, -1, 47, -1, 42, 43, -1, 45,
+ -1, 47, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 256, 257, 258, 259, 257,
+ 258, 259, 257, -1, 259,
+};
+#define YYFINAL 7
+#ifndef YYDEBUG
+#define YYDEBUG 0
+#endif
+#define YYMAXTOKEN 260
+#define YYUNDFTOKEN 266
+#define YYTRANSLATE(a) ((a) > YYMAXTOKEN ? YYUNDFTOKEN : (a))
+#if YYDEBUG
+static const char *const varsyntax_calc1_name[] = {
+
+"$end",0,0,0,0,0,0,0,0,0,"'\\n'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,"'('","')'","'*'","'+'","','","'-'",0,"'/'",0,0,0,0,0,0,0,0,0,0,0,0,
+0,"'='",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+"error","DREG","VREG","CONST","UMINUS","$accept","line","dexp","vexp","lines",
+"illegal-symbol",
+};
+static const char *const varsyntax_calc1_rule[] = {
+"$accept : line",
+"lines :",
+"lines : lines line",
+"line : dexp '\\n'",
+"line : vexp '\\n'",
+"line : DREG '=' dexp '\\n'",
+"line : VREG '=' vexp '\\n'",
+"line : error '\\n'",
+"dexp : CONST",
+"dexp : DREG",
+"dexp : dexp '+' dexp",
+"dexp : dexp '-' dexp",
+"dexp : dexp '*' dexp",
+"dexp : dexp '/' dexp",
+"dexp : '-' dexp",
+"dexp : '(' dexp ')'",
+"vexp : dexp",
+"vexp : '(' dexp ',' dexp ')'",
+"vexp : VREG",
+"vexp : vexp '+' vexp",
+"vexp : dexp '+' vexp",
+"vexp : vexp '-' vexp",
+"vexp : dexp '-' vexp",
+"vexp : vexp '*' vexp",
+"vexp : dexp '*' vexp",
+"vexp : vexp '/' vexp",
+"vexp : dexp '/' vexp",
+"vexp : '-' vexp",
+"vexp : '(' vexp ')'",
+
+};
+#endif
+
+int yydebug;
+int yynerrs;
+
+int yyerrflag;
+int yychar;
+YYSTYPE yyval;
+YYSTYPE yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+YYLTYPE yyloc; /* position returned by actions */
+YYLTYPE yylloc; /* position from the lexer */
+#endif
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+#ifndef YYLLOC_DEFAULT
+#define YYLLOC_DEFAULT(loc, rhs, n) \
+do \
+{ \
+ if (n == 0) \
+ { \
+ (loc).first_line = ((rhs)[-1]).last_line; \
+ (loc).first_column = ((rhs)[-1]).last_column; \
+ (loc).last_line = ((rhs)[-1]).last_line; \
+ (loc).last_column = ((rhs)[-1]).last_column; \
+ } \
+ else \
+ { \
+ (loc).first_line = ((rhs)[ 0 ]).first_line; \
+ (loc).first_column = ((rhs)[ 0 ]).first_column; \
+ (loc).last_line = ((rhs)[n-1]).last_line; \
+ (loc).last_column = ((rhs)[n-1]).last_column; \
+ } \
+} while (0)
+#endif /* YYLLOC_DEFAULT */
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#if YYBTYACC
+
+#ifndef YYLVQUEUEGROWTH
+#define YYLVQUEUEGROWTH 32
+#endif
+#endif /* YYBTYACC */
+
+/* define the initial stack-sizes */
+#ifdef YYSTACKSIZE
+#undef YYMAXDEPTH
+#define YYMAXDEPTH YYSTACKSIZE
+#else
+#ifdef YYMAXDEPTH
+#define YYSTACKSIZE YYMAXDEPTH
+#else
+#define YYSTACKSIZE 10000
+#define YYMAXDEPTH 10000
+#endif
+#endif
+
+#ifndef YYINITSTACKSIZE
+#define YYINITSTACKSIZE 200
+#endif
+
+typedef struct {
+ unsigned stacksize;
+ short *s_base;
+ short *s_mark;
+ short *s_last;
+ YYSTYPE *l_base;
+ YYSTYPE *l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *p_base;
+ YYLTYPE *p_mark;
+#endif
+} YYSTACKDATA;
+#if YYBTYACC
+
+struct YYParseState_s
+{
+ struct YYParseState_s *save; /* Previously saved parser state */
+ YYSTACKDATA yystack; /* saved parser stack */
+ int state; /* saved parser state */
+ int errflag; /* saved error recovery status */
+ int lexeme; /* saved index of the conflict lexeme in the lexical queue */
+ YYINT ctry; /* saved index in yyctable[] for this conflict */
+};
+typedef struct YYParseState_s YYParseState;
+#endif /* YYBTYACC */
+/* variables for the parser stack */
+static YYSTACKDATA yystack;
+#if YYBTYACC
+
+/* Current parser state */
+static YYParseState *yyps = 0;
+
+/* yypath != NULL: do the full parse, starting at *yypath parser state. */
+static YYParseState *yypath = 0;
+
+/* Base of the lexical value queue */
+static YYSTYPE *yylvals = 0;
+
+/* Current position at lexical value queue */
+static YYSTYPE *yylvp = 0;
+
+/* End position of lexical value queue */
+static YYSTYPE *yylve = 0;
+
+/* The last allocated position at the lexical value queue */
+static YYSTYPE *yylvlim = 0;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+/* Base of the lexical position queue */
+static YYLTYPE *yylpsns = 0;
+
+/* Current position at lexical position queue */
+static YYLTYPE *yylpp = 0;
+
+/* End position of lexical position queue */
+static YYLTYPE *yylpe = 0;
+
+/* The last allocated position at the lexical position queue */
+static YYLTYPE *yylplim = 0;
+#endif
+
+/* Current position at lexical token queue */
+static short *yylexp = 0;
+
+static short *yylexemes = 0;
+#endif /* YYBTYACC */
+#line 178 "varsyntax_calc1.y"
+ /* beginning of subroutines section */
+
+#define BSZ 50 /* buffer size for floating point numbers */
+
+ /* lexical analysis */
+
+static void
+yyerror(const char *s)
+{
+ fprintf(stderr, "%s\n", s);
+}
+
+int
+yylex(void)
+{
+ int c;
+
+ while ((c = getchar()) == ' ')
+ { /* skip over blanks */
+ }
+
+ if (isupper(c))
+ {
+ yylval.ival = c - 'A';
+ return (VREG);
+ }
+ if (islower(c))
+ {
+ yylval.ival = c - 'a';
+ return (DREG);
+ }
+
+ if (isdigit(c) || c == '.')
+ {
+ /* gobble up digits, points, exponents */
+ char buf[BSZ + 1], *cp = buf;
+ int dot = 0, expr = 0;
+
+ for (; (cp - buf) < BSZ; ++cp, c = getchar())
+ {
+
+ *cp = (char) c;
+ if (isdigit(c))
+ continue;
+ if (c == '.')
+ {
+ if (dot++ || expr)
+ return ('.'); /* will cause syntax error */
+ continue;
+ }
+
+ if (c == 'e')
+ {
+ if (expr++)
+ return ('e'); /* will cause syntax error */
+ continue;
+ }
+
+ /* end of number */
+ break;
+ }
+ *cp = '\0';
+
+ if ((cp - buf) >= BSZ)
+ printf("constant too long: truncated\n");
+ else
+ ungetc(c, stdin); /* push back last char read */
+ yylval.dval = atof(buf);
+ return (CONST);
+ }
+ return (c);
+}
+
+static INTERVAL
+hilo(double a, double b, double c, double d)
+{
+ /* returns the smallest interval containing a, b, c, and d */
+ /* used by *, / routines */
+ INTERVAL v;
+
+ if (a > b)
+ {
+ v.hi = a;
+ v.lo = b;
+ }
+ else
+ {
+ v.hi = b;
+ v.lo = a;
+ }
+
+ if (c > d)
+ {
+ if (c > v.hi)
+ v.hi = c;
+ if (d < v.lo)
+ v.lo = d;
+ }
+ else
+ {
+ if (d > v.hi)
+ v.hi = d;
+ if (c < v.lo)
+ v.lo = c;
+ }
+ return (v);
+}
+
+INTERVAL
+vmul(double a, double b, INTERVAL v)
+{
+ return (hilo(a * v.hi, a * v.lo, b * v.hi, b * v.lo));
+}
+
+int
+dcheck(INTERVAL v)
+{
+ if (v.hi >= 0. && v.lo <= 0.)
+ {
+ printf("divisor interval contains 0.\n");
+ return (1);
+ }
+ return (0);
+}
+
+INTERVAL
+vdiv(double a, double b, INTERVAL v)
+{
+ return (hilo(a / v.hi, a / v.lo, b / v.hi, b / v.lo));
+}
+#line 624 "varsyntax_calc1.tab.c"
+
+/* For use in generated program */
+#define yydepth (int)(yystack.s_mark - yystack.s_base)
+#if YYBTYACC
+#define yytrial (yyps->save)
+#endif /* YYBTYACC */
+
+#if YYDEBUG
+#include <stdio.h> /* needed for printf */
+#endif
+
+#include <stdlib.h> /* needed for malloc, etc */
+#include <string.h> /* needed for memset */
+
+/* allocate initial stack or double stack size, up to YYMAXDEPTH */
+static int yygrowstack(YYSTACKDATA *data)
+{
+ int i;
+ unsigned newsize;
+ short *newss;
+ YYSTYPE *newvs;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *newps;
+#endif
+
+ if ((newsize = data->stacksize) == 0)
+ newsize = YYINITSTACKSIZE;
+ else if (newsize >= YYMAXDEPTH)
+ return YYENOMEM;
+ else if ((newsize *= 2) > YYMAXDEPTH)
+ newsize = YYMAXDEPTH;
+
+ i = (int) (data->s_mark - data->s_base);
+ newss = (short *)realloc(data->s_base, newsize * sizeof(*newss));
+ if (newss == 0)
+ return YYENOMEM;
+
+ data->s_base = newss;
+ data->s_mark = newss + i;
+
+ newvs = (YYSTYPE *)realloc(data->l_base, newsize * sizeof(*newvs));
+ if (newvs == 0)
+ return YYENOMEM;
+
+ data->l_base = newvs;
+ data->l_mark = newvs + i;
+
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ newps = (YYLTYPE *)realloc(data->p_base, newsize * sizeof(*newps));
+ if (newps == 0)
+ return YYENOMEM;
+
+ data->p_base = newps;
+ data->p_mark = newps + i;
+#endif
+
+ data->stacksize = newsize;
+ data->s_last = data->s_base + newsize - 1;
+
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug: stack size increased to %d\n", YYPREFIX, newsize);
+#endif
+ return 0;
+}
+
+#if YYPURE || defined(YY_NO_LEAKS)
+static void yyfreestack(YYSTACKDATA *data)
+{
+ free(data->s_base);
+ free(data->l_base);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ free(data->p_base);
+#endif
+ memset(data, 0, sizeof(*data));
+}
+#else
+#define yyfreestack(data) /* nothing */
+#endif /* YYPURE || defined(YY_NO_LEAKS) */
+#if YYBTYACC
+
+static YYParseState *
+yyNewState(unsigned size)
+{
+ YYParseState *p = (YYParseState *) malloc(sizeof(YYParseState));
+ if (p == NULL) return NULL;
+
+ p->yystack.stacksize = size;
+ if (size == 0)
+ {
+ p->yystack.s_base = NULL;
+ p->yystack.l_base = NULL;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = NULL;
+#endif
+ return p;
+ }
+ p->yystack.s_base = (short *) malloc(size * sizeof(short));
+ if (p->yystack.s_base == NULL) return NULL;
+ p->yystack.l_base = (YYSTYPE *) malloc(size * sizeof(YYSTYPE));
+ if (p->yystack.l_base == NULL) return NULL;
+ memset(p->yystack.l_base, 0, size * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ p->yystack.p_base = (YYLTYPE *) malloc(size * sizeof(YYLTYPE));
+ if (p->yystack.p_base == NULL) return NULL;
+ memset(p->yystack.p_base, 0, size * sizeof(YYLTYPE));
+#endif
+
+ return p;
+}
+
+static void
+yyFreeState(YYParseState *p)
+{
+ yyfreestack(&p->yystack);
+ free(p);
+}
+#endif /* YYBTYACC */
+
+#define YYABORT goto yyabort
+#define YYREJECT goto yyabort
+#define YYACCEPT goto yyaccept
+#define YYERROR goto yyerrlab
+#if YYBTYACC
+#define YYVALID do { if (yyps->save) goto yyvalid; } while(0)
+#define YYVALID_NESTED do { if (yyps->save && \
+ yyps->save->save == 0) goto yyvalid; } while(0)
+#endif /* YYBTYACC */
+
+int
+YYPARSE_DECL()
+{
+ int yym, yyn, yystate, yyresult;
+#if YYBTYACC
+ int yynewerrflag;
+ YYParseState *yyerrctx = NULL;
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE yyerror_loc_range[2]; /* position of error start & end */
+#endif
+#if YYDEBUG
+ const char *yys;
+
+ if ((yys = getenv("YYDEBUG")) != 0)
+ {
+ yyn = *yys;
+ if (yyn >= '0' && yyn <= '9')
+ yydebug = yyn - '0';
+ }
+ if (yydebug)
+ fprintf(stderr, "%sdebug[<# of symbols on state stack>]\n", YYPREFIX);
+#endif
+
+#if YYBTYACC
+ yyps = yyNewState(0); if (yyps == 0) goto yyenomem;
+ yyps->save = 0;
+#endif /* YYBTYACC */
+ yynerrs = 0;
+ yyerrflag = 0;
+ yychar = YYEMPTY;
+ yystate = 0;
+
+#if YYPURE
+ memset(&yystack, 0, sizeof(yystack));
+#endif
+
+ if (yystack.s_base == NULL && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystack.s_mark = yystack.s_base;
+ yystack.l_mark = yystack.l_base;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base;
+#endif
+ yystate = 0;
+ *yystack.s_mark = 0;
+
+yyloop:
+ if ((yyn = yydefred[yystate]) != 0) goto yyreduce;
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL) goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL) goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL) goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading token %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, " <%s>", YYSTYPE_TOSTRING(yychar, yylval));
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ }
+#if YYBTYACC
+
+ /* Do we have a conflict? */
+ if (((yyn = yycindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ YYINT ctry;
+
+ if (yypath)
+ {
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d: following successful trial parse\n",
+ YYDEBUGSTR, yydepth, yystate);
+#endif
+ /* Switch to the next conflict context */
+ save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ ctry = save->ctry;
+ if (save->state != yystate) YYABORT;
+ yyFreeState(save);
+
+ }
+ else
+ {
+
+ /* Unresolved conflict - start/continue trial parse */
+ YYParseState *save;
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: CONFLICT in state %d. ", YYDEBUGSTR, yydepth, yystate);
+ if (yyps->save)
+ fputs("ALREADY in conflict, continuing trial parse.\n", stderr);
+ else
+ fputs("Starting trial parse.\n", stderr);
+ }
+#endif
+ save = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (save == NULL) goto yyenomem;
+ save->save = yyps->save;
+ save->state = yystate;
+ save->errflag = yyerrflag;
+ save->yystack.s_mark = save->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (save->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ save->yystack.l_mark = save->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (save->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ save->yystack.p_mark = save->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (save->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = yytable[yyn];
+ if (yyctable[ctry] == -1)
+ {
+#if YYDEBUG
+ if (yydebug && yychar >= YYEOF)
+ fprintf(stderr, "%s[%d]: backtracking 1 token\n", YYDEBUGSTR, yydepth);
+#endif
+ ctry++;
+ }
+ save->ctry = ctry;
+ if (yyps->save == NULL)
+ {
+ /* If this is a first conflict in the stack, start saving lexemes */
+ if (!yylexemes)
+ {
+ yylexemes = (short *) malloc((YYLVQUEUEGROWTH) * sizeof(short));
+ if (yylexemes == NULL) goto yyenomem;
+ yylvals = (YYSTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYSTYPE));
+ if (yylvals == NULL) goto yyenomem;
+ yylvlim = yylvals + YYLVQUEUEGROWTH;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpsns = (YYLTYPE *) malloc((YYLVQUEUEGROWTH) * sizeof(YYLTYPE));
+ if (yylpsns == NULL) goto yyenomem;
+ yylplim = yylpsns + YYLVQUEUEGROWTH;
+#endif
+ }
+ if (yylvp == yylve)
+ {
+ yylvp = yylve = yylvals;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns;
+#endif
+ yylexp = yylexemes;
+ if (yychar >= YYEOF)
+ {
+ *yylve++ = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpe++ = yylloc;
+#endif
+ *yylexp = (short) yychar;
+ yychar = YYEMPTY;
+ }
+ }
+ }
+ if (yychar >= YYEOF)
+ {
+ yylvp--;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp--;
+#endif
+ yylexp--;
+ yychar = YYEMPTY;
+ }
+ save->lexeme = yylvp - yylvals;
+ yyps->save = save;
+ }
+ if (yytable[yyn] == ctry)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yyctable[ctry]);
+#endif
+ if (yychar < 0)
+ {
+ yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp++;
+#endif
+ yylexp++;
+ }
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM)
+ goto yyoverflow;
+ yystate = yyctable[ctry];
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ else
+ {
+ yyn = yyctable[ctry];
+ goto yyreduce;
+ }
+ } /* End of code dealing with conflicts */
+#endif /* YYBTYACC */
+ if (((yyn = yysindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, shifting to state %d\n",
+ YYDEBUGSTR, yydepth, yystate, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yylloc;
+#endif
+ yychar = YYEMPTY;
+ if (yyerrflag > 0) --yyerrflag;
+ goto yyloop;
+ }
+ if (((yyn = yyrindex[yystate]) != 0) && (yyn += yychar) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yychar)
+ {
+ yyn = yytable[yyn];
+ goto yyreduce;
+ }
+ if (yyerrflag != 0) goto yyinrecovery;
+#if YYBTYACC
+
+ yynewerrflag = 1;
+ goto yyerrhandler;
+ goto yyerrlab;
+
+yyerrlab:
+ yynewerrflag = 0;
+yyerrhandler:
+ while (yyps->save)
+ {
+ int ctry;
+ YYParseState *save = yyps->save;
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: ERROR in state %d, CONFLICT BACKTRACKING to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yyps->save->state,
+ (int)(yylvp - yylvals - yyps->save->lexeme));
+#endif
+ /* Memorize most forward-looking error state in case it's really an error. */
+ if (yyerrctx == NULL || yyerrctx->lexeme < yylvp - yylvals)
+ {
+ /* Free old saved error context state */
+ if (yyerrctx) yyFreeState(yyerrctx);
+ /* Create and fill out new saved error context state */
+ yyerrctx = yyNewState((unsigned)(yystack.s_mark - yystack.s_base + 1));
+ if (yyerrctx == NULL) goto yyenomem;
+ yyerrctx->save = yyps->save;
+ yyerrctx->state = yystate;
+ yyerrctx->errflag = yyerrflag;
+ yyerrctx->yystack.s_mark = yyerrctx->yystack.s_base + (yystack.s_mark - yystack.s_base);
+ memcpy (yyerrctx->yystack.s_base, yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yyerrctx->yystack.l_mark = yyerrctx->yystack.l_base + (yystack.l_mark - yystack.l_base);
+ memcpy (yyerrctx->yystack.l_base, yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerrctx->yystack.p_mark = yyerrctx->yystack.p_base + (yystack.p_mark - yystack.p_base);
+ memcpy (yyerrctx->yystack.p_base, yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yyerrctx->lexeme = yylvp - yylvals;
+ }
+ yylvp = yylvals + save->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + save->lexeme;
+#endif
+ yylexp = yylexemes + save->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (save->yystack.s_mark - save->yystack.s_base);
+ memcpy (yystack.s_base, save->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (save->yystack.l_mark - save->yystack.l_base);
+ memcpy (yystack.l_base, save->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (save->yystack.p_mark - save->yystack.p_base);
+ memcpy (yystack.p_base, save->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ ctry = ++save->ctry;
+ yystate = save->state;
+ /* We tried shift, try reduce now */
+ if ((yyn = yyctable[ctry]) >= 0) goto yyreduce;
+ yyps->save = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+
+ /* Nothing left on the stack -- error */
+ if (!yyps->save)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%sdebug[%d,trial]: trial parse FAILED, entering ERROR mode\n",
+ YYPREFIX, yydepth);
+#endif
+ /* Restore state as it was in the most forward-advanced error */
+ yylvp = yylvals + yyerrctx->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yyerrctx->lexeme;
+#endif
+ yylexp = yylexemes + yyerrctx->lexeme;
+ yychar = yylexp[-1];
+ yylval = yylvp[-1];
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = yylpp[-1];
+#endif
+ yystack.s_mark = yystack.s_base + (yyerrctx->yystack.s_mark - yyerrctx->yystack.s_base);
+ memcpy (yystack.s_base, yyerrctx->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yyerrctx->yystack.l_mark - yyerrctx->yystack.l_base);
+ memcpy (yystack.l_base, yyerrctx->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yyerrctx->yystack.p_mark - yyerrctx->yystack.p_base);
+ memcpy (yystack.p_base, yyerrctx->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yyerrctx->state;
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yynewerrflag = 1;
+ }
+ if (yynewerrflag == 0) goto yyinrecovery;
+#endif /* YYBTYACC */
+
+ YYERROR_CALL("syntax error");
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yyerror_loc_range[0] = yylloc; /* lookahead position is error start position */
+#endif
+
+#if !YYBTYACC
+ goto yyerrlab;
+yyerrlab:
+#endif
+ ++yynerrs;
+
+yyinrecovery:
+ if (yyerrflag < 3)
+ {
+ yyerrflag = 3;
+ for (;;)
+ {
+ if (((yyn = yysindex[*yystack.s_mark]) != 0) && (yyn += YYERRCODE) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) YYERRCODE)
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, error recovery shifting to state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark, yytable[yyn]);
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ yystate = yytable[yyn];
+ *++yystack.s_mark = yytable[yyn];
+ *++yystack.l_mark = yylval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* lookahead position is error end position */
+ yyerror_loc_range[1] = yylloc;
+ YYLLOC_DEFAULT(yyloc, yyerror_loc_range, 2); /* position of error span */
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+ }
+ else
+ {
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: error recovery discarding state %d\n",
+ YYDEBUGSTR, yydepth, *yystack.s_mark);
+#endif
+ if (yystack.s_mark <= yystack.s_base) goto yyabort;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ /* the current TOS position is the error start position */
+ yyerror_loc_range[0] = *yystack.p_mark;
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark, yystack.p_mark);
+#else
+ YYDESTRUCT_CALL("error: discarding state",
+ yystos[*yystack.s_mark], yystack.l_mark);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ --yystack.s_mark;
+ --yystack.l_mark;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ --yystack.p_mark;
+#endif
+ }
+ }
+ }
+ else
+ {
+ if (yychar == YYEOF) goto yyabort;
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, error recovery discarding token %d (%s)\n",
+ YYDEBUGSTR, yydepth, yystate, yychar, yys);
+ }
+#endif
+#if defined(YYDESTRUCT_CALL)
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("error: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+#endif /* defined(YYDESTRUCT_CALL) */
+ yychar = YYEMPTY;
+ goto yyloop;
+ }
+
+yyreduce:
+ yym = yylen[yyn];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: state %d, reducing by rule %d (%s)",
+ YYDEBUGSTR, yydepth, yystate, yyn, yyrule[yyn]);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ if (yym > 0)
+ {
+ int i;
+ fputc('<', stderr);
+ for (i = yym; i > 0; i--)
+ {
+ if (i != yym) fputs(", ", stderr);
+ fputs(YYSTYPE_TOSTRING(yystos[yystack.s_mark[1-i]],
+ yystack.l_mark[1-i]), stderr);
+ }
+ fputc('>', stderr);
+ }
+#endif
+ fputc('\n', stderr);
+ }
+#endif
+ if (yym > 0)
+ yyval = yystack.l_mark[1-yym];
+ else
+ memset(&yyval, 0, sizeof yyval);
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+
+ /* Perform position reduction */
+ memset(&yyloc, 0, sizeof(yyloc));
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ {
+ YYLLOC_DEFAULT(yyloc, &yystack.p_mark[1-yym], yym);
+ /* just in case YYERROR is invoked within the action, save
+ the start of the rhs as the error start position */
+ yyerror_loc_range[0] = yystack.p_mark[1-yym];
+ }
+#endif
+
+ switch (yyn)
+ {
+case 3:
+#line 59 "varsyntax_calc1.y"
+ {
+ (void) printf("%15.8f\n", yystack.l_mark[-1].dval);
+ }
+break;
+case 4:
+#line 63 "varsyntax_calc1.y"
+ {
+ (void) printf("(%15.8f, %15.8f)\n", yystack.l_mark[-1].vval.lo, yystack.l_mark[-1].vval.hi);
+ }
+break;
+case 5:
+#line 67 "varsyntax_calc1.y"
+ {
+ dreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].dval;
+ }
+break;
+case 6:
+#line 71 "varsyntax_calc1.y"
+ {
+ vreg[yystack.l_mark[-3].ival] = yystack.l_mark[-1].vval;
+ }
+break;
+case 7:
+#line 75 "varsyntax_calc1.y"
+ {
+ yyerrok;
+ }
+break;
+case 9:
+#line 82 "varsyntax_calc1.y"
+ {
+ yyval.dval = dreg[yystack.l_mark[0].ival]; /* $$ & $1 are sufficient here*/
+ }
+break;
+case 10:
+#line 86 "varsyntax_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval + yystack.l_mark[0].dval;
+ }
+break;
+case 11:
+#line 90 "varsyntax_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval - yystack.l_mark[0].dval;
+ }
+break;
+case 12:
+#line 94 "varsyntax_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval * yystack.l_mark[0].dval;
+ }
+break;
+case 13:
+#line 98 "varsyntax_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-2].dval / yystack.l_mark[0].dval;
+ }
+break;
+case 14:
+#line 102 "varsyntax_calc1.y"
+ {
+ yyval.dval = -yystack.l_mark[0].dval;
+ }
+break;
+case 15:
+#line 106 "varsyntax_calc1.y"
+ {
+ yyval.dval = yystack.l_mark[-1].dval;
+ }
+break;
+case 16:
+#line 112 "varsyntax_calc1.y"
+ {
+ yyval.vval.hi = yyval.vval.lo = yystack.l_mark[0].dval;
+ }
+break;
+case 17:
+#line 116 "varsyntax_calc1.y"
+ {
+ yyval.vval.lo = yystack.l_mark[-3].dval;
+ yyval.vval.hi = yystack.l_mark[-1].dval;
+ if ( yyval.vval.lo > yyval.vval.hi )
+ {
+ (void) printf("interval out of order\n");
+ YYERROR;
+ }
+ }
+break;
+case 18:
+#line 126 "varsyntax_calc1.y"
+ {
+ yyval.vval = vreg[yystack.l_mark[0].ival];
+ }
+break;
+case 19:
+#line 130 "varsyntax_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].vval.hi + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo = yystack.l_mark[-2].vval.lo + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 20:
+#line 135 "varsyntax_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.hi;
+ yyval.vval.lo = yystack.l_mark[-2].dval + yystack.l_mark[0].vval.lo;
+ }
+break;
+case 21:
+#line 140 "varsyntax_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].vval.hi - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = yystack.l_mark[-2].vval.lo - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 22:
+#line 145 "varsyntax_calc1.y"
+ {
+ yyval.vval.hi = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = yystack.l_mark[-2].dval - yystack.l_mark[0].vval.hi;
+ }
+break;
+case 23:
+#line 150 "varsyntax_calc1.y"
+ {
+ yyval.vval = vmul( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 24:
+#line 154 "varsyntax_calc1.y"
+ {
+ yyval.vval = vmul (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
+ }
+break;
+case 25:
+#line 158 "varsyntax_calc1.y"
+ {
+ if (dcheck(yystack.l_mark[0].vval)) YYERROR;
+ yyval.vval = vdiv ( yystack.l_mark[-2].vval.lo, yystack.l_mark[-2].vval.hi, yystack.l_mark[0].vval );
+ }
+break;
+case 26:
+#line 163 "varsyntax_calc1.y"
+ {
+ if (dcheck ( yystack.l_mark[0].vval )) YYERROR;
+ yyval.vval = vdiv (yystack.l_mark[-2].dval, yystack.l_mark[-2].dval, yystack.l_mark[0].vval );
+ }
+break;
+case 27:
+#line 168 "varsyntax_calc1.y"
+ {
+ yyval.vval.hi = -yystack.l_mark[0].vval.lo;
+ yyval.vval.lo = -yystack.l_mark[0].vval.hi;
+ }
+break;
+case 28:
+#line 173 "varsyntax_calc1.y"
+ {
+ yyval.vval = yystack.l_mark[-1].vval;
+ }
+break;
+#line 1444 "varsyntax_calc1.tab.c"
+ default:
+ break;
+ }
+ yystack.s_mark -= yym;
+ yystate = *yystack.s_mark;
+ yystack.l_mark -= yym;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark -= yym;
+#endif
+ yym = yylhs[yyn];
+ if (yystate == 0 && yym == 0)
+ {
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[YYFINAL], yyval));
+#endif
+ fprintf(stderr, "shifting from state 0 to final state %d\n", YYFINAL);
+ }
+#endif
+ yystate = YYFINAL;
+ *++yystack.s_mark = YYFINAL;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ if (yychar < 0)
+ {
+#if YYBTYACC
+ do {
+ if (yylvp < yylve)
+ {
+ /* we're currently re-reading tokens */
+ yylval = *yylvp++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylloc = *yylpp++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ if (yyps->save)
+ {
+ /* in trial mode; save scanner results for future parse attempts */
+ if (yylvp == yylvlim)
+ { /* Enlarge lexical value queue */
+ int p = yylvp - yylvals;
+ int s = yylvlim - yylvals;
+
+ s += YYLVQUEUEGROWTH;
+ if ((yylexemes = (short *) realloc(yylexemes, s * sizeof(short))) == NULL)
+ goto yyenomem;
+ if ((yylvals = (YYSTYPE *) realloc(yylvals, s * sizeof(YYSTYPE))) == NULL)
+ goto yyenomem;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ if ((yylpsns = (YYLTYPE *) realloc(yylpsns, s * sizeof(YYLTYPE))) == NULL)
+ goto yyenomem;
+#endif
+ yylvp = yylve = yylvals + p;
+ yylvlim = yylvals + s;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpe = yylpsns + p;
+ yylplim = yylpsns + s;
+#endif
+ yylexp = yylexemes + p;
+ }
+ *yylexp = (short) YYLEX;
+ *yylvp++ = yylval;
+ yylve++;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *yylpp++ = yylloc;
+ yylpe++;
+#endif
+ yychar = *yylexp++;
+ break;
+ }
+ /* normal operation, no conflict encountered */
+#endif /* YYBTYACC */
+ yychar = YYLEX;
+#if YYBTYACC
+ } while (0);
+#endif /* YYBTYACC */
+ if (yychar < 0) yychar = YYEOF;
+ /* if ((yychar = YYLEX) < 0) yychar = YYEOF; */
+#if YYDEBUG
+ if (yydebug)
+ {
+ yys = yyname[YYTRANSLATE(yychar)];
+ fprintf(stderr, "%s[%d]: state %d, reading %d (%s)\n",
+ YYDEBUGSTR, yydepth, YYFINAL, yychar, yys);
+ }
+#endif
+ }
+ if (yychar == YYEOF) goto yyaccept;
+ goto yyloop;
+ }
+ if (((yyn = yygindex[yym]) != 0) && (yyn += yystate) >= 0 &&
+ yyn <= YYTABLESIZE && yycheck[yyn] == (YYINT) yystate)
+ yystate = yytable[yyn];
+ else
+ yystate = yydgoto[yym];
+#if YYDEBUG
+ if (yydebug)
+ {
+ fprintf(stderr, "%s[%d]: after reduction, ", YYDEBUGSTR, yydepth);
+#ifdef YYSTYPE_TOSTRING
+#if YYBTYACC
+ if (!yytrial)
+#endif /* YYBTYACC */
+ fprintf(stderr, "result is <%s>, ", YYSTYPE_TOSTRING(yystos[yystate], yyval));
+#endif
+ fprintf(stderr, "shifting from state %d to state %d\n", *yystack.s_mark, yystate);
+ }
+#endif
+ if (yystack.s_mark >= yystack.s_last && yygrowstack(&yystack) == YYENOMEM) goto yyoverflow;
+ *++yystack.s_mark = (short) yystate;
+ *++yystack.l_mark = yyval;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ *++yystack.p_mark = yyloc;
+#endif
+ goto yyloop;
+#if YYBTYACC
+
+ /* Reduction declares that this path is valid. Set yypath and do a full parse */
+yyvalid:
+ if (yypath) YYABORT;
+ while (yyps->save)
+ {
+ YYParseState *save = yyps->save;
+ yyps->save = save->save;
+ save->save = yypath;
+ yypath = save;
+ }
+#if YYDEBUG
+ if (yydebug)
+ fprintf(stderr, "%s[%d]: state %d, CONFLICT trial successful, backtracking to state %d, %d tokens\n",
+ YYDEBUGSTR, yydepth, yystate, yypath->state, (int)(yylvp - yylvals - yypath->lexeme));
+#endif
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ yylvp = yylvals + yypath->lexeme;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yylpp = yylpsns + yypath->lexeme;
+#endif
+ yylexp = yylexemes + yypath->lexeme;
+ yychar = YYEMPTY;
+ yystack.s_mark = yystack.s_base + (yypath->yystack.s_mark - yypath->yystack.s_base);
+ memcpy (yystack.s_base, yypath->yystack.s_base, (yystack.s_mark - yystack.s_base + 1) * sizeof(short));
+ yystack.l_mark = yystack.l_base + (yypath->yystack.l_mark - yypath->yystack.l_base);
+ memcpy (yystack.l_base, yypath->yystack.l_base, (yystack.l_mark - yystack.l_base + 1) * sizeof(YYSTYPE));
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ yystack.p_mark = yystack.p_base + (yypath->yystack.p_mark - yypath->yystack.p_base);
+ memcpy (yystack.p_base, yypath->yystack.p_base, (yystack.p_mark - yystack.p_base + 1) * sizeof(YYLTYPE));
+#endif
+ yystate = yypath->state;
+ goto yyloop;
+#endif /* YYBTYACC */
+
+yyoverflow:
+ YYERROR_CALL("yacc stack overflow");
+#if YYBTYACC
+ goto yyabort_nomem;
+yyenomem:
+ YYERROR_CALL("memory exhausted");
+yyabort_nomem:
+#endif /* YYBTYACC */
+ yyresult = 2;
+ goto yyreturn;
+
+yyabort:
+ yyresult = 1;
+ goto yyreturn;
+
+yyaccept:
+#if YYBTYACC
+ if (yyps->save) goto yyvalid;
+#endif /* YYBTYACC */
+ yyresult = 0;
+
+yyreturn:
+#if defined(YYDESTRUCT_CALL)
+ if (yychar != YYEOF && yychar != YYEMPTY)
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval, &yylloc);
+#else
+ YYDESTRUCT_CALL("cleanup: discarding token", yychar, &yylval);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+
+ {
+ YYSTYPE *pv;
+#if defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED)
+ YYLTYPE *pp;
+
+ for (pv = yystack.l_base, pp = yystack.p_base; pv <= yystack.l_mark; ++pv, ++pp)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv, pp);
+#else
+ for (pv = yystack.l_base; pv <= yystack.l_mark; ++pv)
+ YYDESTRUCT_CALL("cleanup: discarding state",
+ yystos[*(yystack.s_base + (pv - yystack.l_base))], pv);
+#endif /* defined(YYLTYPE) || defined(YYLTYPE_IS_DECLARED) */
+ }
+#endif /* defined(YYDESTRUCT_CALL) */
+
+#if YYBTYACC
+ if (yyerrctx)
+ {
+ yyFreeState(yyerrctx);
+ yyerrctx = NULL;
+ }
+ while (yyps)
+ {
+ YYParseState *save = yyps;
+ yyps = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+ while (yypath)
+ {
+ YYParseState *save = yypath;
+ yypath = save->save;
+ save->save = NULL;
+ yyFreeState(save);
+ }
+#endif /* YYBTYACC */
+ yyfreestack(&yystack);
+ return (yyresult);
+}
diff --git a/contrib/byacc/test/btyacc/varsyntax_calc1.tab.h b/contrib/byacc/test/btyacc/varsyntax_calc1.tab.h
new file mode 100644
index 000000000000..49e269cdb8a4
--- /dev/null
+++ b/contrib/byacc/test/btyacc/varsyntax_calc1.tab.h
@@ -0,0 +1,23 @@
+#ifndef _varsyntax_calc1__defines_h_
+#define _varsyntax_calc1__defines_h_
+
+#define DREG 257
+#define VREG 258
+#define CONST 259
+#define UMINUS 260
+#ifdef YYSTYPE
+#undef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+#endif
+#ifndef YYSTYPE_IS_DECLARED
+#define YYSTYPE_IS_DECLARED 1
+typedef union
+{
+ int ival; /* dreg & vreg array index values*/
+ double dval; /* floating point values*/
+ INTERVAL vval; /* interval values*/
+} YYSTYPE;
+#endif /* !YYSTYPE_IS_DECLARED */
+extern YYSTYPE varsyntax_calc1_lval;
+
+#endif /* _varsyntax_calc1__defines_h_ */