diff options
Diffstat (limited to 'test/rlhc.d/case/scan1_go.go-Z-T1--var-backend.in')
-rw-r--r-- | test/rlhc.d/case/scan1_go.go-Z-T1--var-backend.in | 310 |
1 files changed, 310 insertions, 0 deletions
diff --git a/test/rlhc.d/case/scan1_go.go-Z-T1--var-backend.in b/test/rlhc.d/case/scan1_go.go-Z-T1--var-backend.in new file mode 100644 index 00000000..95942c73 --- /dev/null +++ b/test/rlhc.d/case/scan1_go.go-Z-T1--var-backend.in @@ -0,0 +1,310 @@ +host( "working/scan1_go.rl", 1 ) @{/* + * @@LANG: go + * @@GENERATED: true + */ + + package main + import "fmt" + + var ts int ; + var te int ; + var act int ; + var token int ; + + + + + var cs int; + var blen int; + var buffer [1024] byte; + +}@ +array s8 _scanner_key_offsets( 0, 23 ) = { 0, 0, 4, 5, 6, 7, 8, 14, 21, 22, 23, 0 }; + +array byte _scanner_trans_keys( 0, 120 ) = { u(46), u(100), u(48), u(57), u(49), u(120), u(120), u(120), u(46), u(49), u(50), u(100), u(48), u(57), u(10), u(97), u(98), u(99), u(100), u(48), u(57), u(98), u(100), u(46), u(100), u(48), u(57), u(0) }; + +array s8 _scanner_single_lengths( 0, 5 ) = { 0, 2, 1, 1, 1, 1, 4, 5, 1, 1, 2, 0 }; + +array s8 _scanner_range_lengths( 0, 1 ) = { 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0 }; + +array s8 _scanner_index_offsets( 0, 29 ) = { 0, 0, 4, 6, 8, 10, 12, 18, 25, 27, 29, 0 }; + +array s8 _scanner_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, 0 }; + +array s8 _scanner_trans_offsets( 0, 39 ) = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 0 }; + +array s8 _scanner_trans_lengths( 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, 0 }; + +array s8 _scanner_cond_keys( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 _scanner_cond_targs( 0, 10 ) = { 7, 1, 1, 7, 9, 0, 4, 7, 5, 7, 7, 7, 7, 10, 10, 1, 1, 0, 7, 7, 8, 2, 6, 1, 0, 8, 7, 3, 7, 7, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 0 }; + +array s8 _scanner_cond_actions( 0, 13 ) = { 2, 0, 0, 1, 3, 0, 0, 4, 0, 4, 5, 4, 2, 6, 7, 0, 0, 0, 10, 11, 0, 0, 0, 0, 0, 0, 12, 0, 13, 2, 0, 0, 1, 1, 4, 4, 4, 12, 13, 1, 0 }; + +array s8 _scanner_to_state_actions( 0, 8 ) = { 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 0 }; + +array s8 _scanner_from_state_actions( 0, 9 ) = { 0, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0 }; + +array s8 _scanner_eof_trans_indexed( 0, 15 ) = { 0, 8, 0, 10, 10, 10, 0, 0, 14, 15, 8, 0 }; + +array s8 _scanner_eof_trans_direct( 0, 40 ) = { 0, 34, 0, 35, 36, 37, 0, 0, 38, 39, 40, 0 }; + +array s8 _scanner_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _scanner_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +array s8 _scanner_nfa_push_actions( 0, 0 ) = { 0, 0 }; + +array s8 _scanner_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + +value int scanner_start = 7; +value int scanner_first_final = 7; +value int scanner_error = 0; + +value int scanner_en_main = 7; + +host( "working/scan1_go.rl", 56 ) @{ + + func prepare() { + }@ + { + cs = cast(int)scanner_start; + ts = nil; + te = nil; + act = 0; + } + host( "working/scan1_go.rl", 59 ) @{ + } + + func exec(data string) { + var p int = 0 + var pe int = len(data) + var eof int = pe + }@ + { + int _klen; + index byte _keys; + index s8 _ckeys; + int _cpc; + uint _trans; + uint _cond = 0; + uint _have = 0; + uint _cont = 1; + while ( _cont == 1 ) { + + if ( cs == 0 ) + _cont = 0; + _have = 0; + if ( p == pe ) { + if ( p == eof ) + { + if ( _scanner_eof_trans_direct[cs] > 0 ) { + _trans = cast(uint)_scanner_eof_trans_direct[cs] - 1; + _cond = cast(uint)_scanner_trans_offsets[_trans]; + _have = 1; + } + if ( _have == 0 ) { + } + } + + if ( _have == 0 ) + _cont = 0; + } + if ( _cont == 1 ) { + if ( _have == 0 ) { + switch ( _scanner_from_state_actions[cs] ) { + case 9 { + host( "NONE", 1 ) ${${ts = p;}$}$ + } + } + + _keys = offset( _scanner_trans_keys, _scanner_key_offsets[cs] ); + _trans = cast(uint)_scanner_index_offsets[cs]; + _have = 0; + + _klen = cast(int)_scanner_single_lengths[cs]; + if ( _klen > 0 ) { + index byte _lower; + index byte _mid; + index byte _upper; + _lower = _keys; + _upper = _keys + _klen - 1; + while ( _upper >= _lower && _have == 0 ) { + _mid = _lower + ((_upper-_lower) >> 1); + if ( ( deref( data, p )) < deref( _scanner_trans_keys, _mid ) ) + _upper = _mid - 1; + else if ( ( deref( data, p )) > deref( _scanner_trans_keys, _mid ) ) + _lower = _mid + 1; + else { + _trans += cast(uint)(_mid - _keys); + _have = 1; + } + } + if ( _have == 0 ) { + _keys += _klen; + _trans += cast(uint)_klen; + } + } + + if ( _have == 0 ) { + _klen = cast(int)_scanner_range_lengths[cs]; + if ( _klen > 0 ) { + index byte _lower; + index byte _mid; + index byte _upper; + _lower = _keys; + _upper = _keys + (_klen<<1) - 2; + while ( _have == 0 && _lower <= _upper ) { + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( ( deref( data, p )) < deref( _scanner_trans_keys, _mid ) ) + _upper = _mid - 2; + else if ( ( deref( data, p )) > deref( _scanner_trans_keys, _mid + 1 ) ) + _lower = _mid + 2; + else { + _trans += cast(uint)((_mid - _keys)>>1); + _have = 1; + } + } + if ( _have == 0 ) + _trans += cast(uint)_klen; + } + } + + _ckeys = offset( _scanner_cond_keys, _scanner_trans_offsets[_trans] ); + _klen = cast(int)_scanner_trans_lengths[_trans]; + _cond = cast(uint)_scanner_trans_offsets[_trans]; + _have = 0; + + _cpc = 0; + { + index s8 _lower; + index s8 _mid; + index s8 _upper; + _lower = _ckeys; + _upper = _ckeys + _klen - 1; + while ( _have == 0 && _lower <= _upper ) { + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < cast(int)deref( _scanner_cond_keys, _mid ) ) + _upper = _mid - 1; + else if ( _cpc > cast(int)deref( _scanner_cond_keys, _mid ) ) + _lower = _mid + 1; + else { + _cond += cast(uint)(_mid - _ckeys); + _have = 1; + } + } + if ( _have == 0 ) { + cs = 0; + _cont = 0; + } + } + } + if ( _cont == 1 ) { + cs = cast(int)_scanner_cond_targs[_cond]; + + switch ( _scanner_cond_actions[_cond] ) { + case 3 { + host( "NONE", 1 ) ${${te = p+1;}$}$ + } + case 11 { + host( "working/scan1_go.rl", 20 ) ${${te = p+1;host( "working/scan1_go.rl", 20 ) ${fmt.Print( "on last " );if ( p + 1 == te ) { + fmt.Print( "yes" ); + } + fmt.Print( "\n" );}$}$}$ + } + case 5 { + host( "working/scan1_go.rl", 30 ) ${${te = p+1;host( "working/scan1_go.rl", 30 ) ${fmt.Print( "on lag " );if ( p + 1 == te ) { + fmt.Print( "yes" ); + } + fmt.Print( "\n" );}$}$}$ + } + case 2 { + host( "working/scan1_go.rl", 44 ) ${${te = p+1;}$}$ + } + case 10 { + host( "working/scan1_go.rl", 46 ) ${${te = p+1;}$}$ + } + case 12 { + host( "working/scan1_go.rl", 25 ) ${${te = p;p = p - 1;host( "working/scan1_go.rl", 25 ) ${fmt.Print( "on next " );if ( p + 1 == te ) { + fmt.Print( "yes" ); + } + fmt.Print( "\n" );}$}$}$ + } + case 13 { + host( "working/scan1_go.rl", 30 ) ${${te = p;p = p - 1;host( "working/scan1_go.rl", 30 ) ${fmt.Print( "on lag " );if ( p + 1 == te ) { + fmt.Print( "yes" ); + } + fmt.Print( "\n" );}$}$}$ + } + case 4 { + host( "working/scan1_go.rl", 30 ) ${${p = ((te))-1; + host( "working/scan1_go.rl", 30 ) ${fmt.Print( "on lag " );if ( p + 1 == te ) { + fmt.Print( "yes" ); + } + fmt.Print( "\n" );}$}$}$ + } + case 1 { + host( "NONE", 1 ) ${${switch( act ) { + case 0 { + host( "NONE", 1 ) ${${cs = 0;}$}$ } + case 4 { + p = ((te))-1; + host( "working/scan1_go.rl", 35 ) ${fmt.Print( "lm switch1 " );if ( p + 1 == te ) { + fmt.Print( "yes" ); + } + fmt.Print( "\n" );}$ } + case 5 { + p = ((te))-1; + host( "working/scan1_go.rl", 39 ) ${fmt.Print( "lm switch2 " );if ( p + 1 == te ) { + fmt.Print( "yes" ); + } + fmt.Print( "\n" );}$ } + }}$ + }$ + } + case 6 { + host( "NONE", 1 ) ${${te = p+1;}$}$ + host( "working/scan1_go.rl", 35 ) ${${act = 4;}$}$ + } + case 7 { + host( "NONE", 1 ) ${${te = p+1;}$}$ + host( "working/scan1_go.rl", 39 ) ${${act = 5;}$}$ + } + } + + switch ( _scanner_to_state_actions[cs] ) { + case 8 { + host( "NONE", 1 ) ${${ts = nil;}$}$ + host( "NONE", 1 ) ${${act = 0;}$}$ + } + } + + if ( cs == 0 ) + _cont = 0; + if ( _cont == 1 ) + p += 1; + + }} + } + } + host( "working/scan1_go.rl", 66 ) @{ + } + func finish() { + if cs >= scanner_first_final { + fmt.Println("ACCEPT") + } else { + fmt.Println("FAIL") + } + } + var inp []string = []string { + "abbc1d1d2\n", + }; + + func main() { + for _, data := range inp { + prepare() + exec(data) + finish() + } + } +}@
\ No newline at end of file |