diff options
Diffstat (limited to 'test/rlhc.d/case/gotocallret2_cs.cs-A-T1--goto-backend.exp')
-rw-r--r-- | test/rlhc.d/case/gotocallret2_cs.cs-A-T1--goto-backend.exp | 437 |
1 files changed, 437 insertions, 0 deletions
diff --git a/test/rlhc.d/case/gotocallret2_cs.cs-A-T1--goto-backend.exp b/test/rlhc.d/case/gotocallret2_cs.cs-A-T1--goto-backend.exp new file mode 100644 index 00000000..ebc34340 --- /dev/null +++ b/test/rlhc.d/case/gotocallret2_cs.cs-A-T1--goto-backend.exp @@ -0,0 +1,437 @@ +using System; +// Disables lots of warnings that appear in the test suite +#pragma warning disable 0168, 0169, 0219, 0162, 0414 +namespace Test { + class Test + { + char comm; + int top; + int [] stack = new int [32]; + int ts; + int te; + int act; + int val; + + + + + static readonly sbyte []_GotoCallRet_key_offsets = { 0, 0, 1, 2, 3, 4, 4, 10, 13, 15, 15, 21, 23, 24, 30, 31, 0, }; + static readonly char []_GotoCallRet_trans_keys = { '\u0066', '\u006f', '\u0069', '\u006c', '\u000a', '\u0020', '\u005b', '\u007b', '\u0061', '\u007a', '\u0020', '\u0061', '\u007a', '\u0061', '\u007a', '\u0020', '\u005b', '\u007b', '\u007d', '\u0061', '\u007a', '\u0061', '\u007a', '\u0020', '\u0020', '\u005b', '\u005d', '\u007b', '\u0061', '\u007a', '\u0020', '\u0061', '\u007a', '\u0000', }; + static readonly sbyte []_GotoCallRet_single_lengths = { 0, 1, 1, 1, 1, 0, 4, 1, 0, 0, 4, 0, 1, 4, 1, 0, 0, }; + static readonly sbyte []_GotoCallRet_range_lengths = { 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 1, 0, }; + static readonly sbyte []_GotoCallRet_index_offsets = { 0, 0, 2, 4, 6, 8, 9, 15, 18, 20, 21, 27, 29, 31, 37, 39, 0, }; + static readonly sbyte []_GotoCallRet_trans_cond_spaces = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -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, }; + static readonly sbyte []_GotoCallRet_trans_offsets = { 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, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 0, }; + static readonly sbyte []_GotoCallRet_trans_lengths = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, }; + static readonly sbyte []_GotoCallRet_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, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + static readonly sbyte []_GotoCallRet_cond_targs = { 2, 6, 3, 6, 4, 6, 6, 6, 9, 6, 6, 6, 6, 7, 0, 1, 8, 6, 8, 6, 0, 10, 10, 10, 12, 11, 0, 11, 10, 12, 10, 13, 13, 14, 13, 15, 0, 14, 13, 15, 13, 6, 6, 6, 6, 6, 6, 10, 10, 13, 13, 0, }; + static readonly sbyte []_GotoCallRet_cond_actions = { 0, 1, 0, 1, 0, 1, 2, 1, 4, 6, 7, 8, 10, 9, 0, 0, 0, 11, 0, 11, 0, 12, 13, 14, 0, 0, 0, 0, 15, 0, 16, 17, 18, 0, 19, 0, 0, 0, 20, 0, 21, 1, 1, 1, 1, 11, 11, 15, 16, 20, 21, 0, }; + static readonly sbyte []_GotoCallRet_to_state_actions = { 0, 0, 0, 0, 0, 3, 3, 0, 0, 0, 3, 0, 0, 3, 0, 0, 0, }; + static readonly sbyte []_GotoCallRet_from_state_actions = { 0, 0, 0, 0, 0, 0, 5, 0, 0, 0, 5, 0, 0, 5, 0, 0, 0, }; + static readonly sbyte []_GotoCallRet_eof_trans_indexed = { 0, 6, 6, 6, 6, 0, 0, 12, 12, 0, 0, 19, 20, 0, 26, 27, 0, }; + static readonly sbyte []_GotoCallRet_eof_trans_direct = { 0, 42, 43, 44, 45, 0, 0, 46, 47, 0, 0, 48, 49, 0, 50, 51, 0, }; + static readonly sbyte []_GotoCallRet_nfa_targs = { 0, 0, }; + static readonly sbyte []_GotoCallRet_nfa_offsets = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; + static readonly sbyte []_GotoCallRet_nfa_push_actions = { 0, 0, }; + static readonly sbyte []_GotoCallRet_nfa_pop_trans = { 0, 0, }; + static readonly int GotoCallRet_start = 6; + static readonly int GotoCallRet_first_final = 6; + static readonly int GotoCallRet_error = 0; + static readonly int GotoCallRet_en_handle = 5; + static readonly int GotoCallRet_en_one = 10; + static readonly int GotoCallRet_en_two = 13; + static readonly int GotoCallRet_en_main = 6; + int cs; + + void init() + { + + { + cs = (int)GotoCallRet_start; + top = 0; + ts = 0; + te = 0; + } + } + + void exec( char[] data, int len ) + { + int p = 0; + int pe = len; + int eof = len; + string _s; + char [] buffer = new char [1024]; + int blen = 0; + + { + int _klen; + int _keys; + int _ckeys; + int _cpc; + uint _trans = 0; + uint _cond = 0; + if ( p == pe ) + goto _test_eof; + + if ( cs == 0 ) + goto _out; + + _resume : + switch ( _GotoCallRet_from_state_actions[cs] ) { + case 5: + {{ts = p; + }} + + break; + + } + _keys = _GotoCallRet_key_offsets[cs] ; + _trans = (uint )_GotoCallRet_index_offsets[cs]; + _klen = (int)_GotoCallRet_single_lengths[cs]; + if ( _klen > 0 ) + { + int _lower; + int _mid; + int _upper; + _lower = _keys; + _upper = _keys + _klen - 1; + while ( true ) + { + if ( _upper < _lower ) + break; + + + _mid = _lower + ((_upper-_lower) >> 1); + if ( ( data[p ]) < _GotoCallRet_trans_keys[_mid ] ) + _upper = _mid - 1; + + else if ( ( data[p ]) > _GotoCallRet_trans_keys[_mid ] ) + _lower = _mid + 1; + + else + { + _trans += (uint )(_mid - _keys); + goto _match; + } + + } + + _keys += _klen; + _trans += (uint )_klen; + } + + + _klen = (int)_GotoCallRet_range_lengths[cs]; + if ( _klen > 0 ) + { + int _lower; + int _mid; + int _upper; + _lower = _keys; + _upper = _keys + (_klen<<1) - 2; + while ( true ) + { + if ( _upper < _lower ) + break; + + + _mid = _lower + (((_upper-_lower) >> 1) & ~1); + if ( ( data[p ]) < _GotoCallRet_trans_keys[_mid ] ) + _upper = _mid - 2; + + else if ( ( data[p ]) > _GotoCallRet_trans_keys[_mid + 1] ) + _lower = _mid + 2; + + else + { + _trans += (uint )((_mid - _keys)>>1); + goto _match; + } + + } + + _trans += (uint )_klen; + } + + + + _match : + _ckeys = _GotoCallRet_trans_offsets[_trans] ; + _klen = (int)_GotoCallRet_trans_lengths[_trans]; + _cond = (uint )_GotoCallRet_trans_offsets[_trans]; + _cpc = 0; + { + int _lower; + int _mid; + int _upper; + _lower = _ckeys; + _upper = _ckeys + _klen - 1; + while ( true ) + { + if ( _upper < _lower ) + break; + + + _mid = _lower + ((_upper-_lower) >> 1); + if ( _cpc < (int)_GotoCallRet_cond_keys[_mid ] ) + _upper = _mid - 1; + + else if ( _cpc > (int)_GotoCallRet_cond_keys[_mid ] ) + _lower = _mid + 1; + + else + { + _cond += (uint )(_mid - _ckeys); + goto _match_cond; + } + + } + + cs = 0; + goto _again; + } + + _match_cond : + cs = (int)_GotoCallRet_cond_targs[_cond]; + if ( _GotoCallRet_cond_actions[_cond] == 0 ) + goto _again; + + + switch ( _GotoCallRet_cond_actions[_cond] ) { + case 4: + {Console.Write( "handle " );{p = p - 1; + }if ( val == 1 ) + { + {cs = (10); + } + } + if ( val == 2 ) + { + {cs = (13); + } + } + if ( val == 3 ) + { + {cs = 6; + }} + } + + break; + case 9: + {{te = p+1; + }} + + break; + case 14: + {{te = p+1; + {Console.Write( "{ " );{stack[top] = cs; + top += 1; + cs = (10); + goto _again;}} + }} + + break; + case 13: + {{te = p+1; + {Console.Write( "[ " );{stack[top] = cs; + top += 1; + cs = (13); + goto _again;}} + }} + + break; + case 12: + {{te = p+1; + {Console.Write( "space " );} + }} + + break; + case 16: + {{te = p; + p = p - 1; + {Console.Write( "} " );{top-= 1; + cs = stack[top]; + goto _again;}} + }} + + break; + case 15: + {{te = p; + p = p - 1; + {Console.Write( "word " );val = 1; + {cs = (5); + goto _again;}} + }} + + break; + case 19: + {{te = p+1; + {Console.Write( "{ " );{stack[top] = cs; + top += 1; + cs = (10); + goto _again;}} + }} + + break; + case 18: + {{te = p+1; + {Console.Write( "[ " );{stack[top] = cs; + top += 1; + cs = (13); + goto _again;}} + }} + + break; + case 17: + {{te = p+1; + {Console.Write( "space " );} + }} + + break; + case 20: + {{te = p; + p = p - 1; + {Console.Write( "] " );{top-= 1; + cs = stack[top]; + goto _again;}} + }} + + break; + case 21: + {{te = p; + p = p - 1; + {Console.Write( "word " );val = 2; + {cs = (5); + goto _again;}} + }} + + break; + case 10: + {{te = p+1; + {Console.Write( "{ " );{stack[top] = cs; + top += 1; + cs = 10; + goto _again;}} + }} + + break; + case 8: + {{te = p+1; + {Console.Write( "[ " );{stack[top] = cs; + top += 1; + cs = 13; + goto _again;}} + }} + + break; + case 2: + {{te = p+1; + {Console.Write( "this is the foil" );} + }} + + break; + case 7: + {{te = p+1; + {Console.Write( "space " );} + }} + + break; + case 6: + {{te = p+1; + }} + + break; + case 11: + {{te = p; + p = p - 1; + {Console.Write( "word " );val = 3; + {cs = 5; + goto _again;}} + }} + + break; + case 1: + {{p = ((te))-1; + {Console.Write( "word " );val = 3; + {cs = 5; + goto _again;}} + }} + + break; + + } + + _again : + switch ( _GotoCallRet_to_state_actions[cs] ) { + case 3: + {{ts = 0; + }} + + break; + + } + if ( cs == 0 ) + goto _out; + + p += 1; + if ( p != pe ) + goto _resume; + + + _test_eof : + {} + if ( p == eof ) + { + if ( _GotoCallRet_eof_trans_direct[cs] > 0 ) + { + _trans = (uint )_GotoCallRet_eof_trans_direct[cs] - 1; + _cond = (uint )_GotoCallRet_trans_offsets[_trans]; + goto _match_cond; + } + + } + + + + _out : + {} + + } + } + + void finish( ) + { + if ( cs >= GotoCallRet_first_final ) + Console.WriteLine( "ACCEPT" ); + else + Console.WriteLine( "FAIL" ); + } + + static readonly string[] inp = { + "{a{b[c d]d}c}\n", + "[a{b[c d]d}c}\n", + "[a[b]c]d{ef{g{h}i}j}l\n", + "{{[]}}\n", + "a b c\n", + "{a b c}\n", + "[a b c]\n", + "{]\n", + "{{}\n", + "[[[[[[]]]]]]\n", + "[[[[[[]]}]]]\n", + }; + + + static readonly int inplen = 11; + + public static void Main (string[] args) + { + Test machine = new Test(); + for ( int i = 0; i < inplen; i++ ) { + machine.init(); + machine.exec( inp[i].ToCharArray(), inp[i].Length ); + machine.finish(); + } + } + } +} |