summaryrefslogtreecommitdiff
path: root/test/rlhc.d/case/erract6.c-C-G1--goto-backend.in
diff options
context:
space:
mode:
Diffstat (limited to 'test/rlhc.d/case/erract6.c-C-G1--goto-backend.in')
-rw-r--r--test/rlhc.d/case/erract6.c-C-G1--goto-backend.in136
1 files changed, 136 insertions, 0 deletions
diff --git a/test/rlhc.d/case/erract6.c-C-G1--goto-backend.in b/test/rlhc.d/case/erract6.c-C-G1--goto-backend.in
new file mode 100644
index 00000000..d1a4a4de
--- /dev/null
+++ b/test/rlhc.d/case/erract6.c-C-G1--goto-backend.in
@@ -0,0 +1,136 @@
+host( "working/erract6.rl", 1 ) @{/*
+ * @@LANG: c
+ */
+
+ /*
+ * Test of a transition going to the error state.
+ */
+
+ #include <stdio.h>
+ #define BUFSIZE 2048
+
+ struct errintrans
+ {
+ int cs;
+ };
+
+
+
+}@
+array s8 _errintrans_nfa_targs( 0, 0 ) = { 0, 0 };
+
+array s8 _errintrans_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0 };
+
+array s8 _errintrans_nfa_push_actions( 0, 0 ) = { 0, 0 };
+
+array s8 _errintrans_nfa_pop_trans( 0, 0 ) = { 0, 0 };
+
+value int errintrans_start = 1;
+value int errintrans_first_final = 2;
+value int errintrans_error = 0;
+
+value int errintrans_en_main = 1;
+
+host( "working/erract6.rl", 27 ) @{
+
+ void errintrans_init( struct errintrans *fsm )
+ {
+ }@
+ {
+ host( "-", 1 ) ={ fsm->cs}= = cast(int)errintrans_start;
+ }
+ host( "working/erract6.rl", 31 ) @{
+ }
+
+ void errintrans_execute( struct errintrans *fsm, const char *_data, int _len )
+ {
+ const char *p = _data;
+ const char *pe = _data+_len;
+
+ }@
+ {
+ if ( p == pe )
+ goto _test_eof;
+ if ( host( "-", 1 ) ={ fsm->cs}= == 0 )
+ goto _out;
+ _resume:
+ switch ( host( "-", 1 ) ={ fsm->cs}= ) {
+ case 1:
+ if ( ( deref( data, p )) == 10 ) {
+ goto ctr1;
+ }
+ if ( 48 <= ( deref( data, p )) && ( deref( data, p )) <= 57 ) {
+ goto ctr2;
+ }
+ {
+ goto ctr0;
+ }
+ case 2:
+ if ( ( deref( data, p )) == 10 ) {
+ goto ctr1;
+ }
+ if ( 48 <= ( deref( data, p )) && ( deref( data, p )) <= 57 ) {
+ goto ctr2;
+ }
+ {
+ goto ctr0;
+ }
+ case 0:
+ goto _out;
+ }
+
+ ctr2: host( "-", 1 ) ={ fsm->cs}= = 0; goto _again;
+ ctr0: host( "-", 1 ) ={ fsm->cs}= = 1; goto _again;
+ ctr1: host( "-", 1 ) ={ fsm->cs}= = 2; goto _again;
+
+ _again:
+ if ( host( "-", 1 ) ={ fsm->cs}= == 0 )
+ goto _out;
+ p+= 1;
+ if ( p != pe )
+ goto _resume;
+ _test_eof: {}
+ _out: {}
+ }
+ host( "working/erract6.rl", 39 ) @{
+ }
+
+ int errintrans_finish( struct errintrans *fsm )
+ {
+ if ( fsm->cs == errintrans_error )
+ return -1;
+ if ( fsm->cs >= errintrans_first_final )
+ return 1;
+ return 0;
+ }
+
+
+ struct errintrans fsm;
+ #include <string.h>
+
+ void test( char *buf )
+ {
+ int len = strlen( buf );
+ errintrans_init( &fsm );
+ errintrans_execute( &fsm, buf, len );
+ if ( errintrans_finish( &fsm ) > 0 )
+ printf("ACCEPT\n");
+ else
+ printf("FAIL\n");
+ }
+
+
+ int main()
+ {
+ test(
+ "good, does not have numbers\n"
+ );
+
+ test(
+ "bad, has numbers 666\n"
+ );
+
+ return 0;
+ }
+
+}@ \ No newline at end of file