diff options
Diffstat (limited to 'test/rlhc.d/case/clang2.m-C-G2--goto-backend.in')
-rw-r--r-- | test/rlhc.d/case/clang2.m-C-G2--goto-backend.in | 1620 |
1 files changed, 1620 insertions, 0 deletions
diff --git a/test/rlhc.d/case/clang2.m-C-G2--goto-backend.in b/test/rlhc.d/case/clang2.m-C-G2--goto-backend.in new file mode 100644 index 00000000..59d22b2a --- /dev/null +++ b/test/rlhc.d/case/clang2.m-C-G2--goto-backend.in @@ -0,0 +1,1620 @@ +host( "working/clang2.rl", 1 ) @{/* + * @@LANG: obj-c + * A mini C-like language scanner. + */ + + #include <stdio.h> + #include <string.h> + #include <Foundation/Foundation.h> + + #define IDENT_BUFLEN 256 + + @@interface Clang : NSObject + { + @@public + /* State machine operation data. */ + int cs; + + /* Parsing data. */ + char identBuf[IDENT_BUFLEN+1]; + int identLen; + int curLine; + }; + + - (void) initFsm; + - (void) executeWithData:(const char *)data len:(int)len; + - (int) finish; + + @@end + + + + @@implementation Clang + +}@ +value int Clang_start = 10; +value int Clang_first_final = 10; +value int Clang_error = 0; + +value int Clang_en_main = 10; + +array s8 _Clang_nfa_targs( 0, 0 ) = { 0, 0 }; + +array s8 _Clang_nfa_offsets( 0, 0 ) = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + +array s8 _Clang_nfa_push_actions( 0, 0 ) = { 0, 0 }; + +array s8 _Clang_nfa_pop_trans( 0, 0 ) = { 0, 0 }; + +host( "working/clang2.rl", 153 ) @{ + + - (void) initFsm; + { + identLen = 0; + curLine = 1; + }@ + { + cs = cast(int)Clang_start; + } + host( "working/clang2.rl", 159 ) @{ + } + + - (void) executeWithData:(const char *)data len:(int)len; + { + const char *p = data; + const char *pe = data + len; + const char *eof = pe; + + }@ + { + if ( p == pe ) + goto _test_eof; + switch ( cs ) + { + case 10: + goto st_case_10; + case 11: + goto st_case_11; + case 1: + goto st_case_1; + case 12: + goto st_case_12; + case 2: + goto st_case_2; + case 3: + goto st_case_3; + case 13: + goto st_case_13; + case 4: + goto st_case_4; + case 5: + goto st_case_5; + case 6: + goto st_case_6; + case 14: + goto st_case_14; + case 7: + goto st_case_7; + case 0: + goto st_case_0; + case 15: + goto st_case_15; + case 16: + goto st_case_16; + case 17: + goto st_case_17; + case 8: + goto st_case_8; + case 18: + goto st_case_18; + case 9: + goto st_case_9; + } + goto st_out; + ctr12: + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st10; + ctr23: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + + goto st10; + ctr24: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st10; + ctr32: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + + goto st10; + ctr33: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st10; + ctr41: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + + goto st10; + ctr42: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st10; + ctr51: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + + goto st10; + ctr52: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st10; + ctr58: + host( "working/clang2.rl", 47 ) ${ + identBuf[identLen] = 0; + printf("ident(%i): %s\n", curLine, identBuf); + }$ + + goto st10; + ctr59: + host( "working/clang2.rl", 47 ) ${ + identBuf[identLen] = 0; + printf("ident(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st10; + ctr65: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + + goto st10; + ctr66: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st10; + st10: + p+= 1; + if ( p == pe ) + goto _test_eof10; + st_case_10: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr12; + } + case 34: { + goto ctr17; + } + case 39: { + goto ctr18; + } + case 47: { + goto ctr19; + } + case 48: { + goto ctr20; + } + case 95: { + goto ctr22; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 49 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 46 ) { + goto ctr16; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr16; + } + } else { + goto ctr21; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr16; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr16; + } + } else { + goto ctr22; + } + } else { + goto ctr22; + } + { + goto st10; + } + ctr16: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st11; + ctr25: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st11; + ctr34: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st11; + ctr43: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st11; + ctr53: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st11; + ctr60: + host( "working/clang2.rl", 47 ) ${ + identBuf[identLen] = 0; + printf("ident(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st11; + ctr67: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st11; + st11: + p+= 1; + if ( p == pe ) + goto _test_eof11; + st_case_11: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr24; + } + case 34: { + goto ctr26; + } + case 39: { + goto ctr27; + } + case 47: { + goto ctr28; + } + case 48: { + goto ctr29; + } + case 95: { + goto ctr31; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 49 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 46 ) { + goto ctr25; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr25; + } + } else { + goto ctr30; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr25; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr25; + } + } else { + goto ctr31; + } + } else { + goto ctr31; + } + { + goto ctr23; + } + ctr0: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st1; + ctr1: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st1; + ctr17: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st1; + ctr26: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st1; + ctr35: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st1; + ctr44: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st1; + ctr54: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st1; + ctr61: + host( "working/clang2.rl", 47 ) ${ + identBuf[identLen] = 0; + printf("ident(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st1; + ctr68: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st1; + st1: + p+= 1; + if ( p == pe ) + goto _test_eof1; + st_case_1: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr1; + } + case 34: { + goto st12; + } + case 92: { + goto st9; + } + } + { + goto ctr0; + } + st12: + p+= 1; + if ( p == pe ) + goto _test_eof12; + st_case_12: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr33; + } + case 34: { + goto ctr35; + } + case 39: { + goto ctr36; + } + case 47: { + goto ctr37; + } + case 48: { + goto ctr38; + } + case 95: { + goto ctr40; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 49 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 46 ) { + goto ctr34; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr34; + } + } else { + goto ctr39; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr34; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr34; + } + } else { + goto ctr40; + } + } else { + goto ctr40; + } + { + goto ctr32; + } + ctr4: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st2; + ctr5: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st2; + ctr18: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st2; + ctr27: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st2; + ctr36: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st2; + ctr45: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st2; + ctr55: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st2; + ctr62: + host( "working/clang2.rl", 47 ) ${ + identBuf[identLen] = 0; + printf("ident(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st2; + ctr69: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + + goto st2; + st2: + p+= 1; + if ( p == pe ) + goto _test_eof2; + st_case_2: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr5; + } + case 39: { + goto st12; + } + case 92: { + goto st3; + } + } + { + goto ctr4; + } + st3: + p+= 1; + if ( p == pe ) + goto _test_eof3; + st_case_3: + if ( ( deref( data, p )) == 10 ) { + goto ctr5; + } + { + goto ctr4; + } + ctr19: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st13; + ctr28: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st13; + ctr37: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st13; + ctr47: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st13; + ctr56: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st13; + ctr63: + host( "working/clang2.rl", 47 ) ${ + identBuf[identLen] = 0; + printf("ident(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st13; + ctr70: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st13; + st13: + p+= 1; + if ( p == pe ) + goto _test_eof13; + st_case_13: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr24; + } + case 34: { + goto ctr26; + } + case 39: { + goto ctr27; + } + case 42: { + goto st4; + } + case 47: { + goto st6; + } + case 48: { + goto ctr29; + } + case 95: { + goto ctr31; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 49 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 46 ) { + goto ctr25; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr25; + } + } else { + goto ctr30; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr25; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr25; + } + } else { + goto ctr31; + } + } else { + goto ctr31; + } + { + goto ctr23; + } + ctr8: + host( "working/clang2.rl", 141 ) ${ curLine += 1; }$ + + goto st4; + st4: + p+= 1; + if ( p == pe ) + goto _test_eof4; + st_case_4: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr8; + } + case 42: { + goto st5; + } + } + { + goto st4; + } + st5: + p+= 1; + if ( p == pe ) + goto _test_eof5; + st_case_5: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr8; + } + case 42: { + goto st5; + } + case 47: { + goto st10; + } + } + { + goto st4; + } + st6: + p+= 1; + if ( p == pe ) + goto _test_eof6; + st_case_6: + if ( ( deref( data, p )) == 10 ) { + goto ctr12; + } + { + goto st6; + } + ctr20: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st14; + ctr29: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st14; + ctr38: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st14; + st14: + p+= 1; + if ( p == pe ) + goto _test_eof14; + st_case_14: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr42; + } + case 34: { + goto ctr44; + } + case 39: { + goto ctr45; + } + case 46: { + goto ctr46; + } + case 47: { + goto ctr47; + } + case 95: { + goto ctr49; + } + case 120: { + goto st8; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 48 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 45 ) { + goto ctr43; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr43; + } + } else { + goto ctr48; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr43; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr43; + } + } else { + goto ctr49; + } + } else { + goto ctr49; + } + { + goto ctr41; + } + ctr46: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st7; + st7: + p+= 1; + if ( p == pe ) + goto _test_eof7; + st_case_7: + if ( 48 <= ( deref( data, p )) && ( deref( data, p )) <= 57 ) { + goto ctr13; + } + { + goto st0; + } + st_case_0: + st0: + cs = 0; + goto _out; + ctr13: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st15; + st15: + p+= 1; + if ( p == pe ) + goto _test_eof15; + st_case_15: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr52; + } + case 34: { + goto ctr54; + } + case 39: { + goto ctr55; + } + case 47: { + goto ctr56; + } + case 95: { + goto ctr57; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 48 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 46 ) { + goto ctr53; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr53; + } + } else { + goto ctr13; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr53; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr53; + } + } else { + goto ctr57; + } + } else { + goto ctr57; + } + { + goto ctr51; + } + ctr64: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st16; + ctr22: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st16; + ctr31: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st16; + ctr40: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st16; + ctr49: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st16; + ctr57: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st16; + ctr72: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st16; + st16: + p+= 1; + if ( p == pe ) + goto _test_eof16; + st_case_16: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr59; + } + case 34: { + goto ctr61; + } + case 39: { + goto ctr62; + } + case 47: { + goto ctr63; + } + case 95: { + goto ctr64; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 48 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 46 ) { + goto ctr60; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr60; + } + } else { + goto ctr64; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr60; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr60; + } + } else { + goto ctr64; + } + } else { + goto ctr64; + } + { + goto ctr58; + } + ctr48: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st17; + ctr21: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st17; + ctr30: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st17; + ctr39: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st17; + st17: + p+= 1; + if ( p == pe ) + goto _test_eof17; + st_case_17: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr42; + } + case 34: { + goto ctr44; + } + case 39: { + goto ctr45; + } + case 46: { + goto ctr46; + } + case 47: { + goto ctr47; + } + case 95: { + goto ctr49; + } + } + if ( ( deref( data, p )) < 65 ) { + if ( ( deref( data, p )) < 48 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 45 ) { + goto ctr43; + } + } else if ( ( deref( data, p )) > 57 ) { + { + goto ctr43; + } + } else { + goto ctr48; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr43; + } + } else if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr43; + } + } else { + goto ctr49; + } + } else { + goto ctr49; + } + { + goto ctr41; + } + st8: + p+= 1; + if ( p == pe ) + goto _test_eof8; + st_case_8: + if ( ( deref( data, p )) < 65 ) { + if ( 48 <= ( deref( data, p )) && ( deref( data, p )) <= 57 ) { + goto ctr15; + } + } else if ( ( deref( data, p )) > 70 ) { + if ( 97 <= ( deref( data, p )) && ( deref( data, p )) <= 102 ) { + goto ctr15; + } + } else { + goto ctr15; + } + { + goto st0; + } + ctr71: + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st18; + ctr15: + host( "working/clang2.rl", 42 ) ${ + identLen = 0; + }$ + host( "working/clang2.rl", 34 ) ${ + if ( identLen < IDENT_BUFLEN ) { + identBuf[identLen] = ={( deref( data, p ))}=; + identLen += 1; + } + }$ + + goto st18; + st18: + p+= 1; + if ( p == pe ) + goto _test_eof18; + st_case_18: + switch( ( deref( data, p )) ) { + case 10: { + goto ctr66; + } + case 34: { + goto ctr68; + } + case 39: { + goto ctr69; + } + case 47: { + goto ctr70; + } + case 95: { + goto ctr72; + } + } + if ( ( deref( data, p )) < 71 ) { + if ( ( deref( data, p )) < 48 ) { + if ( 33 <= ( deref( data, p )) && ( deref( data, p )) <= 46 ) { + goto ctr67; + } + } else if ( ( deref( data, p )) > 57 ) { + if ( ( deref( data, p )) > 64 ) { + { + goto ctr71; + } + } else { + goto ctr67; + } + } else { + goto ctr71; + } + } else if ( ( deref( data, p )) > 90 ) { + if ( ( deref( data, p )) < 97 ) { + { + goto ctr67; + } + } else if ( ( deref( data, p )) > 102 ) { + if ( ( deref( data, p )) > 122 ) { + if ( ( deref( data, p )) <= 126 ) { + goto ctr67; + } + } else { + goto ctr72; + } + } else { + goto ctr71; + } + } else { + goto ctr72; + } + { + goto ctr65; + } + st9: + p+= 1; + if ( p == pe ) + goto _test_eof9; + st_case_9: + if ( ( deref( data, p )) == 10 ) { + goto ctr1; + } + { + goto ctr0; + } + st_out: + _test_eof10: cs = 10; goto _test_eof; + _test_eof11: cs = 11; goto _test_eof; + _test_eof1: cs = 1; goto _test_eof; + _test_eof12: cs = 12; goto _test_eof; + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; + _test_eof13: cs = 13; goto _test_eof; + _test_eof4: cs = 4; goto _test_eof; + _test_eof5: cs = 5; goto _test_eof; + _test_eof6: cs = 6; goto _test_eof; + _test_eof14: cs = 14; goto _test_eof; + _test_eof7: cs = 7; goto _test_eof; + _test_eof15: cs = 15; goto _test_eof; + _test_eof16: cs = 16; goto _test_eof; + _test_eof17: cs = 17; goto _test_eof; + _test_eof8: cs = 8; goto _test_eof; + _test_eof18: cs = 18; goto _test_eof; + _test_eof9: cs = 9; goto _test_eof; + + _test_eof: {} + if ( p == eof ) + { + switch ( cs ) { + case 16: + host( "working/clang2.rl", 47 ) ${ + identBuf[identLen] = 0; + printf("ident(%i): %s\n", curLine, identBuf); + }$ + break; + case 12: + host( "working/clang2.rl", 51 ) ${ + identBuf[identLen] = 0; + printf("literal(%i): %s\n", curLine, identBuf); + }$ + break; + case 15: + host( "working/clang2.rl", 55 ) ${ + identBuf[identLen] = 0; + printf("float(%i): %s\n", curLine, identBuf); + }$ + break; + case 14: + fallthrough; + case 17: + host( "working/clang2.rl", 59 ) ${ + identBuf[identLen] = 0; + printf("int(%i): %s\n", curLine, identBuf); + }$ + break; + case 18: + host( "working/clang2.rl", 63 ) ${ + identBuf[identLen] = 0; + printf("hex(%i): 0x%s\n", curLine, identBuf); + }$ + break; + case 11: + fallthrough; + case 13: + host( "working/clang2.rl", 67 ) ${ + identBuf[identLen] = 0; + printf("symbol(%i): %s\n", curLine, identBuf); + }$ + break; + } + } + + _out: {} + } + host( "working/clang2.rl", 168 ) @{ + } + + - (int) finish; + { + if ( cs == Clang_error ) + return -1; + if ( cs >= Clang_first_final ) + return 1; + return 0; + } + + @@end + + #define BUFSIZE 2048 + + Clang *fsm; + char buf[BUFSIZE]; + + void test( char *buf ) + { + int len = strlen(buf); + fsm = [[Clang alloc] init]; + [fsm initFsm]; + [fsm executeWithData:buf len:len]; + if ( [fsm finish] > 0 ) + printf("ACCEPT\n"); + else + printf("FAIL\n"); + } + + int main() + { + test( + "999 0xaAFF99 99.99 /*\n" + "*/ 'lksdj' //\n" + "\"\n" + "\n" + "literal\n" + "\n" + "\n" + "\"0x00aba foobardd.ddsf 0x0.9\n" ); + + test( + "wordwithnum00asdf\n" + "000wordfollowsnum,makes new symbol\n" + "\n" + "finishing early /* unfinished ...\n" ); + + test( + "/*\n" + " * Copyright\n" + " */\n" + "\n" + "/* Aapl.\n" + " */\n" + "\n" + "#define _AAPL_RESIZE_H\n" + "\n" + "#include <assert.h>\n" + "\n" + "#ifdef AAPL_NAMESPACE\n" + "namespace Aapl {\n" + "#endif\n" + "#define LIN_DEFAULT_STEP 256\n" + "#define EXPN_UP( existing, needed ) \\\n" + " need > eng ? (ned<<1) : eing\n" + " \n" + "\n" + "/*@@}*/\n" + "#undef EXPN_UP\n" + "#ifdef AAPL_NAMESPACE\n" + "#endif /* _AAPL_RESIZE_H */\n" ); + return 0; + } + +}@
\ No newline at end of file |