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 +4 -4
- data/lib/parser/ruby-next/AST_FORMAT.md +16 -6
- data/lib/parser/ruby-next/ast/processor.rb +5 -3
- data/lib/parser/ruby-next/builder.rb +0 -5
- data/lib/parser/ruby-next/meta.rb +5 -3
- data/lib/parser/ruby-next/parser_ext.rb +11 -10
- data/lib/parser/ruby-next/version.rb +1 -1
- data/lib/parser/rubynext.rb +6408 -6509
- data/lib/parser/rubynext.y +111 -161
- metadata +6 -9
- data/lib/parser/ruby-next/lexer-F0.rb +0 -12957
- data/lib/parser/ruby-next/lexer-F1.rb +0 -14968
- data/lib/parser/ruby-next/lexer.rl +0 -2103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5ad4ea427fa8dfa429b019a2a3d3bdf10a2d67854390b8ec949e9af86dad85a
|
4
|
+
data.tar.gz: 450bede732c40180fb11daf0ff72fb2ee9bb81ad866f05aba15b7fdc723612d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
###
|
4
|
+
### Pattern matching non-local variables
|
5
5
|
|
6
6
|
Format:
|
7
7
|
|
8
8
|
~~~
|
9
|
-
(
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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,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
|
-
|
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
|
-
|
6
|
-
else
|
7
|
-
|
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
|
-
#
|
22
|
-
|
23
|
-
@lexer
|
24
|
-
@lexer.
|
25
|
-
@lexer.
|
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
|