parser 2.1.1 → 2.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +5 -1
- data/CHANGELOG.md +6 -0
- data/doc/AST_FORMAT.md +43 -8
- data/lib/parser/lexer.rl +11 -3
- data/lib/parser/runner.rb +1 -1
- data/lib/parser/version.rb +1 -1
- data/test/test_lexer.rb +5 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af4585f0f54966cb0ea90fc757545580f56cc42f
|
4
|
+
data.tar.gz: bc60ac2087e03379fc3932f13ba81823d59f555b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adc95d57bebd0e1cfaa53f08d13aec17cf3d86866cc257f43814204a41c1f1d0ba686dc0a6f367fc7e3f57235201e2c46a02714149e26d393a85bc5edf80395b
|
7
|
+
data.tar.gz: e54e2aa83194bc33d6d2f10ef1a7fd033902b34b0d91018e6d2227887cda5b4e7f38020f43235bc69e154d06948822ce0bcc3507b275b81059db3aa7c70210e1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/doc/AST_FORMAT.md
CHANGED
@@ -334,6 +334,8 @@ Format:
|
|
334
334
|
|
335
335
|
### Global variable
|
336
336
|
|
337
|
+
#### Regular global variable
|
338
|
+
|
337
339
|
Format:
|
338
340
|
|
339
341
|
~~~
|
@@ -342,6 +344,32 @@ Format:
|
|
342
344
|
~~~~ expression
|
343
345
|
~~~
|
344
346
|
|
347
|
+
#### Regular expression capture groups
|
348
|
+
|
349
|
+
Format:
|
350
|
+
|
351
|
+
~~~
|
352
|
+
(nth-ref 1)
|
353
|
+
"$1"
|
354
|
+
~~ expression
|
355
|
+
~~~
|
356
|
+
|
357
|
+
#### Regular expression back-references
|
358
|
+
|
359
|
+
Format:
|
360
|
+
|
361
|
+
~~~
|
362
|
+
(back-ref :$&)
|
363
|
+
"$&"
|
364
|
+
~~ expression
|
365
|
+
(back-ref :$`)
|
366
|
+
"$`"
|
367
|
+
(back-ref :$')
|
368
|
+
"$'"
|
369
|
+
(back-ref :$+)
|
370
|
+
"$+"
|
371
|
+
~~~
|
372
|
+
|
345
373
|
### Constant
|
346
374
|
|
347
375
|
#### Top-level constant
|
@@ -588,12 +616,12 @@ Logical operator-assignment features the same "incomplete assignments" and "inco
|
|
588
616
|
Format:
|
589
617
|
|
590
618
|
~~~
|
591
|
-
(or-asgn (
|
619
|
+
(or-asgn (ivasgn :@a) (int 1))
|
592
620
|
"@a ||= 1"
|
593
621
|
~~~ operator
|
594
622
|
~~~~~~~~ expression
|
595
623
|
|
596
|
-
(and-asgn (
|
624
|
+
(and-asgn (lvasgn :a) (int 1))
|
597
625
|
"a &&= 1"
|
598
626
|
~~~ operator
|
599
627
|
~~~~~~~ expression
|
@@ -602,10 +630,10 @@ Format:
|
|
602
630
|
Ruby_parser output for reference:
|
603
631
|
~~~
|
604
632
|
"@a ||= 1"
|
605
|
-
s(:op_asgn_or, s(:ivar, :@a), s(:
|
633
|
+
s(:op_asgn_or, s(:ivar, :@a), s(:ivasgn, :@a, s(:int, 1)))
|
606
634
|
|
607
635
|
"a &&= 1"
|
608
|
-
s(:op_asgn_and, s(:lvar, :a), s(:
|
636
|
+
s(:op_asgn_and, s(:lvar, :a), s(:lvasgn, :a, s(:int, 1)))
|
609
637
|
~~~
|
610
638
|
|
611
639
|
#### Method logical operator-assignment
|
@@ -1042,6 +1070,13 @@ Format:
|
|
1042
1070
|
~~~~~~~~~~~ expression
|
1043
1071
|
~~~
|
1044
1072
|
|
1073
|
+
~~~
|
1074
|
+
(or (lvar :foo) (lvar :bar))
|
1075
|
+
"foo or bar"
|
1076
|
+
~~ operator
|
1077
|
+
~~~~~~~~~~ expression
|
1078
|
+
~~~
|
1079
|
+
|
1045
1080
|
#### Unary (! not) (1.8)
|
1046
1081
|
|
1047
1082
|
Format:
|
@@ -1274,13 +1309,13 @@ Format:
|
|
1274
1309
|
Format:
|
1275
1310
|
|
1276
1311
|
~~~
|
1277
|
-
(while-post (lvar :condition) (
|
1312
|
+
(while-post (lvar :condition) (kwbegin (send nil :foo)))
|
1278
1313
|
"begin; foo; end while condition"
|
1279
1314
|
~~~~~ begin (begin)
|
1280
1315
|
~~~ end (begin)
|
1281
1316
|
~~~~~ keyword (while-post)
|
1282
1317
|
|
1283
|
-
(until-post (lvar :condition) (
|
1318
|
+
(until-post (lvar :condition) (kwbegin (send nil :foo)))
|
1284
1319
|
"begin; foo; end until condition"
|
1285
1320
|
~~~~~ begin (begin)
|
1286
1321
|
~~~ end (begin)
|
@@ -1292,7 +1327,7 @@ Format:
|
|
1292
1327
|
Format:
|
1293
1328
|
|
1294
1329
|
~~~
|
1295
|
-
(for (
|
1330
|
+
(for (lvasgn :a) (lvar :array) (send nil :p (lvar :a)))
|
1296
1331
|
"for a in array do p a; end"
|
1297
1332
|
~~~ keyword
|
1298
1333
|
~~ in
|
@@ -1305,7 +1340,7 @@ Format:
|
|
1305
1340
|
~~~ end
|
1306
1341
|
|
1307
1342
|
(for
|
1308
|
-
(mlhs (
|
1343
|
+
(mlhs (lvasgn :a) (lvasgn :b)) (lvar :array)
|
1309
1344
|
(send nil :p (lvar :a) (lvar :b)))
|
1310
1345
|
"for a, b in array; p a, b; end"
|
1311
1346
|
~~~
|
data/lib/parser/lexer.rl
CHANGED
@@ -2014,9 +2014,17 @@ class Parser::Lexer
|
|
2014
2014
|
=> local_ident;
|
2015
2015
|
|
2016
2016
|
bareword ambiguous_fid_suffix
|
2017
|
-
=> {
|
2018
|
-
|
2019
|
-
|
2017
|
+
=> {
|
2018
|
+
if tm == @te
|
2019
|
+
# Suffix was consumed, e.g. foo!
|
2020
|
+
emit(:tFID)
|
2021
|
+
else
|
2022
|
+
# Suffix was not consumed, e.g. foo!=
|
2023
|
+
emit(:tIDENTIFIER, tok(@ts, tm), @ts, tm)
|
2024
|
+
p = tm - 1
|
2025
|
+
end
|
2026
|
+
fnext expr_arg; fbreak;
|
2027
|
+
};
|
2020
2028
|
|
2021
2029
|
#
|
2022
2030
|
# OPERATORS
|
data/lib/parser/runner.rb
CHANGED
data/lib/parser/version.rb
CHANGED
data/test/test_lexer.rb
CHANGED
@@ -888,16 +888,17 @@ class TestLexer < Minitest::Test
|
|
888
888
|
end
|
889
889
|
|
890
890
|
def test_identifier
|
891
|
-
assert_scanned("identifier",
|
891
|
+
assert_scanned("identifier",
|
892
|
+
:tIDENTIFIER, "identifier")
|
892
893
|
end
|
893
894
|
|
894
895
|
def test_identifier_bang
|
895
896
|
assert_scanned("identifier!",
|
896
|
-
:tFID,
|
897
|
+
:tFID, "identifier!")
|
897
898
|
|
898
899
|
assert_scanned("identifier!=",
|
899
|
-
:
|
900
|
-
:tNEQ,
|
900
|
+
:tIDENTIFIER, "identifier",
|
901
|
+
:tNEQ, "!=")
|
901
902
|
end
|
902
903
|
|
903
904
|
def test_identifier_cmp
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Zotov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-01-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: ast
|