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 +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 +12 -6
- data/lib/parser/ruby-next/version.rb +1 -1
- data/lib/parser/rubynext.y +134 -163
- metadata +6 -9
- data/lib/parser/ruby-next/lexer.rb +0 -25177
- data/lib/parser/ruby-next/lexer.rl +0 -2641
- data/lib/parser/rubynext.rb +0 -8383
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 599fb2ab28d4c14213e0f239c8c61f109bb99b250870c14473bd44b7d3bfb24c
|
4
|
+
data.tar.gz: dfbdb998d62c61daa43db9ed88f50039b12b7c0689d8e39102f4270ef1640559
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
###
|
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,6 +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
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
|
-
#
|
17
|
-
|
18
|
-
@lexer
|
19
|
-
@lexer.
|
20
|
-
@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
|
21
27
|
|
22
28
|
# Reset the state again
|
23
29
|
reset
|