зеркало из https://github.com/github/ruby.git
[PRISM] Support US-ASCII symbols
This commit is contained in:
Родитель
d980c89273
Коммит
3d3d9e8397
|
@ -216,6 +216,9 @@ parse_string_symbol(const pm_symbol_node_t *symbol, const pm_parser_t *parser)
|
|||
else if (symbol->base.flags & PM_SYMBOL_FLAGS_FORCED_BINARY_ENCODING) {
|
||||
encoding = "ASCII-8BIT";
|
||||
}
|
||||
else if (symbol->base.flags & PM_SYMBOL_FLAGS_FORCED_US_ASCII_ENCODING) {
|
||||
encoding = "US-ASCII";
|
||||
}
|
||||
const uint8_t *start = pm_string_source(&symbol->unescaped);
|
||||
return parse_symbol(start, start + pm_string_length(&symbol->unescaped), encoding);
|
||||
}
|
||||
|
|
|
@ -791,6 +791,12 @@ module Prism
|
|||
# -*- coding: us-ascii -*-
|
||||
:"\xff"
|
||||
RUBY
|
||||
|
||||
# Test US-ASCII symbol in a ASCII-8BIT file
|
||||
assert_prism_eval(<<~'RUBY', raw: true)
|
||||
# -*- coding: ascii-8bit -*-
|
||||
:a
|
||||
RUBY
|
||||
end
|
||||
|
||||
def test_XStringNode
|
||||
|
|
Загрузка…
Ссылка в новой задаче