summaryrefslogtreecommitdiff
path: root/pygments/lexers/graph.py
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2021-12-29 16:51:26 +0100
committerMatthäus G. Chajdas <dev@anteru.net>2021-12-29 16:51:26 +0100
commit7b3692f99d5100dd1471ec37e22e10fa37e54c30 (patch)
tree7206e6b9185d03fa7b25c7ad472b359ed8870d12 /pygments/lexers/graph.py
parenta8dcc0a28a0a8a738fcde542691f232842fd9290 (diff)
parentd07b86e4b7ff25ec6c9007fa3f526b78b092502f (diff)
downloadpygments-git-7b3692f99d5100dd1471ec37e22e10fa37e54c30.tar.gz
Merge branch 'master' of github.com:pygments/pygments; branch 'lexers_gh' of https://github.com/blu-base/pygments into blu-base-lexers_gh
Diffstat (limited to 'pygments/lexers/graph.py')
-rw-r--r--pygments/lexers/graph.py40
1 files changed, 30 insertions, 10 deletions
diff --git a/pygments/lexers/graph.py b/pygments/lexers/graph.py
index bd82f761..163cf804 100644
--- a/pygments/lexers/graph.py
+++ b/pygments/lexers/graph.py
@@ -36,15 +36,15 @@ class CypherLexer(RegexLexer):
tokens = {
'root': [
include('comment'),
- include('keywords'),
include('clauses'),
+ include('keywords'),
include('relations'),
include('strings'),
include('whitespace'),
include('barewords'),
],
'comment': [
- (r'^.*//.*\n', Comment.Single),
+ (r'^.*//.*$', Comment.Single),
],
'keywords': [
(r'(create|order|match|limit|set|skip|start|return|with|where|'
@@ -52,15 +52,35 @@ class CypherLexer(RegexLexer):
],
'clauses': [
# based on https://neo4j.com/docs/cypher-refcard/3.3/
+ (r'(create)(\s+)(index|unique)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(drop)(\s+)(contraint|index)(\s+)(on)\b',
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)),
+ (r'(ends)(\s+)(with)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(is)(\s+)(node)(\s+)(key)\b',
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)),
+ (r'(is)(\s+)(null|unique)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(load)(\s+)(csv)(\s+)(from)\b',
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)),
+ (r'(on)(\s+)(match|create)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(optional)(\s+)(match)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(order)(\s+)(by)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(starts)(\s+)(with)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(union)(\s+)(all)\b',
+ bygroups(Keyword, Whitespace, Keyword)),
+ (r'(using)(\s+)(periodic)(\s+)(commit)\b',
+ bygroups(Keyword, Whitespace, Keyword, Whitespace, Keyword)),
(r'(all|any|as|asc|ascending|assert|call|case|create|'
- r'create\s+index|create\s+unique|delete|desc|descending|'
- r'distinct|drop\s+constraint\s+on|drop\s+index\s+on|end|'
- r'ends\s+with|fieldterminator|foreach|in|is\s+node\s+key|'
- r'is\s+null|is\s+unique|limit|load\s+csv\s+from|match|merge|none|'
- r'not|null|on\s+match|on\s+create|optional\s+match|order\s+by|'
- r'remove|return|set|skip|single|start|starts\s+with|then|union|'
- r'union\s+all|unwind|using\s+periodic\s+commit|yield|where|when|'
- r'with)\b', Keyword),
+ r'delete|desc|descending|distinct|end|fieldterminator|'
+ r'foreach|in|limit|match|merge|none|not|null|'
+ r'remove|return|set|skip|single|start|then|union|'
+ r'unwind|yield|where|when|with)\b', Keyword),
],
'relations': [
(r'(-\[)(.*?)(\]->)', bygroups(Operator, using(this), Operator)),