ruby-next-parser 2.8.0.3 → 2.8.0.4

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
  SHA256:
3
- metadata.gz: df9072e496b8b8f626aa8a6b6f09ce96269bf683ad6b60b50398d8f4f674d478
4
- data.tar.gz: f3aa12ca97bd2075a8d9daa5e6fb0c4213335177b2a11edea3dfdca50b22ff69
3
+ metadata.gz: caa83687cc10df513ca9cd9b3aa18360667af34b2b4c9892493654306d09f43f
4
+ data.tar.gz: 9511abf629e5c708ddb8b6fe833883ef7f79fcbf90329541844aeec54019ff51
5
5
  SHA512:
6
- metadata.gz: 583b9ebe9bcdc6f101bf00cc55c13ab5999feb6670740a3980155099ac5d24289d341bc08ad128cd788db119ff4f0b9a7f4c8d1f65b651e364fddd83dce17e12
7
- data.tar.gz: dad17b7a920ef51fdcd1d4d6bbce94ab826398028409fa81cbfa2850de7255855c7da134c16baf99ed7e060821db8c3749869771c5681d21005bc8bcc0cbd082
6
+ metadata.gz: a9b0f2741e01fdfa3f6661e5805cf59600d3a8ca570d2f0bb02dd9241f4375c7073d2837be27bb1ecf911f5b97f2446bb8b44fdda20cafbf7abb4b75088bf71e
7
+ data.tar.gz: 9a85c3a5e1ff4f248dd3626b606ad46bd35d563be2f0def0ec09046a59c212014cfca3c77aae585419ae8ba1faad457fa93a70d059a1bc139d9c86aff6c56238
@@ -39,3 +39,26 @@ Format:
39
39
  ^ assignment
40
40
  ~~~~~~~~~~~~~~~~~~~ expression
41
41
  ~~~
42
+
43
+
44
+ ### Right-hand assignment
45
+
46
+ Format:
47
+
48
+ ~~~
49
+ (rasgn (int 1) (lvasgn :a))
50
+ "1 => a"
51
+ ~~~~~~ expression
52
+ ~~ operator
53
+ ~~~
54
+
55
+ #### Multiple right-hand assignment
56
+
57
+ Format:
58
+
59
+ ~~~
60
+ (mrasgn (send (int 13) :divmod (int 5)) (mlhs (lvasgn :a) (lvasgn :b)))
61
+ "13.divmod(5) => a,b"
62
+ ~~~~~~~~~~~~~~~~~~~ expression
63
+ ^^ operator
64
+ ~~~
@@ -6,8 +6,15 @@ require "parser/ast/processor"
6
6
  module Parser
7
7
  module AST
8
8
  class Processor
9
- alias on_def_e on_def
10
- alias on_defs_e on_defs
9
+ unless method_defined?(:on_def_e)
10
+ alias on_def_e on_def
11
+ alias on_defs_e on_defs
12
+ end
13
+
14
+ unless method_defined?(:on_rasgn)
15
+ alias on_rasgn process_regular_node
16
+ alias on_mrasgn process_regular_node
17
+ end
11
18
  end
12
19
  end
13
20
  end
@@ -9,13 +9,13 @@ module Parser
9
9
  def method_ref(receiver, dot_t, selector_t)
10
10
  n(:meth_ref, [ receiver, value(selector_t).to_sym ],
11
11
  send_map(receiver, dot_t, selector_t, nil, [], nil))
12
- end
12
+ end unless method_defined?(:method_ref)
13
13
 
14
14
  def def_endless_method(def_t, name_t, args,
15
15
  assignment_t, body)
16
16
  n(:def_e, [ value(name_t).to_sym, args, body ],
17
17
  endless_definition_map(def_t, nil, name_t, assignment_t, body))
18
- end
18
+ end unless method_defined?(:def_endless_method)
19
19
 
20
20
  def def_endless_singleton(def_t, definee, dot_t,
21
21
  name_t, args,
@@ -24,7 +24,18 @@ module Parser
24
24
 
25
25
  n(:defs_e, [ definee, value(name_t).to_sym, args, body ],
26
26
  endless_definition_map(def_t, dot_t, name_t, assignment_t, body))
27
- end
27
+ end unless method_defined?(:def_endless_singleton)
28
+
29
+ def rassign(lhs, assoc_t, rhs)
30
+ n(:rasgn, [lhs, rhs], binary_op_map(lhs, assoc_t, rhs))
31
+ end unless method_defined?(:rassign)
32
+
33
+ def multi_rassign(lhs, assoc_t, rhs)
34
+ n(:mrasgn, [ lhs, rhs ],
35
+ binary_op_map(lhs, assoc_t, rhs))
36
+ end unless method_defined?(:multi_rassign)
37
+
38
+ private
28
39
 
29
40
  def endless_definition_map(keyword_t, operator_t, name_t, assignment_t, body_e)
30
41
  body_l = body_e.loc.expression
@@ -32,9 +43,7 @@ module Parser
32
43
  Source::Map::EndlessDefinition.new(loc(keyword_t),
33
44
  loc(operator_t), loc(name_t),
34
45
  loc(assignment_t), body_l)
35
- end
36
-
37
- private
46
+ end unless private_method_defined?(:endless_definition_map)
38
47
 
39
48
  def validate_definee(definee)
40
49
  case definee.type
@@ -46,6 +55,6 @@ module Parser
46
55
  else
47
56
  true
48
57
  end
49
- end
58
+ end unless private_method_defined?(:validate_definee)
50
59
  end
51
60
  end
@@ -5,7 +5,7 @@ require "parser/meta"
5
5
  module Parser
6
6
  # Parser metadata
7
7
  module Meta
8
- NEXT_NODE_TYPES = (NODE_TYPES + %i[meth_ref def_e defs_e]).freeze
8
+ NEXT_NODE_TYPES = (NODE_TYPES + %i[meth_ref def_e defs_e rasgn mrasgn]).to_set.freeze
9
9
 
10
10
  remove_const(:NODE_TYPES)
11
11
  const_set(:NODE_TYPES, NEXT_NODE_TYPES)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative "lexer"
4
4
  require_relative "builder"
5
- require_relative "source/map/endless_definition"
5
+ require_relative "source/map/endless_definition" unless defined?(Parser::Source::Map::EndlessDefinition)
6
6
  require_relative "ast/processor"
7
7
 
8
8
  module Parser
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parser
4
- NEXT_VERSION = "2.8.0.3"
4
+ NEXT_VERSION = "2.8.0.4"
5
5
  end