diff options
Diffstat (limited to 'test/rlhc.d/case/cond7_cs.cs-A-G0--goto-backend.in')
-rw-r--r-- | test/rlhc.d/case/cond7_cs.cs-A-G0--goto-backend.in | 195 |
1 files changed, 195 insertions, 0 deletions
diff --git a/test/rlhc.d/case/cond7_cs.cs-A-G0--goto-backend.in b/test/rlhc.d/case/cond7_cs.cs-A-G0--goto-backend.in new file mode 100644 index 00000000..9a4d3346 --- /dev/null +++ b/test/rlhc.d/case/cond7_cs.cs-A-G0--goto-backend.in @@ -0,0 +1,195 @@ +host( "working/cond7_cs.rl", 1 ) @{/* + * @@LANG: csharp + * @@GENERATED: true + */ + + using System; + // Disables lots of warnings that appear in the test suite + #pragma warning disable 0168, 0169, 0219, 0162, 0414 + namespace Test { + class Test + { + int i; + int c; + + + + + }@ + array s8 _foo_actions( 0, 1 ) = { 0, 1, 0, 1, 1, 0 }; + + array s8 _foo_nfa_targs( 0, 0 ) = { 0, 0 }; + + array s8 _foo_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0 }; + + array s8 _foo_nfa_push_actions( 0, 0 ) = { 0, 0 }; + + array s8 _foo_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + + value int foo_start = 1; + value int foo_first_final = 4; + value int foo_error = 0; + + value int foo_en_main = 1; + + host( "working/cond7_cs.rl", 37 ) @{ + int cs; + + void init() + { + }@ + { + cs = cast(int)foo_start; + } + host( "working/cond7_cs.rl", 42 ) @{ + } + + 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; + }@ + { + index s8 _acts; + uint _nacts; + + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; + _resume: + switch ( cs ) { + case 1: + if ( c(48) <= ( deref( data, p )) && ( deref( data, p )) <= c(57) ) { + goto ctr0; + } + { + goto ctr1; + } + case 0: + goto _out; + case 2: + if ( c(48) <= ( deref( data, p )) && ( deref( data, p )) <= c(57) ) { + int ck = 0; + if ( host( "working/cond7_cs.rl", 18 ) ={i > 0}= ) ck += 1; + if ( ck > 0 ) { + goto ctr3; + } else { + goto ctr2; + } + + } + { + goto ctr1; + } + case 3: + if ( ( deref( data, p )) == c(10) ) { + int ck = 0; + if ( host( "working/cond7_cs.rl", 18 ) ={i > 0}= ) ck += 1; + if ( ck <= 0 ) { + goto ctr4; + } + goto ctr5; + + } + if ( c(48) <= ( deref( data, p )) && ( deref( data, p )) <= c(57) ) { + int ck = 0; + if ( host( "working/cond7_cs.rl", 18 ) ={i > 0}= ) ck += 1; + if ( 1 <= ck ) + { goto ctr6; + } + goto ctr5; + + } + { + goto ctr1; + } + case 4: + { + goto ctr1; + } + } + + ctr1: cs = 0; goto _again; + ctr0: cs = 2; goto f0; + ctr5: cs = 0; goto _again; + ctr3: cs = 2; goto f1; + ctr2: cs = 3; goto f0; + ctr6: cs = 3; goto f1; + ctr4: cs = 4; goto _again; + + f1: _acts = offset( _foo_actions, 1 ); goto execFuncs; + f0: _acts = offset( _foo_actions, 3 ); goto execFuncs; + + execFuncs: + _nacts = cast(uint)deref( _foo_actions, _acts ); + _acts += 1; + while ( _nacts > 0 ) { + switch ( deref( _foo_actions, _acts ) ) { + case 0{ + host( "working/cond7_cs.rl", 19 ) ${i = i - 1; + c = ( int ) ( ={( deref( data, p ))}= ) + ; + Console.Write( "item: " );Console.Write( c );Console.Write( "\n" );}$ + } + case 1{ + host( "working/cond7_cs.rl", 24 ) ${i = ( int ) ( ={( deref( data, p ))}= - 48 ) + ; + Console.Write( "count: " );Console.Write( i );Console.Write( "\n" );}$ + } + } + _acts += 1; + _nacts -= 1; + } + + goto _again; + + _again: + if ( cs == 0 ) + goto _out; + p += 1; + if ( p != pe ) + goto _resume; + _test_eof: {} + _out: {} + } + host( "working/cond7_cs.rl", 53 ) @{ + } + + void finish( ) + { + if ( cs >= foo_first_final ) + Console.WriteLine( "ACCEPT" ); + else + Console.WriteLine( "FAIL" ); + } + + static readonly string[] inp = { + "00\n", + "019\n", + "190\n", + "1719\n", + "1040000\n", + "104000a\n", + "104000\n", + }; + + + static readonly int inplen = 7; + + 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(); + } + } + } + } +}@
\ No newline at end of file |