Skip to content

Prolog lexer backslash escape does not work properly #1479

@marijnschraagen

Description

@marijnschraagen

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions