ruby-next-parser 3.2.2.0 → 3.4.0.1

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: 73904c549d34418483631fcb2ad1ceb3e2093454d8370f9594b35c37f029eab7
4
- data.tar.gz: 2ba3538042e09b993d2e8283a66b686cc20ee5907ef8875908fea4139e500962
3
+ metadata.gz: f5ad4ea427fa8dfa429b019a2a3d3bdf10a2d67854390b8ec949e9af86dad85a
4
+ data.tar.gz: 450bede732c40180fb11daf0ff72fb2ee9bb81ad866f05aba15b7fdc723612d7
5
5
  SHA512:
6
- metadata.gz: 74663daa4754d89b9ec0ee4f54ccb648b5d22182b897c297449e3e0c28ba74071fa080f3d1d886e34c296f0c101537ebd28fa525321eb3b4848662bbaab5a7cb
7
- data.tar.gz: 5cce4bdfba933b91f8559cb8ca747d897a18b174d46ac8f69f88091d648f7a622daf9dbaf67b26c1e6c4b73f5d06ffdb93924f0c38fda3903ec8b564ba6e14a1
6
+ metadata.gz: d079cf082d1249aad86b8297401e58d49dde5d92aa9110ef6f75bb6bbebf61cbd0ca31722ad029e2b0590cf3a8d2edeec9c79d08ab39da5575ea4006cb663738
7
+ data.tar.gz: 10822dfee68206cd41cc8cd0d05e0a9e209b2f427b64c6c4756f47d5921c20d6ca92aeb6f5560235aa3b295541491b1df5d4be3bc9d24fc1fe980a58c87f86cd
@@ -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,11 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
 
4
- if RUBY_ENGINE == 'truffleruby'
5
- require_relative "lexer-F0"
6
- else
7
- require_relative "lexer-F1"
8
- end
4
+ # if RUBY_ENGINE == 'truffleruby'
5
+ # require_relative "lexer-F0"
6
+ # else
7
+ # require_relative "lexer-F1"
8
+ # end
9
9
  require_relative "builder"
10
10
  require_relative "ast/processor"
11
11
 
@@ -18,11 +18,12 @@ module Parser
18
18
  # Extend builder
19
19
  @builder.singleton_class.prepend(Builders::Next)
20
20
 
21
- # Use custom lexer
22
- @lexer = Lexer::Next.new(version)
23
- @lexer.diagnostics = @diagnostics
24
- @lexer.static_env = @static_env
25
- @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
26
27
 
27
28
  # Reset the state again
28
29
  reset
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Parser
4
- NEXT_VERSION = "3.2.2.0"
4
+ NEXT_VERSION = "3.4.0.1"
5
5
  end