diff options
Diffstat (limited to 'test/rlhc.d/case/keller1.cpp-C-F0--var-backend.in')
-rw-r--r-- | test/rlhc.d/case/keller1.cpp-C-F0--var-backend.in | 764 |
1 files changed, 764 insertions, 0 deletions
diff --git a/test/rlhc.d/case/keller1.cpp-C-F0--var-backend.in b/test/rlhc.d/case/keller1.cpp-C-F0--var-backend.in new file mode 100644 index 00000000..1a824d0a --- /dev/null +++ b/test/rlhc.d/case/keller1.cpp-C-F0--var-backend.in @@ -0,0 +1,764 @@ +host( "working/keller1.rl", 1 ) @{/* + * @@LANG: c++ + */ + + /* + * Automatically generated by keller. Do not edit. + * + * Parts of this file are copied from Keller source covered by the GNU + * GPL. As a special exception, you may use the parts of this file copied + * from Keller source without restriction. The remainder is derived from + * "tmp.gmr" and inherits the copyright status of that file. + */ + + #line 1 "tmp.gmr" + #include <iostream> + using std::cout; + using std::endl; + + + #line 16 "tmp.rl" + enum token_type_e { + tt_id, + tt_equals, + tt_semi, + tt_pipe, + tt_amp, + tt_minus, + tt_dot, + tt_colon, + tt_percent, + tt_dollar, + tt_plus, + tt_number, + tt_star, + tt_question, + tt_not, + tt_andFSM, + tt_orFSM, + tt_open, + tt_close + }; + + struct LangEl + { + int line, lineEnd; + int pos; + + int type; + int state; + LangEl *prev, *next; + }; + + struct Token : public LangEl + { + const char *value; + }; + + struct Lel_start : public LangEl + { + #line 32 "tmp.gmr" + + int si; + #line 59 "tmp.rl" + }; + + struct Lel_M : public LangEl + { + #line 36 "tmp.gmr" + + int mi; + #line 67 "tmp.rl" + }; + + #define l__error 19 + #define l_tt_id 0 + #define l_tt_equals 1 + #define l_tt_semi 2 + #define l_tt_pipe 3 + #define l_tt_amp 4 + #define l_tt_minus 5 + #define l_tt_dot 6 + #define l_tt_colon 7 + #define l_tt_percent 8 + #define l_tt_dollar 9 + #define l_tt_plus 10 + #define l_tt_number 11 + #define l_tt_star 12 + #define l_tt_question 13 + #define l_tt_not 14 + #define l_tt_andFSM 15 + #define l_tt_orFSM 16 + #define l_tt_open 17 + #define l_tt_close 18 + #define l_start 23 + #define l_M 24 + #define l_A 25 + #define l_E 26 + #define l_T 27 + #define l_N 28 + #define l_K 29 + #define l_F 30 + #define l__start 31 + #define l__eof 20 + + struct LangEl; + + struct Parser + { + Parser(); + + void parseLangEl( LangEl *langEl ); + int done( ); + + void push( LangEl *lel ) { + lel->prev = stack; + stack = lel; + } + LangEl *pop() { + LangEl *ret = stack; + stack = stack->prev; + return ret; + } + int pop( int n ); + void rem( LangEl *lel, int n ); + LangEl *stack; + int next; + LangEl *redLel; + LangEl *rhs[10]; + + int cs; + + // Initialize the machine. Invokes any init statement blocks. Returns 0 + // if the machine begins in a non-accepting state and 1 if the machine + // begins in an accepting state. + int init( ); + + // Execute the machine on a block of data. Returns -1 if after processing + // the data, the machine is in the error state and can never accept, 0 if + // the machine is in a non-accepting state and 1 if the machine is in an + // accepting state. + int execute( LangEl *data, int len ); + + // Indicate that there is no more data. Returns -1 if the machine finishes + // in the error state and does not accept, 0 if the machine finishes + // in any other non-accepting state and 1 if the machine finishes in an + // accepting state. + int finish( ); + }; + + + + +}@ +array s8 _Parser_actions( 0, 49 ) = { 0, 1, 0, 4, 1, 5, 17, 13, 4, 1, 6, 19, 13, 4, 1, 8, 24, 13, 4, 1, 9, 27, 13, 4, 1, 10, 37, 13, 4, 1, 11, 41, 13, 4, 1, 12, 46, 13, 4, 1, 12, 47, 13, 4, 1, 12, 48, 13, 4, 2, 6, 18, 14, 4, 2, 9, 26, 14, 4, 2, 11, 38, 14, 4, 2, 11, 39, 14, 4, 2, 11, 40, 14, 4, 2, 11, 45, 14, 4, 3, 8, 21, 15, 4, 3, 8, 22, 15, 4, 3, 8, 23, 15, 4, 3, 9, 25, 15, 4, 3, 10, 28, 15, 4, 3, 10, 29, 15, 4, 3, 10, 30, 15, 4, 3, 11, 42, 15, 4, 3, 11, 43, 15, 4, 3, 11, 44, 15, 4, 3, 12, 49, 15, 4, 4, 7, 20, 16, 4, 4, 10, 31, 16, 4, 4, 10, 32, 16, 4, 4, 10, 33, 16, 4, 4, 10, 34, 16, 4, 4, 10, 35, 16, 4, 4, 10, 36, 16, 0 }; + +array char _Parser_trans_keys( 0, 28 ) = { 1, 0, 0, 23, 1, 1, 0, 28, 0, 18, 0, 28, 0, 18, 0, 18, 0, 28, 3, 18, 0, 28, 0, 28, 0, 28, 0, 18, 0, 10, 0, 18, 11, 11, 0, 18, 11, 11, 0, 18, 0, 10, 0, 18, 11, 11, 0, 18, 11, 11, 0, 18, 0, 10, 0, 18, 11, 11, 0, 18, 11, 11, 0, 18, 0, 18, 0, 18, 0, 18, 0, 18, 0, 18, 0, 18, 0, 18, 0, 28, 0, 28, 0, 28, 0, 28, 0, 18, 0, 28, 0, 18, 0, 18, 0, 18, 0, 18, 2, 5, 0, 20, 20, 20, 0, 23, 0, 20, 0, 20, 1, 0, 0 }; + +array s8 _Parser_char_class( 0, 28 ) = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 19, 19, 21, 22, 23, 24, 25, 26, 27, 28, 0 }; + +array s16 _Parser_index_offsets( 0, 966 ) = { 0, 0, 24, 25, 54, 73, 102, 121, 140, 169, 185, 214, 243, 272, 291, 302, 321, 322, 341, 342, 361, 372, 391, 392, 411, 412, 431, 442, 461, 462, 481, 482, 501, 520, 539, 558, 577, 596, 615, 634, 663, 692, 721, 750, 769, 798, 817, 836, 855, 874, 878, 899, 900, 924, 945, 966, 0 }; + +array s8 _Parser_indicies( 0, 87 ) = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 11, 12, 13, 14, 15, 16, 1, 16, 16, 16, 16, 16, 16, 16, 16, 16, 1, 16, 16, 16, 16, 16, 16, 16, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 17, 18, 1, 18, 18, 18, 18, 18, 18, 18, 18, 18, 1, 18, 18, 18, 18, 18, 18, 18, 19, 1, 19, 19, 19, 19, 19, 19, 19, 19, 19, 1, 19, 19, 19, 19, 19, 19, 19, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 20, 12, 13, 14, 15, 21, 22, 23, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 24, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 25, 13, 14, 15, 6, 1, 26, 26, 26, 26, 27, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 26, 1, 1, 1, 1, 1, 1, 1, 28, 14, 15, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 1, 29, 14, 15, 30, 1, 30, 30, 30, 30, 30, 31, 32, 33, 1, 1, 1, 1, 30, 30, 30, 30, 30, 34, 1, 1, 1, 1, 35, 1, 1, 1, 1, 36, 37, 1, 37, 37, 37, 37, 37, 37, 37, 37, 1, 1, 1, 1, 37, 37, 37, 37, 37, 38, 39, 1, 39, 39, 39, 39, 39, 39, 39, 39, 1, 1, 1, 1, 39, 39, 39, 39, 39, 40, 41, 1, 41, 41, 41, 41, 41, 41, 41, 41, 1, 1, 1, 1, 41, 41, 41, 41, 41, 42, 1, 1, 1, 1, 43, 1, 1, 1, 1, 44, 45, 1, 45, 45, 45, 45, 45, 45, 45, 45, 1, 1, 1, 1, 45, 45, 45, 45, 45, 46, 47, 1, 47, 47, 47, 47, 47, 47, 47, 47, 1, 1, 1, 1, 47, 47, 47, 47, 47, 48, 49, 1, 49, 49, 49, 49, 49, 49, 49, 49, 1, 1, 1, 1, 49, 49, 49, 49, 49, 50, 1, 1, 1, 1, 51, 1, 1, 1, 1, 52, 53, 1, 53, 53, 53, 53, 53, 53, 53, 53, 1, 1, 1, 1, 53, 53, 53, 53, 53, 54, 55, 1, 55, 55, 55, 55, 55, 55, 55, 55, 1, 1, 1, 1, 55, 55, 55, 55, 55, 56, 57, 1, 57, 57, 57, 57, 57, 57, 57, 57, 1, 1, 1, 1, 57, 57, 57, 57, 57, 58, 1, 58, 58, 58, 58, 58, 58, 58, 58, 1, 1, 1, 1, 58, 58, 58, 58, 58, 59, 1, 59, 59, 59, 59, 59, 59, 59, 59, 60, 1, 61, 62, 59, 59, 59, 59, 59, 63, 1, 63, 63, 63, 63, 63, 63, 63, 63, 1, 1, 1, 1, 63, 63, 63, 63, 63, 64, 1, 64, 64, 64, 64, 64, 64, 64, 64, 1, 1, 1, 1, 64, 64, 64, 64, 64, 65, 1, 65, 65, 65, 65, 65, 65, 65, 65, 1, 1, 1, 1, 65, 65, 65, 65, 65, 66, 1, 66, 66, 66, 66, 66, 31, 32, 33, 1, 1, 1, 1, 66, 66, 66, 66, 66, 67, 1, 67, 67, 67, 67, 67, 31, 32, 33, 1, 1, 1, 1, 67, 67, 67, 67, 67, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 68, 13, 14, 15, 6, 1, 69, 69, 69, 69, 27, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 69, 1, 1, 1, 1, 1, 1, 1, 28, 14, 15, 6, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 1, 1, 1, 1, 1, 1, 1, 70, 13, 14, 15, 6, 1, 71, 71, 71, 71, 27, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 71, 1, 1, 1, 1, 1, 1, 1, 28, 14, 15, 72, 1, 72, 72, 72, 72, 72, 72, 72, 72, 72, 1, 72, 72, 72, 72, 72, 72, 72, 6, 1, 73, 73, 73, 73, 27, 1, 1, 1, 1, 1, 1, 1, 7, 8, 9, 10, 73, 1, 1, 1, 1, 1, 1, 1, 28, 14, 15, 74, 1, 74, 74, 74, 74, 74, 74, 74, 74, 75, 1, 76, 77, 74, 74, 74, 74, 74, 78, 1, 78, 78, 78, 78, 78, 78, 78, 78, 1, 1, 1, 1, 78, 78, 78, 78, 78, 79, 1, 79, 79, 79, 79, 79, 79, 79, 79, 1, 1, 1, 1, 79, 79, 79, 79, 79, 80, 1, 80, 80, 80, 80, 80, 80, 80, 80, 1, 1, 1, 1, 80, 80, 80, 80, 80, 81, 21, 22, 23, 82, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 82, 83, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 84, 1, 1, 85, 86, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 86, 87, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 87, 0 }; + +array s8 _Parser_index_defaults( 0, 1 ) = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 }; + +array s8 _Parser_trans_cond_spaces( -1, 0 ) = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 }; + +array s8 _Parser_cond_targs( 0, 55 ) = { 2, 0, 51, 52, 54, 3, 4, 5, 6, 7, 8, 49, 44, 38, 32, 33, 55, 45, 55, 55, 9, 10, 39, 41, 43, 11, 55, 12, 37, 13, 55, 14, 20, 26, 15, 16, 18, 55, 17, 55, 19, 55, 21, 22, 24, 55, 23, 55, 25, 55, 27, 28, 30, 55, 29, 55, 31, 55, 55, 55, 34, 35, 36, 55, 55, 55, 55, 55, 40, 55, 42, 55, 55, 55, 55, 46, 47, 48, 55, 55, 55, 50, 55, 55, 55, 53, 55, 55, 0 }; + +array s16 _Parser_cond_actions( 0, 163 ) = { 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 43, 1, 33, 38, 1, 1, 1, 1, 1, 1, 78, 1, 1, 1, 93, 1, 1, 1, 1, 1, 1, 98, 1, 143, 1, 138, 1, 1, 1, 103, 1, 153, 1, 148, 1, 1, 1, 108, 1, 163, 1, 158, 23, 28, 1, 1, 1, 68, 58, 63, 53, 18, 1, 83, 1, 88, 128, 13, 73, 1, 1, 1, 123, 113, 118, 1, 133, 1, 3, 1, 48, 8, 0 }; + +array s8 _Parser_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _Parser_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +array s8 _Parser_nfa_push_actions( 0, 0 ) = { 0, 0 }; + +array s8 _Parser_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + +value int Parser_start = 1; +value int Parser_first_final = 55; +value int Parser_error = 0; + +value int Parser_en_main = 1; + +host( "working/keller1.rl", 756 ) @{ + + Parser::Parser( ) + { } + + int Parser::init( ) + { + }@ + { + cs = cast(int)Parser_start; + } + host( "working/keller1.rl", 763 ) @{ + return 0; + } + + int Parser::execute( LangEl *_data, int _len ) + { + LangEl *p = _data; + LangEl *pe = _data+_len; + }@ + { + int _ps; + uint _trans = 0; + uint _have = 0; + uint _cont = 1; + index s8 _acts; + uint _nacts; + index char _keys; + index s8 _inds; + while ( _cont == 1 ) { + + if ( cs == 0 ) + _cont = 0; + _have = 0; + if ( p == pe ) { + if ( _have == 0 ) + _cont = 0; + } + if ( _cont == 1 ) { + if ( _have == 0 ) { + _keys = offset( _Parser_trans_keys, (cs<<1) ); + _inds = offset( _Parser_indicies, _Parser_index_offsets[cs] ); + + if ( host( "-", 1 ) ={p->type}= <= 30 && host( "-", 1 ) ={p->type}= >= 0 ) + { + int _ic = cast(int)_Parser_char_class[cast(int)host( "-", 1 ) ={p->type}= - 0]; + if ( _ic <= cast(int)deref( _Parser_trans_keys, _keys+1 ) && _ic >= cast(int)deref( _Parser_trans_keys, _keys ) ) + _trans = cast(uint)deref( _Parser_indicies, _inds + cast(int)( _ic - cast(int)deref( _Parser_trans_keys, _keys ) ) ); + else + _trans = cast(uint)_Parser_index_defaults[cs]; + } + else { + _trans = cast(uint)_Parser_index_defaults[cs]; + } + + } + if ( _cont == 1 ) { + _ps = cs; + cs = cast(int)_Parser_cond_targs[_trans]; + + if ( _Parser_cond_actions[_trans] != 0 ) { + _acts = offset( _Parser_actions, _Parser_cond_actions[_trans] ); + _nacts = cast(uint)deref( _Parser_actions, _acts ); + _acts += 1; + while ( _nacts > 0 ) + { + switch ( deref( _Parser_actions, _acts ) ) + { + case 0 { + host( "working/keller1.rl", 156 ) ${ + p->state = ={_ps}=; + push( p ); + }$ + } + case 1 { + host( "working/keller1.rl", 161 ) ${ ${cs = host( "-", 1 ) ={pop(1)}=;}$ }$ + } + case 2 { + host( "working/keller1.rl", 162 ) ${ ${cs = host( "-", 1 ) ={pop(2)}=;}$ }$ + } + case 3 { + host( "working/keller1.rl", 163 ) ${ ${cs = host( "-", 1 ) ={pop(3)}=;}$ }$ + } + case 4 { + host( "working/keller1.rl", 164 ) ${ ${cs = host( "-", 1 ) ={pop(4)}=;}$ }$ + } + case 5 { + host( "working/keller1.rl", 171 ) ${ + redLel = new Lel_start(); + redLel->type = 23; + }$ + } + case 6 { + host( "working/keller1.rl", 176 ) ${ + redLel = new Lel_M(); + redLel->type = 24; + }$ + } + case 7 { + host( "working/keller1.rl", 181 ) ${ + redLel = new LangEl(); + redLel->type = 25; + }$ + } + case 8 { + host( "working/keller1.rl", 186 ) ${ + redLel = new LangEl(); + redLel->type = 26; + }$ + } + case 9 { + host( "working/keller1.rl", 191 ) ${ + redLel = new LangEl(); + redLel->type = 27; + }$ + } + case 10 { + host( "working/keller1.rl", 196 ) ${ + redLel = new LangEl(); + redLel->type = 28; + }$ + } + case 11 { + host( "working/keller1.rl", 201 ) ${ + redLel = new LangEl(); + redLel->type = 29; + }$ + } + case 12 { + host( "working/keller1.rl", 206 ) ${ + redLel = new LangEl(); + redLel->type = 30; + }$ + } + case 13 { + host( "working/keller1.rl", 226 ) ${ rem(p, 1); }$ + } + case 14 { + host( "working/keller1.rl", 227 ) ${ rem(p, 2); }$ + } + case 15 { + host( "working/keller1.rl", 228 ) ${ rem(p, 3); }$ + } + case 16 { + host( "working/keller1.rl", 229 ) ${ rem(p, 4); }$ + } + case 17 { + host( "working/keller1.rl", 232 ) ${ + #line 41 "tmp.gmr" + + cout << "start = M;" << endl; + static_cast<Lel_start*>(redLel)->si = static_cast<Lel_M*>(rhs[0])->mi; + + #line 214 "tmp.rl" + }$ + } + case 18 { + host( "working/keller1.rl", 242 ) ${ + #line 44 "tmp.gmr" + cout << "M = M A;" << endl; + #line 221 "tmp.rl" + }$ + } + case 19 { + host( "working/keller1.rl", 249 ) ${ + #line 45 "tmp.gmr" + cout << "M = A;" << endl; + #line 228 "tmp.rl" + }$ + } + case 20 { + host( "working/keller1.rl", 256 ) ${ + #line 46 "tmp.gmr" + cout << "A = tt_id tt_equals E tt_semi;" << endl; + #line 235 "tmp.rl" + }$ + } + case 21 { + host( "working/keller1.rl", 263 ) ${ + #line 47 "tmp.gmr" + cout << "E = E tt_pipe T;" << endl; + #line 242 "tmp.rl" + }$ + } + case 22 { + host( "working/keller1.rl", 270 ) ${ + #line 48 "tmp.gmr" + cout << "E = E tt_amp T;" << endl; + #line 249 "tmp.rl" + }$ + } + case 23 { + host( "working/keller1.rl", 277 ) ${ + #line 49 "tmp.gmr" + cout << "E = E tt_minus T;" << endl; + #line 256 "tmp.rl" + }$ + } + case 24 { + host( "working/keller1.rl", 284 ) ${ + #line 50 "tmp.gmr" + cout << "E = T;" << endl; + #line 263 "tmp.rl" + }$ + } + case 25 { + host( "working/keller1.rl", 291 ) ${ + #line 51 "tmp.gmr" + cout << "T = T tt_dot N;" << endl; + #line 270 "tmp.rl" + }$ + } + case 26 { + host( "working/keller1.rl", 298 ) ${ + #line 52 "tmp.gmr" + cout << "T = T N;" << endl; + #line 277 "tmp.rl" + }$ + } + case 27 { + host( "working/keller1.rl", 305 ) ${ + #line 53 "tmp.gmr" + cout << "T = N;" << endl; + #line 284 "tmp.rl" + }$ + } + case 28 { + host( "working/keller1.rl", 312 ) ${ + #line 54 "tmp.gmr" + cout << "N = N tt_colon tt_id;" << endl; + #line 291 "tmp.rl" + }$ + } + case 29 { + host( "working/keller1.rl", 319 ) ${ + #line 55 "tmp.gmr" + cout << "N = N tt_percent tt_id;" << endl; + #line 298 "tmp.rl" + }$ + } + case 30 { + host( "working/keller1.rl", 326 ) ${ + #line 56 "tmp.gmr" + cout << "N = N tt_dollar tt_id;" << endl; + #line 305 "tmp.rl" + }$ + } + case 31 { + host( "working/keller1.rl", 333 ) ${ + #line 57 "tmp.gmr" + cout << "N = N tt_colon tt_plus tt_number;" << endl; + #line 312 "tmp.rl" + }$ + } + case 32 { + host( "working/keller1.rl", 340 ) ${ + #line 58 "tmp.gmr" + cout << "N = N tt_colon tt_minus tt_number;" << endl; + #line 319 "tmp.rl" + }$ + } + case 33 { + host( "working/keller1.rl", 347 ) ${ + #line 59 "tmp.gmr" + cout << "N = N tt_percent tt_plus tt_number;" << endl; + #line 326 "tmp.rl" + }$ + } + case 34 { + host( "working/keller1.rl", 354 ) ${ + #line 60 "tmp.gmr" + cout << "N = N tt_percent tt_minus tt_number;" << endl; + #line 333 "tmp.rl" + }$ + } + case 35 { + host( "working/keller1.rl", 361 ) ${ + #line 61 "tmp.gmr" + cout << "N = N tt_dollar tt_plus tt_number;" << endl; + #line 340 "tmp.rl" + }$ + } + case 36 { + host( "working/keller1.rl", 368 ) ${ + #line 62 "tmp.gmr" + cout << "N = N tt_dollar tt_minus tt_number;" << endl; + #line 347 "tmp.rl" + }$ + } + case 37 { + host( "working/keller1.rl", 375 ) ${ + #line 63 "tmp.gmr" + cout << "N = K;" << endl; + #line 354 "tmp.rl" + }$ + } + case 38 { + host( "working/keller1.rl", 382 ) ${ + #line 64 "tmp.gmr" + cout << "K = F tt_star;" << endl; + #line 361 "tmp.rl" + }$ + } + case 39 { + host( "working/keller1.rl", 389 ) ${ + #line 65 "tmp.gmr" + cout << "K = F tt_question;" << endl; + #line 368 "tmp.rl" + }$ + } + case 40 { + host( "working/keller1.rl", 396 ) ${ + #line 66 "tmp.gmr" + cout << "K = F tt_plus;" << endl; + #line 375 "tmp.rl" + }$ + } + case 41 { + host( "working/keller1.rl", 403 ) ${ + #line 67 "tmp.gmr" + cout << "K = F;" << endl; + #line 382 "tmp.rl" + }$ + } + case 42 { + host( "working/keller1.rl", 410 ) ${ + #line 68 "tmp.gmr" + cout << "K = tt_not F tt_star;" << endl; + #line 389 "tmp.rl" + }$ + } + case 43 { + host( "working/keller1.rl", 417 ) ${ + #line 69 "tmp.gmr" + cout << "K = tt_not F tt_question;" << endl; + #line 396 "tmp.rl" + }$ + } + case 44 { + host( "working/keller1.rl", 424 ) ${ + #line 70 "tmp.gmr" + cout << "K = tt_not F tt_plus;" << endl; + #line 403 "tmp.rl" + }$ + } + case 45 { + host( "working/keller1.rl", 431 ) ${ + #line 71 "tmp.gmr" + cout << "K = tt_not F;" << endl; + #line 410 "tmp.rl" + }$ + } + case 46 { + host( "working/keller1.rl", 438 ) ${ + #line 72 "tmp.gmr" + cout << "F = tt_andFSM;" << endl; + #line 417 "tmp.rl" + }$ + } + case 47 { + host( "working/keller1.rl", 445 ) ${ + #line 73 "tmp.gmr" + cout << "F = tt_orFSM;" << endl; + #line 424 "tmp.rl" + }$ + } + case 48 { + host( "working/keller1.rl", 452 ) ${ + #line 74 "tmp.gmr" + cout << "F = tt_id;" << endl; + #line 431 "tmp.rl" + }$ + } + case 49 { + host( "working/keller1.rl", 459 ) ${ + #line 75 "tmp.gmr" + cout << "F = tt_open E tt_close;" << endl; + #line 438 "tmp.rl" + }$ + } + } + _nacts -= 1; + _acts += 1; + } + } + + if ( cs == 0 ) + _cont = 0; + if ( _cont == 1 ) + p += 1; + + }} + } + } + host( "working/keller1.rl", 771 ) @{ + if ( cs == Parser_error ) + return -1; + if ( cs >= Parser_first_final ) + return 1; + return 0; + } + + int Parser::finish( ) + { + if ( cs == Parser_error ) + return -1; + if ( cs >= Parser_first_final ) + return 1; + return 0; + } + + void Parser::parseLangEl( LangEl *lel ) + { + redLel = 0; + execute( lel, 1 ); + while ( redLel != 0 ) { + execute( redLel, 1 ); + redLel = 0; + execute( lel, 1 ); + } + } + + int Parser::pop( int n ) + { + for ( int i = n-1; i >= 0; i-- ) + rhs[i] = pop(); + return rhs[0]->state; + } + + void Parser::rem( LangEl *lel, int n ) + { + for ( int i = n-1; i >= 0; i-- ) + delete rhs[i]; + } + + int Parser::done( ) + { + Token *eof = new Token; + eof->type = l__eof; + eof->line = 0; + eof->pos = 0; + parseLangEl( eof ); + return finish(); + } + + #line 77 "tmp.gmr" + + + #include <assert.h> + #define MAX_TOKS 10000 + + struct TokList + { + TokList() : numToks(0) { } + + void append( int type ); + int parse(); + + Token *toks[MAX_TOKS]; + int numToks; + }; + + void TokList::append( int type ) + { + assert( numToks < MAX_TOKS ); + toks[numToks] = new Token; + toks[numToks]->type = type; + numToks += 1; + } + + int TokList::parse() + { + Parser parser; + parser.init(); + for ( int i = 0; i < numToks; i++ ) + parser.parseLangEl( toks[i] ); + return parser.done(); + } + + void test0() + { + TokList tokList; + tokList.append( tt_id ); + tokList.append( tt_equals ); + tokList.append( tt_id ); + tokList.append( tt_star ); + tokList.append( tt_minus ); + tokList.append( tt_andFSM ); + tokList.append( tt_dot ); + tokList.append( tt_id ); + tokList.append( tt_semi ); + tokList.append( tt_id ); + tokList.append( tt_equals ); + tokList.append( tt_id ); + tokList.append( tt_andFSM ); + tokList.append( tt_id ); + tokList.append( tt_semi ); + cout << tokList.parse() << endl; + } + + void test1() + { + TokList tokList; + tokList.append( tt_id ); + tokList.append( tt_equals ); + tokList.append( tt_open ); + tokList.append( tt_orFSM ); + tokList.append( tt_minus ); + tokList.append( tt_andFSM ); + tokList.append( tt_close ); + tokList.append( tt_star ); + tokList.append( tt_semi ); + cout << tokList.parse() << endl; + } + void test2() + { + TokList tokList; + tokList.append( tt_id ); + tokList.append( tt_equals ); + tokList.append( tt_not ); + tokList.append( tt_open ); + tokList.append( tt_orFSM ); + tokList.append( tt_minus ); + tokList.append( tt_not ); + tokList.append( tt_andFSM ); + tokList.append( tt_close ); + tokList.append( tt_star ); + tokList.append( tt_semi ); + cout << tokList.parse() << endl; + } + void test3() + { + TokList tokList; + tokList.append( tt_id ); + tokList.append( tt_equals ); + tokList.append( tt_id ); + tokList.append( tt_colon ); + tokList.append( tt_minus ); + tokList.append( tt_number ); + tokList.append( tt_id ); + tokList.append( tt_colon ); + tokList.append( tt_id ); + tokList.append( tt_id ); + tokList.append( tt_dollar ); + tokList.append( tt_plus ); + tokList.append( tt_number ); + tokList.append( tt_id ); + tokList.append( tt_percent ); + tokList.append( tt_minus ); + tokList.append( tt_number ); + tokList.append( tt_semi ); + cout << tokList.parse() << endl; + } + void test4() + { + TokList tokList; + tokList.append( tt_id ); + tokList.append( tt_equals ); + tokList.append( tt_id ); + tokList.append( tt_pipe ); + tokList.append( tt_id ); + tokList.append( tt_amp ); + tokList.append( tt_id ); + tokList.append( tt_minus ); + tokList.append( tt_id ); + tokList.append( tt_semi ); + cout << tokList.parse() << endl; + } + + int main() + { + test0(); + test1(); + test2(); + test3(); + test4(); + } + +}@
\ No newline at end of file |