c_lexer 2.6.4.0.1 → 2.6.4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/c_lexer.gemspec +1 -1
- data/ext/lexer/lexer.h +3 -0
- data/ext/lexer/lexer.rl +34 -14
- data/lib/c_lexer/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6feb2a213939ae8a481312ac17a9d6fb6fc5f66f50f5fd48635e571fb06101e2
|
4
|
+
data.tar.gz: 9c1ea663c6066b26e4ac4e8c87199c0a281c04554cbd7940a939e8bdbd6cd4fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c58d48fdfd38555a9ed666a0f717e4e9fbc9bbb0f2ad0c676eeb01692186835c31970e6f128e623772ecd096c2e1a0ad1e2dd3677f343ce5b8e0fc788e6353ba
|
7
|
+
data.tar.gz: fcec4ccd283045c079deaaffb9c2753157436c99110e96fbd80fe8a32fc5b1dd1f1753a845a7e8a3faa092442900f1c0ffeb9aedff0bf87a327418abd0a5c8cd
|
data/Gemfile.lock
CHANGED
data/c_lexer.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.extensions = ['ext/lexer/extconf.rb']
|
23
23
|
|
24
24
|
spec.add_dependency 'ast', '~> 2.4.0'
|
25
|
-
spec.add_dependency 'parser', '= 2.6.4.
|
25
|
+
spec.add_dependency 'parser', '= 2.6.4.1'
|
26
26
|
|
27
27
|
spec.add_development_dependency 'bundler'
|
28
28
|
spec.add_development_dependency 'rake', '~> 10.0'
|
data/ext/lexer/lexer.h
CHANGED
data/ext/lexer/lexer.rl
CHANGED
@@ -154,7 +154,7 @@ static VALUE lexer_reset(int argc, VALUE *argv, VALUE self)
|
|
154
154
|
|
155
155
|
lexer->dedent_level = -1;
|
156
156
|
|
157
|
-
|
157
|
+
lexer->command_start = 1;
|
158
158
|
|
159
159
|
lexer->in_kwarg = 0;
|
160
160
|
|
@@ -341,7 +341,7 @@ static VALUE lexer_set_force_utf32(VALUE self, VALUE arg)
|
|
341
341
|
|
342
342
|
static VALUE lexer_advance(VALUE self)
|
343
343
|
{
|
344
|
-
int cs, act = 0, top,
|
344
|
+
int cs, act = 0, top, cmd_state;
|
345
345
|
int num_base = 0;
|
346
346
|
long p, pe, eof, ts = 0, te = 0, tm = 0, sharp_s = 0, heredoc_e = 0;
|
347
347
|
long num_digits_s = 0, num_suffix_s = 0;
|
@@ -363,7 +363,8 @@ static VALUE lexer_advance(VALUE self)
|
|
363
363
|
stack = lexer->cs_stack;
|
364
364
|
top = lexer->cs_stack_top;
|
365
365
|
|
366
|
-
|
366
|
+
cmd_state = lexer->command_start;
|
367
|
+
lexer->command_start = 0;
|
367
368
|
|
368
369
|
%%{
|
369
370
|
write exec;
|
@@ -467,9 +468,9 @@ static int get_codepoint(Lexer *lexer, long p)
|
|
467
468
|
return NUM2INT(rb_ary_entry(lexer->source_pts, p));
|
468
469
|
}
|
469
470
|
|
470
|
-
static int arg_or_cmdarg(int
|
471
|
+
static int arg_or_cmdarg(int cmd_state)
|
471
472
|
{
|
472
|
-
if (
|
473
|
+
if (cmd_state) {
|
473
474
|
return lex_en_expr_cmdarg;
|
474
475
|
} else {
|
475
476
|
return lex_en_expr_arg;
|
@@ -1494,6 +1495,7 @@ void Init_lexer()
|
|
1494
1495
|
}
|
1495
1496
|
|
1496
1497
|
literal_start_interp_brace(current_literal);
|
1498
|
+
lexer->command_start = 1;
|
1497
1499
|
fnext expr_value;
|
1498
1500
|
fbreak;
|
1499
1501
|
}
|
@@ -1636,6 +1638,10 @@ void Init_lexer()
|
|
1636
1638
|
stack_state_push(&lexer->cond, 0);
|
1637
1639
|
stack_state_push(&lexer->cmdarg, 0);
|
1638
1640
|
lexer->paren_nest += 1;
|
1641
|
+
|
1642
|
+
if (lexer->version == 18) {
|
1643
|
+
lexer->command_start = 1;
|
1644
|
+
}
|
1639
1645
|
};
|
1640
1646
|
|
1641
1647
|
e_rparen = ')' % {
|
@@ -1649,7 +1655,7 @@ void Init_lexer()
|
|
1649
1655
|
if (STATIC_ENV_DECLARED(str)) {
|
1650
1656
|
fnext expr_endfn; fbreak;
|
1651
1657
|
} else {
|
1652
|
-
fnext *arg_or_cmdarg(
|
1658
|
+
fnext *arg_or_cmdarg(cmd_state); fbreak;
|
1653
1659
|
}
|
1654
1660
|
}
|
1655
1661
|
|
@@ -1794,13 +1800,17 @@ void Init_lexer()
|
|
1794
1800
|
*|;
|
1795
1801
|
|
1796
1802
|
expr_dot := |*
|
1797
|
-
constant
|
1803
|
+
constant
|
1804
|
+
=> { emit(tCONSTANT);
|
1805
|
+
fnext *arg_or_cmdarg(cmd_state); fbreak; };
|
1798
1806
|
|
1799
|
-
call_or_var
|
1807
|
+
call_or_var
|
1808
|
+
=> { emit(tIDENTIFIER);
|
1809
|
+
fnext *arg_or_cmdarg(cmd_state); fbreak; };
|
1800
1810
|
|
1801
1811
|
bareword ambiguous_fid_suffix
|
1802
1812
|
=> { emit_token(lexer, tFID, tok(lexer, ts, tm), ts, tm);
|
1803
|
-
fnext *arg_or_cmdarg(
|
1813
|
+
fnext *arg_or_cmdarg(cmd_state); p = tm - 1; fbreak; };
|
1804
1814
|
|
1805
1815
|
operator_fname |
|
1806
1816
|
operator_arithmetic |
|
@@ -1842,6 +1852,7 @@ void Init_lexer()
|
|
1842
1852
|
} else {
|
1843
1853
|
emit_token(lexer, tLCURLY, rb_str_new2("{"), te - 1, te);
|
1844
1854
|
}
|
1855
|
+
lexer->command_start = 1;
|
1845
1856
|
fnext expr_value; fbreak;
|
1846
1857
|
};
|
1847
1858
|
|
@@ -1939,6 +1950,7 @@ void Init_lexer()
|
|
1939
1950
|
} else {
|
1940
1951
|
emit_token(lexer, tLBRACE_ARG, rb_str_new2("{"), te - 1, te);
|
1941
1952
|
}
|
1953
|
+
lexer->command_start = 1;
|
1942
1954
|
fnext expr_value; fbreak;
|
1943
1955
|
};
|
1944
1956
|
|
@@ -2179,6 +2191,7 @@ void Init_lexer()
|
|
2179
2191
|
VALUE val = array_last(lexer->lambda_stack);
|
2180
2192
|
if (val != Qnil && NUM2INT(val) == lexer->paren_nest) {
|
2181
2193
|
rb_ary_pop(lexer->lambda_stack);
|
2194
|
+
lexer->command_start = 1;
|
2182
2195
|
emit(tLAMBEG);
|
2183
2196
|
} else {
|
2184
2197
|
emit(tLBRACE);
|
@@ -2208,6 +2221,7 @@ void Init_lexer()
|
|
2208
2221
|
|
2209
2222
|
keyword_modifier
|
2210
2223
|
=> { emit_table_KEYWORDS_BEGIN(lexer, tok(lexer, ts, te), ts, te);
|
2224
|
+
lexer->command_start = 1;
|
2211
2225
|
fnext expr_value; fbreak; };
|
2212
2226
|
|
2213
2227
|
label ( any - ':' )
|
@@ -2224,7 +2238,7 @@ void Init_lexer()
|
|
2224
2238
|
if (STATIC_ENV_DECLARED(ident)) {
|
2225
2239
|
fnext expr_end;
|
2226
2240
|
} else {
|
2227
|
-
fnext *arg_or_cmdarg(
|
2241
|
+
fnext *arg_or_cmdarg(cmd_state);
|
2228
2242
|
}
|
2229
2243
|
} else {
|
2230
2244
|
emit_token(lexer, tLABEL, tok(lexer, ts, te - 2), ts, te - 1);
|
@@ -2343,6 +2357,7 @@ void Init_lexer()
|
|
2343
2357
|
} else {
|
2344
2358
|
emit(tLCURLY);
|
2345
2359
|
}
|
2360
|
+
lexer->command_start = 1;
|
2346
2361
|
fnext expr_value; fbreak;
|
2347
2362
|
};
|
2348
2363
|
|
@@ -2354,6 +2369,7 @@ void Init_lexer()
|
|
2354
2369
|
} else {
|
2355
2370
|
emit_do(lexer, 0, ts, te);
|
2356
2371
|
}
|
2372
|
+
lexer->command_start = 1;
|
2357
2373
|
fnext expr_value; fbreak;
|
2358
2374
|
};
|
2359
2375
|
|
@@ -2372,6 +2388,7 @@ void Init_lexer()
|
|
2372
2388
|
|
2373
2389
|
keyword_with_value
|
2374
2390
|
=> { emit_table_KEYWORDS(lexer, tok(lexer, ts, te), ts, te);
|
2391
|
+
lexer->command_start = 1;
|
2375
2392
|
fnext expr_value; fbreak; };
|
2376
2393
|
|
2377
2394
|
keyword_with_mid
|
@@ -2398,7 +2415,7 @@ void Init_lexer()
|
|
2398
2415
|
if (STATIC_ENV_DECLARED(str)) {
|
2399
2416
|
fnext expr_end;
|
2400
2417
|
} else {
|
2401
|
-
fnext *arg_or_cmdarg(
|
2418
|
+
fnext *arg_or_cmdarg(cmd_state);
|
2402
2419
|
}
|
2403
2420
|
} else {
|
2404
2421
|
emit(k__ENCODING__);
|
@@ -2505,7 +2522,7 @@ void Init_lexer()
|
|
2505
2522
|
fgoto *push_literal(lexer, type, delimiter, ts, 0, 0, 0, 1);
|
2506
2523
|
};
|
2507
2524
|
|
2508
|
-
constant => { emit(tCONSTANT); fnext *arg_or_cmdarg(
|
2525
|
+
constant => { emit(tCONSTANT); fnext *arg_or_cmdarg(cmd_state); fbreak; };
|
2509
2526
|
|
2510
2527
|
constant ambiguous_const_suffix => {
|
2511
2528
|
emit_token(lexer, tCONSTANT, tok(lexer, ts, tm), ts, tm);
|
@@ -2623,7 +2640,10 @@ void Init_lexer()
|
|
2623
2640
|
|
2624
2641
|
w_newline => { fgoto leading_dot; };
|
2625
2642
|
|
2626
|
-
';'
|
2643
|
+
';'
|
2644
|
+
=> { emit(tSEMI);
|
2645
|
+
lexer->command_start = 1;
|
2646
|
+
fnext expr_value; fbreak; };
|
2627
2647
|
|
2628
2648
|
'\\' c_line {
|
2629
2649
|
diagnostic(lexer, severity_error, bare_backslash, Qnil,
|
@@ -2676,7 +2696,7 @@ void Init_lexer()
|
|
2676
2696
|
|
2677
2697
|
'__END__' ( c_eol - zlen ) => { p = pe - 3; };
|
2678
2698
|
|
2679
|
-
c_any => { fhold; fgoto expr_value; };
|
2699
|
+
c_any => { cmd_state = 1; fhold; fgoto expr_value; };
|
2680
2700
|
|
2681
2701
|
c_eof => do_eof;
|
2682
2702
|
*|;
|
data/lib/c_lexer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: c_lexer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.6.4.0
|
4
|
+
version: 2.6.4.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Bylich
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 2.6.4.
|
33
|
+
version: 2.6.4.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 2.6.4.
|
40
|
+
version: 2.6.4.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|