ruby-next-parser 3.1.1.3 → 3.4.0.0

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: 39fbce877db754dc42bbe2a0c2519dac3be7226575fb52851fee64d6a89f8448
4
- data.tar.gz: d5b4ae1d7d408579a514f369dc71abfd85f78950ff35010facccb81b94061401
3
+ metadata.gz: 599fb2ab28d4c14213e0f239c8c61f109bb99b250870c14473bd44b7d3bfb24c
4
+ data.tar.gz: dfbdb998d62c61daa43db9ed88f50039b12b7c0689d8e39102f4270ef1640559
5
5
  SHA512:
6
- metadata.gz: 39b63ec22f3ecce5e5f8dd2790c799f840a4a651aa72ad074ec39c695687ba55a9d073d304a07f0573a279ceb899ad660fe5a206d4df817470a47678ee80aa0e
7
- data.tar.gz: fb3c804925cff1dd7d08c12856c7937f9c8404f2305294684a40b0250a6bda9ec529aac05804334a101fbd13624b8905a38137b7b27a77e2251b2997e587326a
6
+ metadata.gz: e7d9d5aa13d446c071d51b466bf00974eafa328fba0895a3b52d96bcc536d2128d7301e948cf5fcda778dffdd0b21df0ba6711bcef1efa2400b9ebd0cca9cd67
7
+ data.tar.gz: f0dfb8fc79df212ac1f1856ac11fd2b57b7530317cec3540fd1cef7d0235a5a1c9386a953f8299adae492688ced8d2792941d1b21e19fa644093e9c3c12f6004
@@ -1,14 +1,24 @@
1
1
  Ruby Next AST format additions
2
2
  =======================
3
3
 
4
- ### Method reference operator
4
+ ### Pattern matching non-local variables
5
5
 
6
6
  Format:
7
7
 
8
8
  ~~~
9
- (meth-ref (self) :foo)
10
- "self.:foo"
11
- ^^ dot
12
- ^^^ selector
13
- ^^^^^^^^^ expression
9
+ (in_pattern
10
+ (match_as
11
+ (int 1),
12
+ (match_var (ivar :@a))))
13
+
14
+ "in 1 => @a then true"
15
+ ~~~
16
+
17
+ ~~~
18
+ (in_pattern
19
+ (match_as
20
+ (int 1),
21
+ (match_var (gvar :$a))))
22
+
23
+ "in 1 => $a then true"
14
24
  ~~~
@@ -6,9 +6,11 @@ require "parser/ast/processor"
6
6
  module Parser
7
7
  module AST
8
8
  class Processor
9
- def on_meth_ref(node)
10
- node
11
- end
9
+ # Define new node callbacks here
10
+ #
11
+ # def on_meth_ref(node)
12
+ # node
13
+ # end
12
14
  end
13
15
  end
14
16
  end
@@ -6,11 +6,6 @@ require_relative "meta"
6
6
  module Parser
7
7
  # Add RubyNext specific builder methods
8
8
  module Builders::Next
9
- def method_ref(receiver, dot_t, selector_t)
10
- n(:meth_ref, [ receiver, value(selector_t).to_sym ],
11
- send_map(receiver, dot_t, selector_t, nil, [], nil))
12
- end
13
-
14
9
  def match_var(var)
15
10
  return super(var) unless var.is_a?(::Parser::AST::Node)
16
11
 
@@ -5,9 +5,11 @@ require "parser/meta"
5
5
  module Parser
6
6
  # Parser metadata
7
7
  module Meta
8
- NEXT_NODE_TYPES = (NODE_TYPES + %i[meth_ref]).to_set.freeze
8
+ # This is how you can add new node types to the parser
9
+ #
10
+ # NEXT_NODE_TYPES = (NODE_TYPES + %i[meth_ref]).to_set.freeze
9
11
 
10
- remove_const(:NODE_TYPES)
11
- const_set(:NODE_TYPES, NEXT_NODE_TYPES)
12
+ # remove_const(:NODE_TYPES)
13
+ # const_set(:NODE_TYPES, NEXT_NODE_TYPES)
12
14
  end
13
15
  end
@@ -1,6 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "lexer"
3
+
4
+ # if RUBY_ENGINE == 'truffleruby'
5
+ # require_relative "lexer-F0"
6
+ # else
7
+ # require_relative "lexer-F1"
8
+ # end
4
9
  require_relative "builder"
5
10
  require_relative "ast/processor"
6
11
 
@@ -13,11 +18,12 @@ module Parser
13
18
  # Extend builder
14
19
  @builder.singleton_class.prepend(Builders::Next)
15
20
 
16
- # Use custom lexer
17
- @lexer = Lexer::Next.new(version)
18
- @lexer.diagnostics = @diagnostics
19
- @lexer.static_env = @static_env
20
- @lexer.context = @context
21
+ # Here is how to use a custom lexer
22
+ #
23
+ # @lexer = Lexer::Next.new(version)
24
+ # @lexer.diagnostics = @diagnostics
25
+ # @lexer.static_env = @static_env
26
+ # @lexer.context = @context
21
27
 
22
28
  # Reset the state again
23
29
  reset
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parser
4
- NEXT_VERSION = "3.1.1.3"
4
+ NEXT_VERSION = "3.4.0.0"
5
5
  end