parser 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/parser/ruby20.y CHANGED
@@ -675,11 +675,23 @@ rule
675
675
  }
676
676
  | primary_value tCOLON2 tCONSTANT tOP_ASGN arg
677
677
  {
678
- diagnostic(:error, :dynamic_const, val[2], [ val[3] ])
678
+ if in_def?
679
+ diagnostic(:error, :dynamic_const, val[2], [ val[3] ])
680
+ end
681
+
682
+ const = @builder.assignable(
683
+ @builder.const_fetch(val[0], val[1], val[2]))
684
+ result = @builder.op_assign(const, val[3], val[4])
679
685
  }
680
686
  | tCOLON3 tCONSTANT tOP_ASGN arg
681
687
  {
682
- diagnostic(:error, :dynamic_const, val[1], [ val[2] ])
688
+ if in_def?
689
+ diagnostic(:error, :dynamic_const, val[1], [ val[2] ])
690
+ end
691
+
692
+ const = @builder.assignable(
693
+ @builder.const_global(val[0], val[1]))
694
+ result = @builder.op_assign(const, val[2], val[3])
683
695
  }
684
696
  | backref tOP_ASGN arg
685
697
  {
@@ -2311,6 +2323,8 @@ end
2311
2323
 
2312
2324
  require 'parser'
2313
2325
 
2326
+ Parser.check_for_encoding_support
2327
+
2314
2328
  ---- inner
2315
2329
 
2316
2330
  def version