-
Notifications
You must be signed in to change notification settings - Fork 766
Closed
Description
Double forward slashes // used in a Cypher expression are tokenised as comments by the CypherLexer() no matter where they appear.
This blocks users from using URIs (for example) as parameter values.
from pygments.lexers import CypherLexer
lexer = CypherLexer()
s = '(p:Person {uri:"http://example.com/thing/1"})'
print(list(lexer.get_tokens(s)))[(Token.Comment.Single, '(p:Person {uri="http://example.com/thing/1"})\n')]
I would like to be able to escape the slashes but have not had success with \/\/ or backticks. If character escaping cannot be used, perhaps the regular expression in the lexer could be modified? It could instead only capture comments which:
- begin the line
- appear anywhere but are preceded by whitespace
From:
'comment': [
(r'^.*//.*\n', Comment.Single),
]
To:
'comment': [
(r'(?:[\s^])(//.*)\n', Comment.Single),
]
Metadata
Metadata
Assignees
Labels
No labels