diff options
Diffstat (limited to 'test/rlhc.d/case/conderr1.cpp-C-F1--goto-backend.in')
-rw-r--r-- | test/rlhc.d/case/conderr1.cpp-C-F1--goto-backend.in | 149 |
1 files changed, 149 insertions, 0 deletions
diff --git a/test/rlhc.d/case/conderr1.cpp-C-F1--goto-backend.in b/test/rlhc.d/case/conderr1.cpp-C-F1--goto-backend.in new file mode 100644 index 00000000..0b0af860 --- /dev/null +++ b/test/rlhc.d/case/conderr1.cpp-C-F1--goto-backend.in @@ -0,0 +1,149 @@ +host( "working/conderr1.rl", 1 ) @{/* + * @@LANG: c++ + */ + + #include <iostream> + #include <string.h> + using std::cout; + using std::endl; + + + +}@ +array char _foo_trans_keys( 0, 2 ) = { 1, 0, 2, 2, 0, 2, 1, 0, 0 }; + +array s8 _foo_char_class( 0, 2 ) = { 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, 0 }; + +array s8 _foo_index_offsets( 0, 4 ) = { 0, 0, 1, 4, 0 }; + +array s8 _foo_indicies( 0, 2 ) = { 1, 2, 0, 1, 0 }; + +array s8 _foo_index_defaults( 0, 3 ) = { 0, 0, 0, 3, 0 }; + +array s8 _foo_trans_cond_spaces( -1, 0 ) = { -1, 0, -1, -1, 0 }; + +array s8 _foo_trans_offsets( 0, 4 ) = { 0, 1, 3, 4, 0 }; + +array s8 _foo_cond_targs( 0, 3 ) = { 0, 0, 2, 3, 0, 0 }; + +array s8 _foo_cond_actions( 0, 1 ) = { 1, 1, 0, 0, 0, 0 }; + +array s8 _foo_eof_actions( 0, 1 ) = { 0, 1, 1, 0, 0 }; + +array s8 _foo_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _foo_nfa_offsets( 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 = 3; + +value int foo_en_main = 1; + +host( "working/conderr1.rl", 20 ) @{ + + void test( int c, const char *str ) + { + int cs = foo_start; + const char *p = str; + const char *pe = str + strlen( str ); + const char *eof = pe; + + cout << "run:" << endl; + }@ + { + int _trans = 0; + uint _cond = 0; + index char _keys; + index s8 _inds; + int _cpc; + entry { + if ( p == pe ) + goto _test_eof; + if ( cs == 0 ) + goto _out; + label _resume { + _keys = offset( _foo_trans_keys, (cs<<1) ); + _inds = offset( _foo_indicies, _foo_index_offsets[cs] ); + + if ( ( deref( data, p )) <= 97 && ( deref( data, p )) >= 10 ) + { + int _ic = cast(int)_foo_char_class[cast(int)( deref( data, p )) - 10]; + if ( _ic <= cast(int)deref( _foo_trans_keys, _keys+1 ) && _ic >= cast(int)deref( _foo_trans_keys, _keys ) ) + _trans = cast(int)deref( _foo_indicies, _inds + cast(int)( _ic - cast(int)deref( _foo_trans_keys, _keys ) ) ); + else + _trans = cast(int)_foo_index_defaults[cs]; + } + else { + _trans = cast(int)_foo_index_defaults[cs]; + } + + _cond = cast(uint)_foo_trans_offsets[_trans]; + + _cpc = 0; + switch ( _foo_trans_cond_spaces[_trans] ) { + + case 0 { + if ( host( "working/conderr1.rl", 13 ) ={c}= ) _cpc += 1; + } + } + _cond += cast(uint)_cpc; + goto _match_cond; + } + label _match_cond { + cs = cast(int)_foo_cond_targs[_cond]; + + if ( _foo_cond_actions[_cond] == 0 ) + goto _again; + + switch ( _foo_cond_actions[_cond] ) { + case 1 { + host( "working/conderr1.rl", 15 ) ${ cout << " bail" << endl; }$ + } + } + + + } + label _again { + if ( cs == 0 ) + goto _out; + p+= 1; + if ( p != pe ) + goto _resume; + } + label _test_eof { {} + if ( p == eof ) + { + switch ( _foo_eof_actions[cs] ) { + case 1 { + host( "working/conderr1.rl", 15 ) ${ cout << " bail" << endl; }$ + } + } + } + + } + label _out { {} + } + } + } + host( "working/conderr1.rl", 30 ) @{ + if ( cs >= foo_first_final ) + cout << " success" << endl; + else + cout << " failure" << endl; + cout << endl; + } + + int main() + { + test( 1, "aa\n" ); + test( 1, "ab\n" ); + test( 0, "aa\n" ); + test( 0, "ab\n" ); + return 0; + } + +}@
\ No newline at end of file |