summaryrefslogtreecommitdiff
path: root/test/rlhc.d/case/forder1.c-C-F1--goto-backend.in
diff options
context:
space:
mode:
Diffstat (limited to 'test/rlhc.d/case/forder1.c-C-F1--goto-backend.in')
-rw-r--r--test/rlhc.d/case/forder1.c-C-F1--goto-backend.in159
1 files changed, 159 insertions, 0 deletions
diff --git a/test/rlhc.d/case/forder1.c-C-F1--goto-backend.in b/test/rlhc.d/case/forder1.c-C-F1--goto-backend.in
new file mode 100644
index 00000000..e89eac92
--- /dev/null
+++ b/test/rlhc.d/case/forder1.c-C-F1--goto-backend.in
@@ -0,0 +1,159 @@
+host( "working/forder1.rl", 1 ) @{/*
+ * @@LANG: c
+ */
+
+ #include <stdio.h>
+ #include <string.h>
+
+ struct forder
+ {
+ int cs;
+ };
+
+
+
+}@
+array char _forder_trans_keys( 0, 3 ) = { 1, 0, 2, 2, 3, 3, 0, 0, 1, 0, 0 };
+
+array s8 _forder_char_class( 0, 3 ) = { 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, 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, 2, 3, 0 };
+
+array s8 _forder_index_offsets( 0, 3 ) = { 0, 0, 1, 2, 3, 0 };
+
+array s8 _forder_indicies( 0, 3 ) = { 0, 2, 3, 0 };
+
+array s8 _forder_index_defaults( 0, 1 ) = { 0, 1, 1, 1, 1, 0 };
+
+array s8 _forder_trans_cond_spaces( -1, 0 ) = { -1, -1, -1, -1, 0 };
+
+array s8 _forder_cond_targs( 0, 4 ) = { 2, 0, 3, 4, 0 };
+
+array s8 _forder_cond_actions( 0, 2 ) = { 1, 0, 2, 0, 0 };
+
+array s8 _forder_nfa_targs( 0, 0 ) = { 0, 0 };
+
+array s8 _forder_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0 };
+
+array s8 _forder_nfa_push_actions( 0, 0 ) = { 0, 0 };
+
+array s8 _forder_nfa_pop_trans( 0, 0 ) = { 0, 0 };
+
+value int forder_start = 1;
+value int forder_first_final = 4;
+value int forder_error = 0;
+
+value int forder_en_main = 1;
+
+host( "working/forder1.rl", 31 ) @{
+
+ void forder_init( struct forder *fsm )
+ {
+ }@
+ {
+ host( "-", 1 ) ={ fsm->cs}= = cast(int)forder_start;
+ }
+ host( "working/forder1.rl", 35 ) @{
+ }
+
+ void forder_execute( struct forder *fsm, const char *_data, int _len )
+ {
+ const char *p = _data;
+ const char *pe = _data+_len;
+
+ }@
+ {
+ int _trans = 0;
+ index char _keys;
+ index s8 _inds;
+ entry {
+ if ( p == pe )
+ goto _test_eof;
+ if ( host( "-", 1 ) ={ fsm->cs}= == 0 )
+ goto _out;
+ label _resume {
+ _keys = offset( _forder_trans_keys, (host( "-", 1 ) ={ fsm->cs}=<<1) );
+ _inds = offset( _forder_indicies, _forder_index_offsets[host( "-", 1 ) ={ fsm->cs}=] );
+
+ if ( ( deref( data, p )) <= 98 && ( deref( data, p )) >= 10 )
+ {
+ int _ic = cast(int)_forder_char_class[cast(int)( deref( data, p )) - 10];
+ if ( _ic <= cast(int)deref( _forder_trans_keys, _keys+1 ) && _ic >= cast(int)deref( _forder_trans_keys, _keys ) )
+ _trans = cast(int)deref( _forder_indicies, _inds + cast(int)( _ic - cast(int)deref( _forder_trans_keys, _keys ) ) );
+ else
+ _trans = cast(int)_forder_index_defaults[host( "-", 1 ) ={ fsm->cs}=];
+ }
+ else {
+ _trans = cast(int)_forder_index_defaults[host( "-", 1 ) ={ fsm->cs}=];
+ }
+
+ goto _match_cond;
+ }
+ label _match_cond {
+ host( "-", 1 ) ={ fsm->cs}= = cast(int)_forder_cond_targs[_trans];
+
+ if ( _forder_cond_actions[_trans] == 0 )
+ goto _again;
+
+ switch ( _forder_cond_actions[_trans] ) {
+ case 1 {
+ host( "working/forder1.rl", 24 ) ${printf("finish a\n");}$
+ }
+ case 2 {
+ host( "working/forder1.rl", 23 ) ${printf("leave a\n");}$ host( "working/forder1.rl", 18 ) ${printf("enter b1\n");}$ host( "working/forder1.rl", 19 ) ${printf("enter b2\n");}$
+ }
+ }
+
+
+ }
+ label _again {
+ if ( host( "-", 1 ) ={ fsm->cs}= == 0 )
+ goto _out;
+ p+= 1;
+ if ( p != pe )
+ goto _resume;
+ }
+ label _test_eof { {}
+ }
+ label _out { {}
+ }
+ }
+ }
+ host( "working/forder1.rl", 43 ) @{
+ }
+
+ int forder_finish( struct forder *fsm )
+ {
+ if ( fsm->cs == forder_error )
+ return -1;
+ if ( fsm->cs >= forder_first_final )
+ return 1;
+ return 0;
+ }
+
+ struct forder fsm;
+
+ void test( char *buf )
+ {
+ int len = strlen(buf);
+ forder_init( &fsm );
+ forder_execute( &fsm, buf, len );
+ if ( forder_finish( &fsm ) > 0 )
+ printf("ACCEPT\n");
+ else
+ printf("FAIL\n");
+ }
+
+ int main()
+ {
+ test( "ab\n");
+ test( "abx\n");
+ test( "" );
+
+ test(
+ "ab\n"
+ "fail after newline\n"
+ );
+
+ return 0;
+ }
+
+}@ \ No newline at end of file