Skip to content

Commit dba87e0

Browse files
authored
Merge pull request #3425 from Earlopain/parser-translator-octal-above-255
2 parents 3bcfdcf + 161c606 commit dba87e0

File tree

4 files changed

+69
-58
lines changed

4 files changed

+69
-58
lines changed

lib/prism/polyfill/append_as_bytes.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
String.include(
66
Module.new {
77
def append_as_bytes(*args)
8-
args.each { self.<<(_1.b) } # steep:ignore
8+
args.each do |arg|
9+
arg = Integer === arg ? [arg].pack("C") : arg.b
10+
self.<<(arg) # steep:ignore
11+
end
912
end
1013
}
1114
)

lib/prism/translation/parser/lexer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ def simplify_string?(value, quote)
725725
def escape_build(value, control, meta)
726726
value &= 0x9f if control
727727
value |= 0x80 if meta
728-
value.chr
728+
value
729729
end
730730

731731
# Read an escape out of the string scanner, given the control and meta

test/prism/fixtures/strings.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ baz
126126

127127
"ち\xE3\x81\xFF"
128128

129+
"\777"
130+
129131
%[abc]
130132

131133
%(abc)

test/prism/snapshots/strings.txt

Lines changed: 62 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)