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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bd043e73889dc0f7bad2b24a2353199f79279bd1
4
- data.tar.gz: a20161bda1ac0a18221e6d2f7d113ea70359fda3
3
+ metadata.gz: af4585f0f54966cb0ea90fc757545580f56cc42f
4
+ data.tar.gz: bc60ac2087e03379fc3932f13ba81823d59f555b
5
5
  SHA512:
6
- metadata.gz: 3dbd1cc98702afb4a0c5825da36403b41f0e00d44d1204b71c3c9b1084a33024a5faa1ea8c58feddc14fe7d5c448f357134cfa6de22e2be99c4f955a6a978fdb
7
- data.tar.gz: 85ec9a63f96c123ff6bc72178d5a0c6505bd3e9568e66ba7fd795c03e0b9ba5302dcfd7fa10016ff1f0b081b8b8ec94b6102bb0796edcc2c6972889fb021974d
6
+ metadata.gz: adc95d57bebd0e1cfaa53f08d13aec17cf3d86866cc257f43814204a41c1f1d0ba686dc0a6f367fc7e3f57235201e2c46a02714149e26d393a85bc5edf80395b
7
+ data.tar.gz: e54e2aa83194bc33d6d2f10ef1a7fd033902b34b0d91018e6d2227887cda5b4e7f38020f43235bc69e154d06948822ce0bcc3507b275b81059db3aa7c70210e1
data/.travis.yml CHANGED
@@ -7,4 +7,8 @@ rvm:
7
7
  - jruby-18mode
8
8
  - jruby-19mode
9
9
  - rbx
10
- cache: bundler
10
+ before_install:
11
+ - gem update bundler
12
+ - bundle --version
13
+ - gem update --system 2.1.11
14
+ - gem --version
data/CHANGELOG.md CHANGED
@@ -1,6 +1,12 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ v2.1.2 (2014-01-05)
5
+ -------------------
6
+
7
+ Bugs fixed:
8
+ * lexer.rl: in "foo!= x", foo is tIDENTIFIER, not tFID (closes #126). (Peter Zotov)
9
+
4
10
  v2.1.1 (2013-12-25)
5
11
  -------------------
6
12
 
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 (iasgn :@a) (int 1))
619
+ (or-asgn (ivasgn :@a) (int 1))
592
620
  "@a ||= 1"
593
621
  ~~~ operator
594
622
  ~~~~~~~~ expression
595
623
 
596
- (and-asgn (lasgn :a) (int 1))
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(:iasgn, :@a, s(:int, 1)))
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(:lasgn, :a, s(:int, 1)))
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) (begin (send nil :foo)))
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) (begin (send nil :foo)))
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 (lasgn :a) (lvar :array) (send nil :p (lvar :a)))
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 (lasgn :a) (lasgn :b)) (lvar :array)
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
- => { emit(:tFID, tok(@ts, tm), @ts, tm)
2018
- p = tm - 1
2019
- fnext expr_arg; fbreak; };
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
@@ -72,7 +72,7 @@ module Parser
72
72
  @parser_class = Parser::Ruby20
73
73
  end
74
74
 
75
- @slop.on '21', 'Parse as Ruby trunk would (use with caution)' do
75
+ @slop.on '21', 'Parse as Ruby 2.1.0 would' do
76
76
  require 'parser/ruby21'
77
77
  @parser_class = Parser::Ruby21
78
78
  end
@@ -1,3 +1,3 @@
1
1
  module Parser
2
- VERSION = '2.1.1'
2
+ VERSION = '2.1.2'
3
3
  end
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", :tIDENTIFIER, "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, "identifier!")
897
+ :tFID, "identifier!")
897
898
 
898
899
  assert_scanned("identifier!=",
899
- :tFID, "identifier",
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.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: 2013-12-25 00:00:00.000000000 Z
11
+ date: 2014-01-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ast