12 int cs, top, stack[32];
14 // Initialize the machine. Invokes any init statement blocks. Returns 0
15 // if the machine begins in a non-accepting state and 1 if the machine
16 // begins in an accepting state.
19 // Execute the machine on a block of data. Returns -1 if after processing
20 // the data, the machine is in the error state and can never accept, 0 if
21 // the machine is in a non-accepting state and 1 if the machine is in an
23 void execute( const char *data, int len );
25 // Indicate that there is no more data. Returns -1 if the machine finishes
26 // in the error state and does not accept, 0 if the machine finishes
27 // in any other non-accepting state and 1 if the machine finishes in an
42 # Test call and return functionality.
43 even := 'even' any @{fhold; fret;};
44 odd := 'odd' any @{fhold; fret;};
45 num = [0-9]+ ${ num = num * 10 + (fc - '0'); };
46 even_odd = num ' ' @check_num "\n";
48 # Test calls in out actions.
50 out_acts = 'OA ok\n' |
54 main := even_odd | out_acts;
59 void CallTest::init( )
65 void CallTest::execute( const char *data, int len )
68 const char *pe = data+len;
73 int CallTest::finish( )
75 if ( this->cs == CallTest_error )
77 if ( this->cs >= CallTest_first_final )
84 void test( const char *buf )
89 test.execute( buf, strlen(buf) );
90 if ( test.finish() > 0 )
103 test( "OA error1\n" );
104 test( "OA error2\n" );
108 #ifdef _____OUTPUT_____