зеркало из https://github.com/github/ruby.git
[ruby/yarp] Fix string delimiter with "@" confused for embedded
variable (https://github.com/ruby/yarp/pull/1521) https://github.com/ruby/yarp/commit/3ec0699622
This commit is contained in:
Родитель
e50b7bf784
Коммит
4012ba4ecf
|
@ -152,6 +152,13 @@ module YARP
|
|||
]
|
||||
end
|
||||
|
||||
def test_incomplete_instance_var_string
|
||||
assert_errors expression('%@#@@#'), '%@#@@#', [
|
||||
["Incomplete instance variable", 4..5],
|
||||
["Expected a newline or semicolon after the statement", 4..4]
|
||||
]
|
||||
end
|
||||
|
||||
def test_unterminated_s_symbol
|
||||
assert_errors expression("%s[abc"), "%s[abc", [
|
||||
["Expected a closing delimiter for the dynamic symbol", 3..3]
|
||||
|
|
|
@ -99,3 +99,7 @@
|
|||
?a "a"
|
||||
|
||||
%Q{abc}
|
||||
|
||||
%^#$^#
|
||||
|
||||
%@#@#
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
@ ProgramNode (location: (0...506))
|
||||
@ ProgramNode (location: (0...520))
|
||||
├── locals: []
|
||||
└── statements:
|
||||
@ StatementsNode (location: (0...506))
|
||||
└── body: (length: 48)
|
||||
@ StatementsNode (location: (0...520))
|
||||
└── body: (length: 50)
|
||||
├── @ StringNode (location: (0...6))
|
||||
│ ├── flags: ∅
|
||||
│ ├── opening_loc: (0...2) = "%%"
|
||||
|
@ -496,9 +496,21 @@
|
|||
│ ├── content_loc: (495...496) = "a"
|
||||
│ ├── closing_loc: (496...497) = "\""
|
||||
│ └── unescaped: "a"
|
||||
└── @ StringNode (location: (499...506))
|
||||
├── @ StringNode (location: (499...506))
|
||||
│ ├── flags: ∅
|
||||
│ ├── opening_loc: (499...502) = "%Q{"
|
||||
│ ├── content_loc: (502...505) = "abc"
|
||||
│ ├── closing_loc: (505...506) = "}"
|
||||
│ └── unescaped: "abc"
|
||||
├── @ StringNode (location: (508...513))
|
||||
│ ├── flags: ∅
|
||||
│ ├── opening_loc: (508...510) = "%^"
|
||||
│ ├── content_loc: (510...512) = "\#$"
|
||||
│ ├── closing_loc: (512...513) = "^"
|
||||
│ └── unescaped: "\#$"
|
||||
└── @ StringNode (location: (516...520))
|
||||
├── flags: ∅
|
||||
├── opening_loc: (499...502) = "%Q{"
|
||||
├── content_loc: (502...505) = "abc"
|
||||
├── closing_loc: (505...506) = "}"
|
||||
└── unescaped: "abc"
|
||||
├── opening_loc: (516...518) = "%@"
|
||||
├── content_loc: (518...519) = "#"
|
||||
├── closing_loc: (519...520) = "@"
|
||||
└── unescaped: "#"
|
||||
|
|
|
@ -5801,7 +5801,7 @@ lex_interpolation(yp_parser_t *parser, const uint8_t *pound) {
|
|||
// If we didn't get an valid interpolation, then this is just regular
|
||||
// string content. This is like if we get "#@-". In this case the caller
|
||||
// should keep lexing.
|
||||
parser->current.end = variable;
|
||||
parser->current.end = pound + 1;
|
||||
return YP_TOKEN_NOT_PROVIDED;
|
||||
}
|
||||
case '$':
|
||||
|
|
Загрузка…
Ссылка в новой задаче