ext/lexerc/lexerc.c in hotcell-0.1.0 vs ext/lexerc/lexerc.c in hotcell-0.2.0

- old
+ new

@@ -1,29 +1,30 @@ #line 1 "ext/lexerc/lexerc.rl" -#line 94 "ext/lexerc/lexerc.rl" +#line 12 "ext/lexerc/lexerc.rl" + #include <ruby.h> #include <lexerc.h> static VALUE mHotcell; static VALUE cHotcellLexer; -#line 15 "ext/lexerc/lexerc.c" -static const int puffer_lexer_start = 12; -static const int puffer_lexer_first_final = 12; +#line 16 "ext/lexerc/lexerc.c" +static const int puffer_lexer_start = 13; +static const int puffer_lexer_first_final = 13; static const int puffer_lexer_error = 0; -static const int puffer_lexer_en_expression = 16; -static const int puffer_lexer_en_template_comment = 26; -static const int puffer_lexer_en_main = 12; +static const int puffer_lexer_en_expression = 17; +static const int puffer_lexer_en_template_comment = 29; +static const int puffer_lexer_en_main = 13; -#line 103 "ext/lexerc/lexerc.rl" +#line 22 "ext/lexerc/lexerc.rl" static char *p; static char *ts; static char *te; static char *data; @@ -44,539 +45,580 @@ p = data; char *pe = data + length; char *eof = pe; -#line 50 "ext/lexerc/lexerc.c" +#line 51 "ext/lexerc/lexerc.c" { cs = puffer_lexer_start; top = 0; ts = 0; te = 0; act = 0; } -#line 127 "ext/lexerc/lexerc.rl" +#line 46 "ext/lexerc/lexerc.rl" -#line 61 "ext/lexerc/lexerc.c" +#line 62 "ext/lexerc/lexerc.c" { if ( p == pe ) goto _test_eof; goto _resume; _again: switch ( cs ) { - case 12: goto st12; case 13: goto st13; case 14: goto st14; case 15: goto st15; case 16: goto st16; - case 0: goto st0; - case 17: goto st17; case 1: goto st1; - case 2: goto st2; + case 17: goto st17; + case 0: goto st0; case 18: goto st18; + case 2: goto st2; case 3: goto st3; + case 19: goto st19; case 4: goto st4; case 5: goto st5; case 6: goto st6; - case 19: goto st19; - case 20: goto st20; case 7: goto st7; + case 20: goto st20; case 21: goto st21; - case 22: goto st22; case 8: goto st8; + case 22: goto st22; case 23: goto st23; - case 9: goto st9; case 24: goto st24; - case 10: goto st10; case 25: goto st25; + case 9: goto st9; case 26: goto st26; + case 10: goto st10; case 27: goto st27; - case 28: goto st28; case 11: goto st11; + case 28: goto st28; + case 29: goto st29; + case 30: goto st30; + case 31: goto st31; + case 12: goto st12; default: break; } if ( ++p == pe ) goto _test_eof; _resume: switch ( cs ) { -tr20: -#line 92 "ext/lexerc/lexerc.rl" - {te = p;p--;{ emit_template; }} - goto st12; +tr0: +#line 91 "lib/hotcell/lexer.rl" + {{p = ((te))-1;}{ emit_tag; {stack[top++] = 13; goto st17;} }} + goto st13; +tr1: +#line 91 "lib/hotcell/lexer.rl" + {te = p+1;{ emit_tag; {stack[top++] = 13; goto st17;} }} + goto st13; tr22: -#line 90 "ext/lexerc/lexerc.rl" - {te = p;p--;{ emit_tag; {stack[top++] = 12; goto st16;} }} - goto st12; -tr23: -#line 90 "ext/lexerc/lexerc.rl" - {te = p+1;{ emit_tag; {stack[top++] = 12; goto st16;} }} - goto st12; +#line 93 "lib/hotcell/lexer.rl" + {te = p;p--;{ emit_template; }} + goto st13; tr24: -#line 91 "ext/lexerc/lexerc.rl" - {te = p+1;{ emit_comment; {stack[top++] = 12; goto st26;} }} - goto st12; -st12: +#line 91 "lib/hotcell/lexer.rl" + {te = p;p--;{ emit_tag; {stack[top++] = 13; goto st17;} }} + goto st13; +tr25: +#line 92 "lib/hotcell/lexer.rl" + {te = p+1;{ emit_comment; {stack[top++] = 13; goto st29;} }} + goto st13; +st13: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) - goto _test_eof12; -case 12: + goto _test_eof13; +case 13: #line 1 "NONE" {ts = p;} -#line 130 "ext/lexerc/lexerc.c" +#line 138 "ext/lexerc/lexerc.c" if ( (*p) == 123 ) - goto st14; - goto st13; -st13: - if ( ++p == pe ) - goto _test_eof13; -case 13: - if ( (*p) == 123 ) - goto tr20; - goto st13; + goto st15; + goto st14; st14: if ( ++p == pe ) goto _test_eof14; case 14: if ( (*p) == 123 ) - goto st15; - goto tr20; + goto tr22; + goto st14; st15: if ( ++p == pe ) goto _test_eof15; case 15: - switch( (*p) ) { - case 33: goto tr23; - case 35: goto tr24; - } + if ( (*p) == 123 ) + goto tr23; goto tr22; -tr1: -#line 78 "ext/lexerc/lexerc.rl" - {te = p+1;{ emit_dstring; }} +tr23: +#line 1 "NONE" + {te = p+1;} goto st16; +st16: + if ( ++p == pe ) + goto _test_eof16; +case 16: +#line 164 "ext/lexerc/lexerc.c" + switch( (*p) ) { + case 33: goto tr1; + case 35: goto tr25; + case 94: goto tr1; + case 101: goto st1; + case 114: goto st1; + case 126: goto tr1; + } + goto tr24; +st1: + if ( ++p == pe ) + goto _test_eof1; +case 1: + if ( (*p) == 32 ) + goto tr1; + goto tr0; tr3: -#line 80 "ext/lexerc/lexerc.rl" - {{p = ((te))-1;}{ emit_comment; }} - goto st16; +#line 79 "lib/hotcell/lexer.rl" + {te = p+1;{ emit_dstring; }} + goto st17; tr5: -#line 74 "ext/lexerc/lexerc.rl" +#line 81 "lib/hotcell/lexer.rl" + {{p = ((te))-1;}{ emit_comment; }} + goto st17; +tr7: +#line 75 "lib/hotcell/lexer.rl" {te = p+1;{ emit_operator; }} - goto st16; -tr8: -#line 77 "ext/lexerc/lexerc.rl" - {te = p+1;{ emit_sstring; }} - goto st16; + goto st17; tr10: +#line 78 "lib/hotcell/lexer.rl" + {te = p+1;{ emit_sstring; }} + goto st17; +tr12: #line 1 "NONE" { switch( act ) { case 2: {{p = ((te))-1;} emit_operator; } break; case 3: {{p = ((te))-1;} emit_numeric; } break; } } - goto st16; -tr12: -#line 74 "ext/lexerc/lexerc.rl" + goto st17; +tr14: +#line 75 "lib/hotcell/lexer.rl" {{p = ((te))-1;}{ emit_operator; }} - goto st16; -tr25: -#line 81 "ext/lexerc/lexerc.rl" + goto st17; +tr27: +#line 82 "lib/hotcell/lexer.rl" {te = p+1;} - goto st16; -tr36: -#line 74 "ext/lexerc/lexerc.rl" + goto st17; +tr38: +#line 75 "lib/hotcell/lexer.rl" {te = p;p--;{ emit_operator; }} - goto st16; -tr37: -#line 80 "ext/lexerc/lexerc.rl" + goto st17; +tr39: +#line 81 "lib/hotcell/lexer.rl" {te = p;p--;{ emit_comment; }} - goto st16; -tr40: -#line 79 "ext/lexerc/lexerc.rl" + goto st17; +tr42: +#line 76 "lib/hotcell/lexer.rl" + {te = p;p--;{ emit_numeric; }} + goto st17; +tr44: +#line 80 "lib/hotcell/lexer.rl" {te = p;p--;{ emit_regexp; }} - goto st16; -tr41: -#line 76 "ext/lexerc/lexerc.rl" + goto st17; +tr45: +#line 77 "lib/hotcell/lexer.rl" {te = p;p--;{ emit_identifer; }} - goto st16; -tr42: -#line 76 "ext/lexerc/lexerc.rl" + goto st17; +tr46: +#line 77 "lib/hotcell/lexer.rl" {te = p+1;{ emit_identifer; }} - goto st16; -tr43: -#line 73 "ext/lexerc/lexerc.rl" + goto st17; +tr47: +#line 74 "lib/hotcell/lexer.rl" {te = p+1;{ emit_tag; {cs = stack[--top];goto _again;} }} - goto st16; -st16: + goto st17; +st17: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) - goto _test_eof16; -case 16: + goto _test_eof17; +case 17: #line 1 "NONE" {ts = p;} -#line 225 "ext/lexerc/lexerc.c" +#line 253 "ext/lexerc/lexerc.c" switch( (*p) ) { - case 10: goto tr5; - case 32: goto tr25; - case 33: goto st17; - case 34: goto st1; - case 35: goto tr4; - case 38: goto st4; - case 39: goto st5; - case 42: goto st19; - case 45: goto tr29; - case 46: goto tr30; - case 47: goto tr31; - case 63: goto tr5; - case 91: goto tr5; - case 93: goto tr5; - case 95: goto st24; - case 123: goto tr5; - case 124: goto st10; - case 125: goto st25; + case 10: goto tr7; + case 32: goto tr27; + case 33: goto st18; + case 34: goto st2; + case 35: goto tr6; + case 38: goto st5; + case 39: goto st6; + case 42: goto st20; + case 45: goto tr31; + case 46: goto st23; + case 47: goto tr33; + case 63: goto tr7; + case 91: goto tr7; + case 93: goto tr7; + case 95: goto st27; + case 123: goto tr7; + case 124: goto st11; + case 125: goto st28; } if ( (*p) < 58 ) { if ( (*p) < 37 ) { if ( 9 <= (*p) && (*p) <= 13 ) - goto tr25; + goto tr27; } else if ( (*p) > 44 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto tr32; + goto tr34; } else - goto tr5; + goto tr7; } else if ( (*p) > 59 ) { if ( (*p) < 65 ) { if ( 60 <= (*p) && (*p) <= 62 ) - goto st17; + goto st18; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) - goto st24; + goto st27; } else - goto st24; + goto st27; } else - goto tr5; + goto tr7; goto st0; st0: cs = 0; goto _out; -st17: +st18: if ( ++p == pe ) - goto _test_eof17; -case 17: + goto _test_eof18; +case 18: if ( (*p) == 61 ) - goto tr5; - goto tr36; -st1: - if ( ++p == pe ) - goto _test_eof1; -case 1: - switch( (*p) ) { - case 34: goto tr1; - case 92: goto st2; - } - goto st1; + goto tr7; + goto tr38; st2: if ( ++p == pe ) goto _test_eof2; case 2: - goto st1; -tr4: -#line 1 "NONE" - {te = p+1;} - goto st18; -st18: - if ( ++p == pe ) - goto _test_eof18; -case 18: -#line 299 "ext/lexerc/lexerc.c" switch( (*p) ) { - case 10: goto tr37; - case 125: goto st3; + case 34: goto tr3; + case 92: goto st3; } - goto tr4; + goto st2; st3: if ( ++p == pe ) goto _test_eof3; case 3: - if ( (*p) == 125 ) - goto tr3; - goto tr4; + goto st2; +tr6: +#line 1 "NONE" + {te = p+1;} + goto st19; +st19: + if ( ++p == pe ) + goto _test_eof19; +case 19: +#line 327 "ext/lexerc/lexerc.c" + switch( (*p) ) { + case 10: goto tr39; + case 125: goto st4; + } + goto tr6; st4: if ( ++p == pe ) goto _test_eof4; case 4: - if ( (*p) == 38 ) + if ( (*p) == 125 ) goto tr5; - goto st0; + goto tr6; st5: if ( ++p == pe ) goto _test_eof5; case 5: - switch( (*p) ) { - case 39: goto tr8; - case 92: goto st6; - } - goto st5; + if ( (*p) == 38 ) + goto tr7; + goto st0; st6: if ( ++p == pe ) goto _test_eof6; case 6: - goto st5; -st19: + switch( (*p) ) { + case 39: goto tr10; + case 92: goto st7; + } + goto st6; +st7: if ( ++p == pe ) - goto _test_eof19; -case 19: - if ( (*p) == 42 ) - goto tr5; - goto tr36; -tr32: -#line 1 "NONE" - {te = p+1;} -#line 75 "ext/lexerc/lexerc.rl" - {act = 3;} - goto st20; -tr29: -#line 1 "NONE" - {te = p+1;} -#line 74 "ext/lexerc/lexerc.rl" - {act = 2;} - goto st20; + goto _test_eof7; +case 7: + goto st6; st20: if ( ++p == pe ) goto _test_eof20; case 20: -#line 356 "ext/lexerc/lexerc.c" - if ( (*p) == 46 ) - goto st7; - if ( 48 <= (*p) && (*p) <= 57 ) - goto tr32; - goto tr10; -st7: - if ( ++p == pe ) - goto _test_eof7; -case 7: - if ( 48 <= (*p) && (*p) <= 57 ) - goto tr11; - goto tr10; -tr11: + if ( (*p) == 42 ) + goto tr7; + goto tr38; +tr31: #line 1 "NONE" {te = p+1;} -#line 75 "ext/lexerc/lexerc.rl" - {act = 3;} +#line 75 "lib/hotcell/lexer.rl" + {act = 2;} goto st21; -tr30: +tr34: #line 1 "NONE" {te = p+1;} -#line 74 "ext/lexerc/lexerc.rl" - {act = 2;} +#line 76 "lib/hotcell/lexer.rl" + {act = 3;} goto st21; st21: if ( ++p == pe ) goto _test_eof21; case 21: -#line 385 "ext/lexerc/lexerc.c" +#line 384 "ext/lexerc/lexerc.c" + if ( (*p) == 46 ) + goto st8; if ( 48 <= (*p) && (*p) <= 57 ) - goto tr11; - goto tr10; -tr31: -#line 1 "NONE" - {te = p+1;} -#line 53 "ext/lexerc/lexerc.rl" - { regexp_ambiguity({goto st16;}) } - goto st22; + goto tr34; + goto tr12; +st8: + if ( ++p == pe ) + goto _test_eof8; +case 8: + if ( 48 <= (*p) && (*p) <= 57 ) + goto st22; + goto tr12; st22: if ( ++p == pe ) goto _test_eof22; case 22: -#line 399 "ext/lexerc/lexerc.c" + if ( 48 <= (*p) && (*p) <= 57 ) + goto st22; + goto tr42; +st23: + if ( ++p == pe ) + goto _test_eof23; +case 23: + if ( (*p) == 46 ) + goto st24; + if ( 48 <= (*p) && (*p) <= 57 ) + goto st22; + goto tr38; +st24: + if ( ++p == pe ) + goto _test_eof24; +case 24: + if ( (*p) == 46 ) + goto tr7; + goto tr38; +tr33: +#line 1 "NONE" + {te = p+1;} +#line 4 "ext/lexerc/lexerc.rl" + { + if (regexp_possible == Qfalse) { + emit_operator; + {goto st17;} + } + } + goto st25; +st25: + if ( ++p == pe ) + goto _test_eof25; +case 25: +#line 435 "ext/lexerc/lexerc.c" switch( (*p) ) { - case 47: goto st23; - case 92: goto st9; + case 47: goto st26; + case 92: goto st10; } - goto st8; -st8: + goto st9; +st9: if ( ++p == pe ) - goto _test_eof8; -case 8: + goto _test_eof9; +case 9: switch( (*p) ) { - case 47: goto st23; - case 92: goto st9; + case 47: goto st26; + case 92: goto st10; } - goto st8; -st23: + goto st9; +st26: if ( ++p == pe ) - goto _test_eof23; -case 23: + goto _test_eof26; +case 26: if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) - goto st23; + goto st26; } else if ( (*p) >= 65 ) - goto st23; - goto tr40; -st9: + goto st26; + goto tr44; +st10: if ( ++p == pe ) - goto _test_eof9; -case 9: - goto st8; -st24: + goto _test_eof10; +case 10: + goto st9; +st27: if ( ++p == pe ) - goto _test_eof24; -case 24: + goto _test_eof27; +case 27: switch( (*p) ) { - case 33: goto tr42; - case 63: goto tr42; - case 95: goto st24; + case 33: goto tr46; + case 63: goto tr46; + case 95: goto st27; } if ( (*p) < 65 ) { if ( 48 <= (*p) && (*p) <= 57 ) - goto st24; + goto st27; } else if ( (*p) > 90 ) { if ( 97 <= (*p) && (*p) <= 122 ) - goto st24; + goto st27; } else - goto st24; - goto tr41; -st10: + goto st27; + goto tr45; +st11: if ( ++p == pe ) - goto _test_eof10; -case 10: + goto _test_eof11; +case 11: if ( (*p) == 124 ) - goto tr5; + goto tr7; goto st0; -st25: +st28: if ( ++p == pe ) - goto _test_eof25; -case 25: + goto _test_eof28; +case 28: if ( (*p) == 125 ) - goto tr43; - goto tr36; -tr16: -#line 86 "ext/lexerc/lexerc.rl" + goto tr47; + goto tr38; +tr18: +#line 87 "lib/hotcell/lexer.rl" {{p = ((te))-1;}{ emit_comment; }} - goto st26; -tr17: -#line 85 "ext/lexerc/lexerc.rl" + goto st29; +tr19: +#line 86 "lib/hotcell/lexer.rl" {te = p+1;{ emit_comment; {cs = stack[--top];goto _again;} }} - goto st26; -tr46: -#line 86 "ext/lexerc/lexerc.rl" + goto st29; +tr50: +#line 87 "lib/hotcell/lexer.rl" {te = p;p--;{ emit_comment; }} - goto st26; -st26: + goto st29; +st29: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) - goto _test_eof26; -case 26: + goto _test_eof29; +case 29: #line 1 "NONE" {ts = p;} -#line 481 "ext/lexerc/lexerc.c" +#line 517 "ext/lexerc/lexerc.c" if ( (*p) == 35 ) - goto tr45; - goto st27; -st27: + goto tr49; + goto st30; +st30: if ( ++p == pe ) - goto _test_eof27; -case 27: + goto _test_eof30; +case 30: if ( (*p) == 35 ) - goto tr46; - goto st27; -tr45: + goto tr50; + goto st30; +tr49: #line 1 "NONE" {te = p+1;} - goto st28; -st28: + goto st31; +st31: if ( ++p == pe ) - goto _test_eof28; -case 28: -#line 500 "ext/lexerc/lexerc.c" + goto _test_eof31; +case 31: +#line 536 "ext/lexerc/lexerc.c" if ( (*p) == 125 ) - goto st11; - goto tr46; -st11: + goto st12; + goto tr50; +st12: if ( ++p == pe ) - goto _test_eof11; -case 11: + goto _test_eof12; +case 12: if ( (*p) == 125 ) - goto tr17; - goto tr16; + goto tr19; + goto tr18; } - _test_eof12: cs = 12; goto _test_eof; _test_eof13: cs = 13; goto _test_eof; _test_eof14: cs = 14; 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_eof1: cs = 1; goto _test_eof; - _test_eof2: cs = 2; goto _test_eof; + _test_eof17: cs = 17; goto _test_eof; _test_eof18: cs = 18; goto _test_eof; + _test_eof2: cs = 2; goto _test_eof; _test_eof3: cs = 3; goto _test_eof; + _test_eof19: cs = 19; 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_eof19: cs = 19; goto _test_eof; - _test_eof20: cs = 20; goto _test_eof; _test_eof7: cs = 7; goto _test_eof; + _test_eof20: cs = 20; goto _test_eof; _test_eof21: cs = 21; goto _test_eof; - _test_eof22: cs = 22; goto _test_eof; _test_eof8: cs = 8; goto _test_eof; + _test_eof22: cs = 22; goto _test_eof; _test_eof23: cs = 23; goto _test_eof; - _test_eof9: cs = 9; goto _test_eof; _test_eof24: cs = 24; goto _test_eof; - _test_eof10: cs = 10; goto _test_eof; _test_eof25: cs = 25; goto _test_eof; + _test_eof9: cs = 9; goto _test_eof; _test_eof26: cs = 26; goto _test_eof; + _test_eof10: cs = 10; goto _test_eof; _test_eof27: cs = 27; goto _test_eof; - _test_eof28: cs = 28; goto _test_eof; _test_eof11: cs = 11; goto _test_eof; + _test_eof28: cs = 28; goto _test_eof; + _test_eof29: cs = 29; goto _test_eof; + _test_eof30: cs = 30; goto _test_eof; + _test_eof31: cs = 31; goto _test_eof; + _test_eof12: cs = 12; goto _test_eof; _test_eof: {} if ( p == eof ) { switch ( cs ) { - case 13: goto tr20; - case 14: goto tr20; + case 14: goto tr22; case 15: goto tr22; - case 17: goto tr36; - case 18: goto tr37; - case 3: goto tr3; - case 19: goto tr36; - case 20: goto tr10; - case 7: goto tr10; - case 21: goto tr10; - case 22: goto tr36; + case 16: goto tr24; + case 1: goto tr0; + case 18: goto tr38; + case 19: goto tr39; + case 4: goto tr5; + case 20: goto tr38; + case 21: goto tr12; case 8: goto tr12; - case 23: goto tr40; - case 9: goto tr12; - case 24: goto tr41; - case 25: goto tr36; - case 27: goto tr46; - case 28: goto tr46; - case 11: goto tr16; - case 5: -#line 45 "ext/lexerc/lexerc.rl" + case 22: goto tr42; + case 23: goto tr38; + case 24: goto tr38; + case 25: goto tr38; + case 9: goto tr14; + case 26: goto tr44; + case 10: goto tr14; + case 27: goto tr45; + case 28: goto tr38; + case 30: goto tr50; + case 31: goto tr50; + case 12: goto tr18; + case 6: +#line 46 "lib/hotcell/lexer.rl" { raise_unterminated_string; } break; - case 1: -#line 49 "ext/lexerc/lexerc.rl" + case 2: +#line 50 "lib/hotcell/lexer.rl" { raise_unterminated_string; } break; -#line 572 "ext/lexerc/lexerc.c" +#line 614 "ext/lexerc/lexerc.c" } } _out: {} } -#line 128 "ext/lexerc/lexerc.rl" +#line 47 "ext/lexerc/lexerc.rl" free(stack); if (ts > 0 && ((ts - data) < (pe - data - 1))) { raise_unexpected_symbol;