summaryrefslogtreecommitdiff
path: root/test/rlhc.d/case/fnext1.c-C-T1--goto-backend.in
diff options
context:
space:
mode:
Diffstat (limited to 'test/rlhc.d/case/fnext1.c-C-T1--goto-backend.in')
-rw-r--r--test/rlhc.d/case/fnext1.c-C-T1--goto-backend.in269
1 files changed, 269 insertions, 0 deletions
diff --git a/test/rlhc.d/case/fnext1.c-C-T1--goto-backend.in b/test/rlhc.d/case/fnext1.c-C-T1--goto-backend.in
new file mode 100644
index 00000000..a310acee
--- /dev/null
+++ b/test/rlhc.d/case/fnext1.c-C-T1--goto-backend.in
@@ -0,0 +1,269 @@
+host( "working/fnext1.rl", 1 ) @{/*
+ * @@LANG: c
+ * @@PROHIBIT_FEATFLAGS: --var-backend
+ *
+ * Tests fnext in combination with fbreak.
+ */
+
+ #include <string.h>
+ #include <stdio.h>
+
+ char comm;
+ int top;
+ int stack [32];
+
+
+
+ int cs;
+ char *ts, *te;
+ int act;
+
+}@
+array s8 _fnext_key_offsets( 0, 6 ) = { 0, 0, 1, 2, 3, 4, 5, 5, 5, 5, 6, 0 };
+
+array char _fnext_trans_keys( 0, 111 ) = { 104, 101, 108, 108, 10, 111, 0 };
+
+array s8 _fnext_single_lengths( 0, 1 ) = { 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0 };
+
+array s8 _fnext_range_lengths( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+array s8 _fnext_index_offsets( 0, 15 ) = { 0, 0, 2, 4, 6, 8, 10, 11, 12, 13, 15, 0 };
+
+array s8 _fnext_trans_cond_spaces( -1, 0 ) = { -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0 };
+
+array s8 _fnext_trans_offsets( 0, 15 ) = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 };
+
+array s8 _fnext_trans_lengths( 0, 1 ) = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0 };
+
+array s8 _fnext_cond_keys( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+array s8 _fnext_cond_targs( 0, 10 ) = { 6, 0, 7, 0, 4, 0, 8, 0, 10, 0, 0, 0, 0, 9, 0, 0, 0 };
+
+array s8 _fnext_cond_actions( 0, 8 ) = { 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 0, 0, 0, 8, 0, 0, 0 };
+
+array s8 _fnext_to_state_actions( 0, 1 ) = { 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0 };
+
+array s8 _fnext_from_state_actions( 0, 7 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0 };
+
+array s8 _fnext_nfa_targs( 0, 0 ) = { 0, 0 };
+
+array s8 _fnext_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+
+array s8 _fnext_nfa_push_actions( 0, 0 ) = { 0, 0 };
+
+array s8 _fnext_nfa_pop_trans( 0, 0 ) = { 0, 0 };
+
+value int fnext_start = 1;
+value int fnext_first_final = 6;
+value int fnext_error = 0;
+
+value int fnext_en_main = 1;
+value int fnext_en_e = 2;
+value int fnext_en_l = 3;
+value int fnext_en_o = 9;
+value int fnext_en_nl = 5;
+
+host( "working/fnext1.rl", 31 ) @{
+
+ void init()
+ {
+ }@
+ {
+ cs = cast(int)fnext_start;
+ ts = nil;
+ te = nil;
+ }
+ host( "working/fnext1.rl", 35 ) @{
+ }
+
+ void exec( char *data, int len )
+ {
+ char *p = data;
+ char *pe = data + len;
+
+ while ( cs != fnext_error && p < pe ) {
+ printf( "%c\n", *p );
+ }@
+ {
+ int _klen;
+ index char _keys;
+ index s8 _ckeys;
+ int _cpc;
+ uint _trans = 0;
+ uint _cond = 0;
+ entry {
+
+ if ( p == pe )
+ goto _test_eof;
+ if ( cs == 0 )
+ goto _out;
+ label _resume {
+ switch ( _fnext_from_state_actions[cs] ) {
+ case 7 {
+ host( "NONE", 1 ) ${${ts = p;}$}$
+ }
+ }
+
+ _keys = offset( _fnext_trans_keys, _fnext_key_offsets[cs] );
+ _trans = cast(uint)_fnext_index_offsets[cs];
+
+ _klen = cast(int)_fnext_single_lengths[cs];
+ if ( _klen > 0 ) {
+ index char _lower;
+ index char _mid;
+ index char _upper;
+ _lower = _keys;
+ _upper = _keys + _klen - 1;
+ while ( TRUE ) {
+ if ( _upper < _lower )
+ break;
+
+ _mid = _lower + ((_upper-_lower) >> 1);
+ if ( ( deref( data, p )) < deref( _fnext_trans_keys, _mid ) )
+ _upper = _mid - 1;
+ else if ( ( deref( data, p )) > deref( _fnext_trans_keys, _mid ) )
+ _lower = _mid + 1;
+ else {
+ _trans += cast(uint)(_mid - _keys);
+ goto _match;
+ }
+ }
+ _keys += _klen;
+ _trans += cast(uint)_klen;
+ }
+
+ _klen = cast(int)_fnext_range_lengths[cs];
+ if ( _klen > 0 ) {
+ index char _lower;
+ index char _mid;
+ index char _upper;
+ _lower = _keys;
+ _upper = _keys + (_klen<<1) - 2;
+ while ( TRUE ) {
+ if ( _upper < _lower )
+ break;
+
+ _mid = _lower + (((_upper-_lower) >> 1) & ~1);
+ if ( ( deref( data, p )) < deref( _fnext_trans_keys, _mid ) )
+ _upper = _mid - 2;
+ else if ( ( deref( data, p )) > deref( _fnext_trans_keys, _mid + 1 ) )
+ _lower = _mid + 2;
+ else {
+ _trans += cast(uint)((_mid - _keys)>>1);
+ goto _match;
+ }
+ }
+ _trans += cast(uint)_klen;
+ }
+
+ }
+ label _match {
+ _ckeys = offset( _fnext_cond_keys, _fnext_trans_offsets[_trans] );
+ _klen = cast(int)_fnext_trans_lengths[_trans];
+ _cond = cast(uint)_fnext_trans_offsets[_trans];
+
+ _cpc = 0;
+ {
+ index s8 _lower;
+ index s8 _mid;
+ index s8 _upper;
+ _lower = _ckeys;
+ _upper = _ckeys + _klen - 1;
+ while ( TRUE ) {
+ if ( _upper < _lower )
+ break;
+
+ _mid = _lower + ((_upper-_lower) >> 1);
+ if ( _cpc < cast(int)deref( _fnext_cond_keys, _mid ) )
+ _upper = _mid - 1;
+ else if ( _cpc > cast(int)deref( _fnext_cond_keys, _mid ) )
+ _lower = _mid + 1;
+ else {
+ _cond += cast(uint)(_mid - _ckeys);
+ goto _match_cond;
+ }
+ }
+ cs = 0;
+ goto _again;
+ }
+ }
+ label _match_cond {
+ cs = cast(int)_fnext_cond_targs[_cond];
+
+ if ( _fnext_cond_actions[_cond] == 0 )
+ goto _again;
+
+ switch ( _fnext_cond_actions[_cond] ) {
+ case 2 {
+ host( "working/fnext1.rl", 19 ) ${ /*h*/ ${cs = 2;}$${p+= 1; goto _out; }$ }$
+ }
+ case 4 {
+ host( "working/fnext1.rl", 21 ) ${ ${p+= 1; goto _out; }$ }$
+ }
+ case 6 {
+ host( "working/fnext1.rl", 23 ) ${ /*nl*/ ${p+= 1; goto _out; }$ printf("ACCEPT\n"); }$
+ }
+ case 8 {
+ host( "working/fnext1.rl", 22 ) ${${te = p+1;host( "working/fnext1.rl", 22 ) ${ /*o*/ ${cs = 5;}$${p+= 1; goto _out; }$ }$}$}$
+ }
+ case 3 {
+ host( "working/fnext1.rl", 20 ) ${ /*e*/ ${cs = 3;}$}$
+ host( "working/fnext1.rl", 20 ) ${ ${p+= 1; goto _out; }$ }$
+ }
+ case 5 {
+ host( "working/fnext1.rl", 21 ) ${ /*ll*/ ${cs = 9;}$}$
+ host( "working/fnext1.rl", 21 ) ${ ${p+= 1; goto _out; }$ }$
+ }
+ }
+
+
+ }
+ label _again {
+ switch ( _fnext_to_state_actions[cs] ) {
+ case 1 {
+ host( "NONE", 1 ) ${${ts = nil;}$}$
+ }
+ }
+
+ if ( cs == 0 )
+ goto _out;
+ p += 1;
+ if ( p != pe )
+ goto _resume;
+ }
+ label _test_eof { {}
+ }
+ label _out { {}
+ }
+ }
+ }
+ host( "working/fnext1.rl", 45 ) @{
+ }
+ }
+
+ void finish( )
+ {
+ if ( cs >= fnext_first_final )
+ printf( "ACCEPT\n" );
+ else
+ printf( "FAIL\n" );
+ }
+
+ char *inp[] = {
+ "hello\n"
+ };
+
+ int inplen = 1;
+
+ int main( )
+ {
+ int i;
+ for ( i = 0; i < inplen; i++ ) {
+ init();
+ exec( inp[i], strlen(inp[i]) );
+ finish();
+ }
+ return 0;
+ }
+
+}@ \ No newline at end of file