-
Notifications
You must be signed in to change notification settings - Fork 740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix character escaping in Perl lexer #1549
Fix character escaping in Perl lexer #1549
Conversation
@miparnisari I am very much out of my depth with Perl but tried to experiment with how it handles the |
Do you mean you get "foar"? \b is a backspace http://www.java2s.com/Code/Perl/String/BackslashEscapesinPerl.htm |
@jeremychan Sorry, right you are. Thanks for the correction! I'll have a closer look at that list and see if I need to make any more changes :) |
It seems surprisingly difficult to determine the valid escape sequences in a Perl string. Using a combination of the lists from the Perl regular expression documentation and the Encode::Escape CPAN module, I've added more robust escaping support. |
In single- and double-quoted strings, the Perl lexer currently tokenises `\` as an error if it is not followed by a character in part of a recognised escape sequence. This is a bug. Perl accepts the use of `\` in single- and double-quoted strings even if it is not part of a valid escape sequence. This commit permits the use of `\` in single-quoted and double-quoted strings as well as increasing the range of escape sequences that are recognised in double-quoted strings.
In single-quoted strings, the Perl lexer currently tokenises
\
as an error if it is followed by any character other than a'
. This is a bug. Perl accepts the use of\
in single-quoted strings.In the course of fixing this, errors in the handling of character escaping in double-quoted strings was also addressed. In that case,
$
and@
are also valid characters to escape. The use of\
can still produceError
tokens in double-quoted strings if followed by another character.This fixes #1163.