diff options
author | ilezhankin <ilezhankin@yandex-team.ru> | 2022-02-10 16:45:55 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:55 +0300 |
commit | 1d125034f06575234f83f24f08677955133f140e (patch) | |
tree | ec05fbbd61dc118d5de37f206ab978cff58774bd /contrib/python/Pygments/py3/pygments/lexers/graph.py | |
parent | 3a7a498715ef1b66f5054455421b845e45e3a653 (diff) | |
download | ydb-1d125034f06575234f83f24f08677955133f140e.tar.gz |
Restoring authorship annotation for <ilezhankin@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/python/Pygments/py3/pygments/lexers/graph.py')
-rw-r--r-- | contrib/python/Pygments/py3/pygments/lexers/graph.py | 134 |
1 files changed, 67 insertions, 67 deletions
diff --git a/contrib/python/Pygments/py3/pygments/lexers/graph.py b/contrib/python/Pygments/py3/pygments/lexers/graph.py index 2af56af26b..bc1cb70efa 100644 --- a/contrib/python/Pygments/py3/pygments/lexers/graph.py +++ b/contrib/python/Pygments/py3/pygments/lexers/graph.py @@ -1,56 +1,56 @@ -""" - pygments.lexers.graph - ~~~~~~~~~~~~~~~~~~~~~ - - Lexers for graph query languages. - +""" + pygments.lexers.graph + ~~~~~~~~~~~~~~~~~~~~~ + + Lexers for graph query languages. + :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. - :license: BSD, see LICENSE for details. -""" - -import re - + :license: BSD, see LICENSE for details. +""" + +import re + from pygments.lexer import RegexLexer, include, bygroups, using, this, words -from pygments.token import Keyword, Punctuation, Comment, Operator, Name,\ - String, Number, Whitespace - - -__all__ = ['CypherLexer'] - - -class CypherLexer(RegexLexer): - """ - For `Cypher Query Language +from pygments.token import Keyword, Punctuation, Comment, Operator, Name,\ + String, Number, Whitespace + + +__all__ = ['CypherLexer'] + + +class CypherLexer(RegexLexer): + """ + For `Cypher Query Language <https://neo4j.com/docs/developer-manual/3.3/cypher/>`_ - + For the Cypher version in Neo4j 3.3 - - .. versionadded:: 2.0 - """ - name = 'Cypher' - aliases = ['cypher'] - filenames = ['*.cyp', '*.cypher'] - - flags = re.MULTILINE | re.IGNORECASE - - tokens = { - 'root': [ - include('comment'), + + .. versionadded:: 2.0 + """ + name = 'Cypher' + aliases = ['cypher'] + filenames = ['*.cyp', '*.cypher'] + + flags = re.MULTILINE | re.IGNORECASE + + tokens = { + 'root': [ + include('comment'), include('clauses'), - include('keywords'), - include('relations'), - include('strings'), - include('whitespace'), - include('barewords'), - ], - 'comment': [ + include('keywords'), + include('relations'), + include('strings'), + include('whitespace'), + include('barewords'), + ], + 'comment': [ (r'^.*//.*$', Comment.Single), - ], - 'keywords': [ - (r'(create|order|match|limit|set|skip|start|return|with|where|' + ], + 'keywords': [ + (r'(create|order|match|limit|set|skip|start|return|with|where|' r'delete|foreach|not|by|true|false)\b', Keyword), - ], - 'clauses': [ + ], + 'clauses': [ # based on https://neo4j.com/docs/cypher-refcard/3.3/ (r'(create)(\s+)(index|unique)\b', bygroups(Keyword, Whitespace, Keyword)), @@ -82,24 +82,24 @@ class CypherLexer(RegexLexer): 'foreach', 'in', 'limit', 'match', 'merge', 'none', 'not', 'null', 'remove', 'return', 'set', 'skip', 'single', 'start', 'then', 'union', 'unwind', 'yield', 'where', 'when', 'with'), suffix=r'\b'), Keyword), - ], - 'relations': [ - (r'(-\[)(.*?)(\]->)', bygroups(Operator, using(this), Operator)), - (r'(<-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)), - (r'(-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)), - (r'-->|<--|\[|\]', Operator), - (r'<|>|<>|=|<=|=>|\(|\)|\||:|,|;', Punctuation), - (r'[.*{}]', Punctuation), - ], - 'strings': [ - (r'"(?:\\[tbnrf\'"\\]|[^\\"])*"', String), - (r'`(?:``|[^`])+`', Name.Variable), - ], - 'whitespace': [ - (r'\s+', Whitespace), - ], - 'barewords': [ - (r'[a-z]\w*', Name), - (r'\d+', Number), - ], - } + ], + 'relations': [ + (r'(-\[)(.*?)(\]->)', bygroups(Operator, using(this), Operator)), + (r'(<-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)), + (r'(-\[)(.*?)(\]-)', bygroups(Operator, using(this), Operator)), + (r'-->|<--|\[|\]', Operator), + (r'<|>|<>|=|<=|=>|\(|\)|\||:|,|;', Punctuation), + (r'[.*{}]', Punctuation), + ], + 'strings': [ + (r'"(?:\\[tbnrf\'"\\]|[^\\"])*"', String), + (r'`(?:``|[^`])+`', Name.Variable), + ], + 'whitespace': [ + (r'\s+', Whitespace), + ], + 'barewords': [ + (r'[a-z]\w*', Name), + (r'\d+', Number), + ], + } |