diff options
Diffstat (limited to 'test/rlhc.d/case/atoi2_crack.crk-K-F0--var-backend.in')
-rw-r--r-- | test/rlhc.d/case/atoi2_crack.crk-K-F0--var-backend.in | 178 |
1 files changed, 178 insertions, 0 deletions
diff --git a/test/rlhc.d/case/atoi2_crack.crk-K-F0--var-backend.in b/test/rlhc.d/case/atoi2_crack.crk-K-F0--var-backend.in new file mode 100644 index 00000000..a88e7d8a --- /dev/null +++ b/test/rlhc.d/case/atoi2_crack.crk-K-F0--var-backend.in @@ -0,0 +1,178 @@ +host( "working/atoi2_crack.rl", 1 ) @{// + // @@LANG: crack + // @@GENERATED: true + // + + import crack.io cout; + import crack.lang Buffer; + + int neg; + int value; + + + + + +}@ +array s8 _state_chart_actions( 0, 4 ) = { 0, 1, 0, 1, 2, 2, 0, 1, 2, 0, 2, 2, 3, 4, 0 }; + +array byte _state_chart_trans_keys( 0, 4 ) = { c(1), c(0), c(4), c(4), c(0), c(4), c(2), c(4), c(0) }; + +array s8 _state_chart_char_class( 0, 4 ) = { 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, 2, 1, 3, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 0 }; + +array s8 _state_chart_index_offsets( 0, 6 ) = { 0, 0, 1, 6, 0 }; + +array s8 _state_chart_indicies( 0, 5 ) = { 0, 2, 1, 1, 1, 0, 3, 4, 5, 0 }; + +array s8 _state_chart_index_defaults( 0, 1 ) = { 0, 1, 1, 1, 0 }; + +array s8 _state_chart_trans_cond_spaces( -1, 0 ) = { -1, -1, -1, -1, -1, -1, 0 }; + +array s8 _state_chart_cond_targs( 0, 3 ) = { 2, 0, 3, 1, 1, 2, 0 }; + +array s8 _state_chart_cond_actions( 0, 11 ) = { 3, 0, 11, 1, 5, 8, 0 }; + +array s8 _state_chart_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _state_chart_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0 }; + +array s8 _state_chart_nfa_push_actions( 0, 0 ) = { 0, 0 }; + +array s8 _state_chart_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + +value int state_chart_start = 3; +value int state_chart_first_final = 3; +value int state_chart_error = 0; + +value int state_chart_en_main = 3; + +host( "working/atoi2_crack.rl", 61 ) @{ + + void m( String s ) + { + byteptr data = s.buffer; + int p = 0; + int pe = s.size; + int cs; + String buffer; + value = 0; + neg = 0; + + }@ + { + cs = cast(int)state_chart_start; + } + host( "working/atoi2_crack.rl", 73 ) @{ + }@ + { + uint _trans = 0; + uint _have = 0; + uint _cont = 1; + index s8 _acts; + uint _nacts; + index byte _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( _state_chart_trans_keys, (cs<<1) ); + _inds = offset( _state_chart_indicies, _state_chart_index_offsets[cs] ); + + if ( ( deref( data, p )) <= 57 && ( deref( data, p )) >= 10 ) + { + int _ic = cast(int)_state_chart_char_class[cast(int)( deref( data, p )) - 10]; + if ( _ic <= cast(int)deref( _state_chart_trans_keys, _keys+1 ) && _ic >= cast(int)deref( _state_chart_trans_keys, _keys ) ) + _trans = cast(uint)deref( _state_chart_indicies, _inds + cast(int)( _ic - cast(int)deref( _state_chart_trans_keys, _keys ) ) ); + else + _trans = cast(uint)_state_chart_index_defaults[cs]; + } + else { + _trans = cast(uint)_state_chart_index_defaults[cs]; + } + + } + if ( _cont == 1 ) { + cs = cast(int)_state_chart_cond_targs[_trans]; + + if ( _state_chart_cond_actions[_trans] != 0 ) { + _acts = offset( _state_chart_actions, _state_chart_cond_actions[_trans] ); + _nacts = cast(uint)deref( _state_chart_actions, _acts ); + _acts += 1; + while ( _nacts > 0 ) + { + switch ( deref( _state_chart_actions, _acts ) ) + { + case 0 { + host( "working/atoi2_crack.rl", 15 ) ${neg = 0; + value = 0; + }$ + } + case 1 { + host( "working/atoi2_crack.rl", 19 ) ${neg = 1; + }$ + } + case 2 { + host( "working/atoi2_crack.rl", 22 ) ${value = value * 10 + ( int ( ={( deref( data, p ))}= - 48 ) ) + ; + }$ + } + case 3 { + host( "working/atoi2_crack.rl", 26 ) ${if ( neg != 0 ) + { + value = -1 * value; + + } + }$ + } + case 4 { + host( "working/atoi2_crack.rl", 52 ) ${cout.format( value ); + cout.format( "\n" ); + }$ + } + } + _nacts -= 1; + _acts += 1; + } + } + + if ( cs == 0 ) + _cont = 0; + if ( _cont == 1 ) + p += 1; + + }} + } + } + host( "working/atoi2_crack.rl", 74 ) @{ + + if ( cs >= state_chart_first_final ) { + cout `ACCEPT\n`; + } + else { + cout `FAIL\n`; + } + } + + void main() + { + m( "1\n" ); + m( "12\n" ); + m( "222222\n" ); + m( "+2123\n" ); + m( "213 3213\n" ); + m( "-12321\n" ); + m( "--123\n" ); + m( "-99\n" ); + m( " -3000\n" ); + } + + main(); +}@
\ No newline at end of file |