This project is closed and read-only.
Backport #8375
closedLexer error when specific character sequence occurs in string literals
Added by dimitri-lo2u (Dimitri Geshef) over 13 years ago. Updated about 13 years ago.
Updated by Eregon (Benoit Daloze) over 13 years ago
Actions
#1
[ruby-core:54847]
The complete error is:
$ ruby -e 'problematic_string = "#$%"'
-e:1: syntax error, unexpected $undefined
problematic_string = "#$%"
^
-e:1: unterminated string meets end of file
So this is because it expects a global named $% but this is an invalid global name.
followed by (@@ or @ or $) is interpolating the following variable in double-quoted strings.¶
It would be nice if the error message could be clearer.
(I personally dislike the special syntax for # (@@ or @ or $) instead of plain #{expr},
it leads to weird cases with $" ($LOADED_FEATURES): "#$" and "#$"").
It can be avoided by using "#$%" or using simple quotes as '#$%'.
Updated by nobu (Nobuyoshi Nakada) over 13 years ago
Actions
#2
- Status changed from Open to Closed
- % Done changed from 0 to 100
This issue was solved with changeset r40607.
Dimitri, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
parse.y: fail if invalid name
- parse.y (parser_yylex): fail if $, @, @@ are not followed by a valid
name character. [ruby-core:54846] [Bug #8375].
Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago
Actions
#3
- Tracker changed from Bug to Backport
- Project changed from Ruby to 15
- Status changed from Closed to Assigned
- Assignee set to nagachika (Tomoyuki Chikanaga)
Updated by matz (Yukihiro Matsumoto) over 13 years ago
Actions
#4
[ruby-core:54885]
I'd like to treat them as mere strings rather than errors.
Matz.
Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago
Actions
#5
[ruby-core:54888]
- Assignee changed from nagachika (Tomoyuki Chikanaga) to nobu (Nobuyoshi Nakada)
Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago
Actions
#6
[ruby-core:54918]
- Assignee changed from nobu (Nobuyoshi Nakada) to nagachika (Tomoyuki Chikanaga)
add r40635 for backport.
Updated by nagachika (Tomoyuki Chikanaga) over 13 years ago
Actions
#7
- Status changed from Assigned to Closed
This issue was solved with changeset r40650.
Dimitri, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 40606,40607,40635: [Backport #8375]
test_scanner_events.rb: assert_location
* test/ripper/test_scanner_events.rb (TestRipper#assert_location):
rename so skipped in backtraces.
* parse.y (parser_yylex): fail if $, @, @@ are not followed by a valid
name character. [ruby-core:54846] [Bug #8375].
* parse.y (parser_peek_variable_name): treat invalid global, class,
and instance variable names as mere strings rather than errors.
[ruby-core:54885] [Bug #8375]
Updated by sakuro (Sakuro OZAWA) about 13 years ago
Actions
#8
[ruby-core:56325]
=begin
# The bug occurs in MRI1.9.3... ruby -v = ruby 1.9.3p374 (2013-01-15) [i386-mingw32]
Is this to be backported to 1.9.3?
=end
Updated by nagachika (Tomoyuki Chikanaga) about 13 years ago
Actions
#9
- Project changed from 15 to 13
- Status changed from Closed to Assigned
- Assignee changed from nagachika (Tomoyuki Chikanaga) to usa (Usaku NAKAMURA)
Thanks you for your notice! I move this ticket to Backport93.
usa-san will make a judgement about it.
Updated by usa (Usaku NAKAMURA) about 13 years ago
Actions
#10
- Status changed from Assigned to Closed
This issue was solved with changeset r42462.
Dimitri, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
merge revision(s) 40606,40607,40635: [Backport #8375]
test_scanner_events.rb: assert_location
* test/ripper/test_scanner_events.rb (TestRipper#assert_location):
rename so skipped in backtraces.
* parse.y (parser_yylex): fail if $, @, @@ are not followed by a valid
name character. [ruby-core:54846] [Bug #8375].
* parse.y (parser_peek_variable_name): treat invalid global, class,
and instance variable names as mere strings rather than errors.
[ruby-core:54885] [Bug #8375]