Skip to content

Prolog lexer backslash escape does not work properly #1479

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

Closed
marijnschraagen opened this issue Jun 14, 2020 · 1 comment
Closed

Prolog lexer backslash escape does not work properly #1479

marijnschraagen opened this issue Jun 14, 2020 · 1 comment
Assignees
Milestone

Comments

@marijnschraagen
Copy link

The Prolog lexer does not recognize strings with an escaped (i.e., double) backslash.

For example the following code is valid Prolog:

writeln("abc\"def").
writeln("abc\\def").

When executed in Prolog the " and \ characters are escaped, so this results in

abc"def
abc\def

Pygments however detects a syntax error on the second line:
pygments_prolog_syntax_error
Note that the Github highlighter for Prolog does it right on the second line but now there is a problem in escaping " on the first line.

The behavior should be the same as in, e.g., Python:

print("abc\"def")
print("abc\\def")

pygments_python_syntax_ok

@Anteru Anteru self-assigned this Jun 14, 2020
@Anteru Anteru added this to the 2.11.0 milestone Nov 13, 2021
@Anteru Anteru closed this as completed in d754437 Nov 13, 2021
@Anteru
Copy link
Collaborator

Anteru commented Nov 13, 2021

Fixed, thanks for the report!

hwayne pushed a commit to hwayne/pygments that referenced this issue Nov 29, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants