Skip to content

Commit fbcf4ea

Browse files
authored
Merge pull request #66 from ruby-syntax-tree/pretty-print-regexp-optinos
Options on regexp
2 parents 42597db + d59882a commit fbcf4ea

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

lib/syntax_tree/node.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7456,6 +7456,7 @@ def deconstruct_keys(_keys)
74567456
{
74577457
beginning: beginning,
74587458
ending: ending,
7459+
options: options,
74597460
parts: parts,
74607461
location: location,
74617462
comments: comments
@@ -7490,18 +7491,22 @@ def format(q)
74907491
end
74917492

74927493
q.text("}")
7493-
q.text(ending[1..])
7494+
q.text(options)
74947495
end
74957496
else
74967497
q.group do
74977498
q.text("/")
74987499
q.format_each(parts)
74997500
q.text("/")
7500-
q.text(ending[1..])
7501+
q.text(options)
75017502
end
75027503
end
75037504
end
75047505

7506+
def options
7507+
ending[1..]
7508+
end
7509+
75057510
private
75067511

75077512
def include?(pattern)

lib/syntax_tree/visitor/field_visitor.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,7 @@ def visit_regexp_end(node)
738738
def visit_regexp_literal(node)
739739
node(node, "regexp_literal") do
740740
list("parts", node.parts)
741+
field("options", node.options)
741742
comments(node)
742743
end
743744
end

0 commit comments

Comments
 (0)