summaryrefslogtreecommitdiff
path: root/test/rlhc.d/case/union.cpp-C-F1--goto-backend.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/rlhc.d/case/union.cpp-C-F1--goto-backend.exp')
-rw-r--r--test/rlhc.d/case/union.cpp-C-F1--goto-backend.exp417
1 files changed, 417 insertions, 0 deletions
diff --git a/test/rlhc.d/case/union.cpp-C-F1--goto-backend.exp b/test/rlhc.d/case/union.cpp-C-F1--goto-backend.exp
new file mode 100644
index 00000000..80993855
--- /dev/null
+++ b/test/rlhc.d/case/union.cpp-C-F1--goto-backend.exp
@@ -0,0 +1,417 @@
+#include <iostream>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+using namespace std;
+
+#define BUFSIZE 2048
+
+struct Concurrent
+{
+ Concurrent() :
+ cur_char(0),
+ start_word(0),
+ start_comment(0),
+ start_literal(0)
+ {}
+
+ int cur_char;
+ int start_word;
+ int start_comment;
+ int start_literal;
+
+ int cs;
+
+ // Initialize the machine. Invokes any init statement blocks. Returns 0
+ // if the machine begins in a non-accepting state and 1 if the machine
+ // begins in an accepting state.
+ void init( );
+
+ // Execute the machine on a block of data. Returns -1 if after processing
+ // the data, the machine is in the error state and can never accept, 0 if
+ // the machine is in a non-accepting state and 1 if the machine is in an
+ // accepting state.
+ void execute( const char *data, int len );
+
+ // Indicate that there is no more data. Returns -1 if the machine finishes
+ // in the error state and does not accept, 0 if the machine finishes
+ // in any other non-accepting state and 1 if the machine finishes in an
+ // accepting state.
+ int finish( );
+};
+
+
+
+static const char _Concurrent_trans_keys [] = { 0, 4, 0, 4, 0, 5, 0, 5, 0, 4, 0, 4, 0, 3, 0, 3, 0, 5, 0, 5, 0, 3, 0, 4, 0, 4, 0, 5, 0, 5, 0, 5, 0, 4, 0, 3, 0 , };
+static const char _Concurrent_char_class [] = { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 4, 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, 5, 0 , };
+static const char _Concurrent_index_offsets [] = { 0, 5, 10, 16, 22, 27, 32, 36, 40, 46, 52, 56, 61, 66, 72, 78, 84, 89, 0 , };
+static const char _Concurrent_indicies [] = { 1, 0, 2, 0, 3, 5, 4, 6, 4, 7, 9, 8, 10, 8, 11, 12, 14, 13, 15, 13, 16, 17, 19, 18, 20, 18, 21, 5, 4, 6, 22, 7, 23, 22, 24, 25, 27, 26, 28, 29, 31, 30, 32, 33, 30, 34, 36, 35, 37, 38, 35, 39, 41, 40, 42, 43, 23, 22, 24, 25, 44, 46, 45, 47, 45, 48, 31, 30, 32, 33, 49, 34, 51, 50, 52, 50, 53, 54, 9, 8, 10, 30, 11, 12, 9, 8, 8, 8, 11, 31, 30, 30, 33, 0 , };
+static const char _Concurrent_index_defaults [] = { 0, 4, 8, 13, 18, 4, 22, 26, 30, 35, 40, 22, 45, 30, 50, 8, 8, 30, 0 , };
+static const char _Concurrent_trans_cond_spaces [] = { -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, 0 , };
+static const char _Concurrent_cond_targs [] = { 1, 0, 2, 5, 1, 0, 2, 5, 2, 3, 4, 15, 16, 2, 3, 4, 15, 16, 1, 0, 2, 5, 6, 7, 8, 11, 6, 7, 8, 11, 8, 9, 10, 13, 17, 8, 9, 10, 13, 17, 6, 7, 8, 11, 12, 1, 0, 2, 5, 14, 2, 3, 4, 15, 16, 0 , };
+static const char _Concurrent_cond_actions [] = { 1, 2, 3, 4, 2, 6, 7, 8, 2, 6, 2, 8, 2, 1, 2, 1, 4, 1, 10, 11, 12, 13, 2, 6, 7, 2, 1, 2, 3, 1, 2, 6, 2, 2, 2, 1, 2, 1, 1, 1, 10, 11, 12, 10, 2, 15, 16, 17, 18, 2, 15, 16, 15, 18, 15, 0 , };
+static const char _Concurrent_eof_actions [] = { 0, 5, 5, 0, 9, 5, 5, 0, 5, 0, 9, 5, 14, 5, 14, 5, 5, 5, 0 , };
+static const char _Concurrent_nfa_targs [] = { 0, 0 , };
+static const char _Concurrent_nfa_offsets [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 , };
+static const char _Concurrent_nfa_push_actions [] = { 0, 0 , };
+static const char _Concurrent_nfa_pop_trans [] = { 0, 0 , };
+static const int Concurrent_start = 0;
+static const int Concurrent_first_final = 0;
+static const int Concurrent_error = -1;
+static const int Concurrent_en_main = 0;
+void Concurrent::init( )
+{
+ cur_char = 0;
+
+ {
+ cs = ( int ) Concurrent_start;
+ }
+}
+
+void Concurrent::execute( const char *data, int len )
+{
+ const char *p = data;
+ const char *pe = data + len;
+ const char *eof = pe;
+
+
+ {
+ int _trans = 0;
+ const char *_keys;
+ const char *_inds;
+ if ( p == pe )
+ goto _test_eof;
+
+ _resume :
+ _keys = _Concurrent_trans_keys + (cs<<1);
+ _inds = _Concurrent_indicies + _Concurrent_index_offsets[cs];
+ if ( ((*( p ))
+ )<= 92 && ((*( p ))
+ )>= 9 )
+ {
+ int _ic = ( int ) _Concurrent_char_class[( int ) ((*( p ))
+ )- 9];
+ if ( _ic <= ( int ) (*( _keys+1 ))
+ && _ic >= ( int ) (*( _keys ))
+ )
+ _trans = ( int ) (*( _inds + ( int ) (_ic - ( int ) (*( _keys ))
+ ) ))
+ ;
+
+ else
+ _trans = ( int ) _Concurrent_index_defaults[cs];
+
+ }
+
+ else
+ {
+ _trans = ( int ) _Concurrent_index_defaults[cs];
+ }
+
+
+ goto _match_cond;
+
+ _match_cond :
+ cs = ( int ) _Concurrent_cond_targs[_trans];
+ if ( _Concurrent_cond_actions[_trans]== 0 )
+ goto _again;
+
+
+ switch ( _Concurrent_cond_actions[_trans] ) {
+ case 2 :
+ {
+ cur_char += 1;
+
+ }
+
+ break;
+ case 1 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ start_word = cur_char;
+
+ }
+
+ break;
+ case 6 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "word: " << start_word <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 8 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ start_comment = cur_char;
+
+ }
+
+ break;
+ case 15 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "comment: " << start_comment <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 7 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ start_literal = cur_char;
+
+ }
+
+ break;
+ case 10 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "literal: " << start_literal <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 4 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ start_word = cur_char;
+
+ }
+ {
+ start_comment = cur_char;
+
+ }
+
+ break;
+ case 3 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ start_word = cur_char;
+
+ }
+ {
+ start_literal = cur_char;
+
+ }
+
+ break;
+ case 16 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "word: " << start_word <<
+ " " << cur_char-1 << endl;
+
+ }
+ {
+ cout << "comment: " << start_comment <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 11 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "word: " << start_word <<
+ " " << cur_char-1 << endl;
+
+ }
+ {
+ cout << "literal: " << start_literal <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 13 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ start_comment = cur_char;
+
+ }
+ {
+ cout << "literal: " << start_literal <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 18 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "comment: " << start_comment <<
+ " " << cur_char-1 << endl;
+
+ }
+ {
+ start_comment = cur_char;
+
+ }
+
+ break;
+ case 17 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "comment: " << start_comment <<
+ " " << cur_char-1 << endl;
+
+ }
+ {
+ start_literal = cur_char;
+
+ }
+
+ break;
+ case 12 :
+ {
+ cur_char += 1;
+
+ }
+ {
+ cout << "literal: " << start_literal <<
+ " " << cur_char-1 << endl;
+
+ }
+ {
+ start_literal = cur_char;
+
+ }
+
+ break;
+
+ }
+
+ _again :
+ p+= 1;
+ if ( p != pe )
+ goto _resume;
+
+
+ _test_eof :
+ {}
+ if ( p == eof )
+ {
+ switch ( _Concurrent_eof_actions[cs] ) {
+ case 5 :
+ {
+ cout << "word: " << start_word <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 14 :
+ {
+ cout << "word: " << start_word <<
+ " " << cur_char-1 << endl;
+
+ }
+ {
+ cout << "comment: " << start_comment <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+ case 9 :
+ {
+ cout << "word: " << start_word <<
+ " " << cur_char-1 << endl;
+
+ }
+ {
+ cout << "literal: " << start_literal <<
+ " " << cur_char-1 << endl;
+
+ }
+
+ break;
+
+ }
+ }
+
+
+
+ }
+}
+
+int Concurrent::finish( )
+{
+ if ( cs == Concurrent_error )
+ return -1;
+ if ( cs >= Concurrent_first_final )
+ return 1;
+ return 0;
+}
+
+void test( const char *buf )
+{
+ Concurrent concurrent;
+ concurrent.init();
+ concurrent.execute( buf, strlen(buf) );
+ if ( concurrent.finish() > 0 )
+ cout << "ACCEPT" << endl;
+ else
+ cout << "FAIL" << endl;
+}
+
+int main()
+{
+ test(
+ "/* in a comment,\n"
+ " * ' and now in a literal string\n"
+ " */ \n"
+ " \n"
+ "the comment has now ended but the literal string lives on\n"
+ "\n"
+ "' comment closed\n" );
+ test( "/* * ' \\' */ \\' '\n" );
+ test( "/**/'\\''/*/*/\n" );
+ return 0;
+}
+