aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKevin Newton <kddnewton@gmail.com>2023-10-17 13:43:43 -0400
committergit <svn-admin@ruby-lang.org>2023-10-18 14:23:46 +0000
commit9c973f9555c2ccfb7f7637bde08a5261baad0e05 (patch)
tree17057931670170059e4b87fdcd2a2d4824da4378 /test
parent2a6f7cd9255b61e21cead0c761a513bde2899728 (diff)
downloadruby-9c973f9555c2ccfb7f7637bde08a5261baad0e05.tar.gz
[ruby/prism] Use the unescaped regexp to scan for capture groups
https://github.com/ruby/prism/commit/555551e8f2
Diffstat (limited to 'test')
-rw-r--r--test/prism/fixtures/regex.txt3
-rw-r--r--test/prism/snapshots/regex.txt92
2 files changed, 64 insertions, 31 deletions
diff --git a/test/prism/fixtures/regex.txt b/test/prism/fixtures/regex.txt
index 1e917e7de7..1f33b810ac 100644
--- a/test/prism/fixtures/regex.txt
+++ b/test/prism/fixtures/regex.txt
@@ -28,3 +28,6 @@ foo /bar/
%r#pound#
/aaa #{bbb}/o
+
+/(?<a\
+b>)/ =~ ""; ab
diff --git a/test/prism/snapshots/regex.txt b/test/prism/snapshots/regex.txt
index 5fa07265a3..dfc1e47040 100644
--- a/test/prism/snapshots/regex.txt
+++ b/test/prism/snapshots/regex.txt
@@ -1,8 +1,8 @@
-@ ProgramNode (location: (1,0)-(30,13))
-├── locals: [:foo]
+@ ProgramNode (location: (1,0)-(33,14))
+├── locals: [:foo, :ab]
└── statements:
- @ StatementsNode (location: (1,0)-(30,13))
- └── body: (length: 14)
+ @ StatementsNode (location: (1,0)-(33,14))
+ └── body: (length: 16)
├── @ CallNode (location: (1,0)-(1,9))
│ ├── receiver: ∅
│ ├── call_operator_loc: ∅
@@ -180,30 +180,60 @@
│ ├── closing_loc: (28,8)-(28,9) = "#"
│ ├── unescaped: "pound"
│ └── flags: ∅
- └── @ InterpolatedRegularExpressionNode (location: (30,0)-(30,13))
- ├── opening_loc: (30,0)-(30,1) = "/"
- ├── parts: (length: 2)
- │ ├── @ StringNode (location: (30,1)-(30,5))
- │ │ ├── flags: ∅
- │ │ ├── opening_loc: ∅
- │ │ ├── content_loc: (30,1)-(30,5) = "aaa "
- │ │ ├── closing_loc: ∅
- │ │ └── unescaped: "aaa "
- │ └── @ EmbeddedStatementsNode (location: (30,5)-(30,11))
- │ ├── opening_loc: (30,5)-(30,7) = "\#{"
- │ ├── statements:
- │ │ @ StatementsNode (location: (30,7)-(30,10))
- │ │ └── body: (length: 1)
- │ │ └── @ CallNode (location: (30,7)-(30,10))
- │ │ ├── receiver: ∅
- │ │ ├── call_operator_loc: ∅
- │ │ ├── message_loc: (30,7)-(30,10) = "bbb"
- │ │ ├── opening_loc: ∅
- │ │ ├── arguments: ∅
- │ │ ├── closing_loc: ∅
- │ │ ├── block: ∅
- │ │ ├── flags: variable_call
- │ │ └── name: :bbb
- │ └── closing_loc: (30,10)-(30,11) = "}"
- ├── closing_loc: (30,11)-(30,13) = "/o"
- └── flags: once
+ ├── @ InterpolatedRegularExpressionNode (location: (30,0)-(30,13))
+ │ ├── opening_loc: (30,0)-(30,1) = "/"
+ │ ├── parts: (length: 2)
+ │ │ ├── @ StringNode (location: (30,1)-(30,5))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── content_loc: (30,1)-(30,5) = "aaa "
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ └── unescaped: "aaa "
+ │ │ └── @ EmbeddedStatementsNode (location: (30,5)-(30,11))
+ │ │ ├── opening_loc: (30,5)-(30,7) = "\#{"
+ │ │ ├── statements:
+ │ │ │ @ StatementsNode (location: (30,7)-(30,10))
+ │ │ │ └── body: (length: 1)
+ │ │ │ └── @ CallNode (location: (30,7)-(30,10))
+ │ │ │ ├── receiver: ∅
+ │ │ │ ├── call_operator_loc: ∅
+ │ │ │ ├── message_loc: (30,7)-(30,10) = "bbb"
+ │ │ │ ├── opening_loc: ∅
+ │ │ │ ├── arguments: ∅
+ │ │ │ ├── closing_loc: ∅
+ │ │ │ ├── block: ∅
+ │ │ │ ├── flags: variable_call
+ │ │ │ └── name: :bbb
+ │ │ └── closing_loc: (30,10)-(30,11) = "}"
+ │ ├── closing_loc: (30,11)-(30,13) = "/o"
+ │ └── flags: once
+ ├── @ MatchWriteNode (location: (32,0)-(33,10))
+ │ ├── call:
+ │ │ @ CallNode (location: (32,0)-(33,10))
+ │ │ ├── receiver:
+ │ │ │ @ RegularExpressionNode (location: (32,0)-(33,4))
+ │ │ │ ├── opening_loc: (32,0)-(32,1) = "/"
+ │ │ │ ├── content_loc: (32,1)-(33,3) = "(?<a\\\nb>)"
+ │ │ │ ├── closing_loc: (33,3)-(33,4) = "/"
+ │ │ │ ├── unescaped: "(?<ab>)"
+ │ │ │ └── flags: ∅
+ │ │ ├── call_operator_loc: ∅
+ │ │ ├── message_loc: (33,5)-(33,7) = "=~"
+ │ │ ├── opening_loc: ∅
+ │ │ ├── arguments:
+ │ │ │ @ ArgumentsNode (location: (33,8)-(33,10))
+ │ │ │ └── arguments: (length: 1)
+ │ │ │ └── @ StringNode (location: (33,8)-(33,10))
+ │ │ │ ├── flags: ∅
+ │ │ │ ├── opening_loc: (33,8)-(33,9) = "\""
+ │ │ │ ├── content_loc: (33,9)-(33,9) = ""
+ │ │ │ ├── closing_loc: (33,9)-(33,10) = "\""
+ │ │ │ └── unescaped: ""
+ │ │ ├── closing_loc: ∅
+ │ │ ├── block: ∅
+ │ │ ├── flags: ∅
+ │ │ └── name: :=~
+ │ └── locals: [:ab]
+ └── @ LocalVariableReadNode (location: (33,12)-(33,14))
+ ├── name: :ab
+ └── depth: 0