Server IP : 85.214.239.14 / Your IP : 3.145.78.12 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/pygments/lexers/ |
Upload File : |
""" pygments.lexers.graph ~~~~~~~~~~~~~~~~~~~~~ Lexers for graph query languages. :copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS. :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 For the Cypher version in Neo4j 3.3 .. versionadded:: 2.0 """ name = 'Cypher' url = 'https://neo4j.com/docs/developer-manual/3.3/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': [ (r'^.*//.*$', Comment.Single), ], 'keywords': [ (r'(create|order|match|limit|set|skip|start|return|with|where|' r'delete|foreach|not|by|true|false)\b', Keyword), ], '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)), (words(( 'all', 'any', 'as', 'asc', 'ascending', 'assert', 'call', 'case', 'create', 'delete', 'desc', 'descending', 'distinct', 'end', 'fieldterminator', '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), ], }