diff options
author | Larry Price <larry@industrialintellect.com> | 2013-11-29 15:52:37 -0800 |
---|---|---|
committer | Larry Price <larry@industrialintellect.com> | 2013-11-29 15:52:37 -0800 |
commit | dd231b3e28ee31cf1b8049b0dbee1b34ba11f12f (patch) | |
tree | 479cdc63d5297c94ab46f21490fe9c84662db677 | |
parent | afd483c91757103936b79e448fe7907a0420e44e (diff) | |
download | pygments-dd231b3e28ee31cf1b8049b0dbee1b34ba11f12f.tar.gz |
checkpoint, working on the tokenizer.
-rw-r--r-- | pygments/lexers/cypher.py | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/pygments/lexers/cypher.py b/pygments/lexers/cypher.py index 87fe76c7..ea92a6f8 100644 --- a/pygments/lexers/cypher.py +++ b/pygments/lexers/cypher.py @@ -7,7 +7,7 @@ `CypherLexer` - the ``tests/examplefiles`` contains file "movie_queries.cyp" which has valid + the ``tests/examplefiles`` contains file "test.cyp" which has valid cypher queries that execute against the example database shipped with Neo4J @@ -17,16 +17,37 @@ import re -from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups +from pygments.lexer import RegexLexer, include, bygroups from pygments.token import Punctuation, Text, Comment, Operator, Name, \ String, Number, Generic -from pygments.lexers import get_lexer_by_name, ClassNotFound + __all__ = ['CypherLexer'] -line_re = re.compile('.*?\n') -name = 'Cypher' -aliases = ['cypher'] -filenames = ['*.cyp','*.cypher'] -flags = re.MULTILINE | re.DOTALL +class CypherLexer(RegexLexer): + """ + For Cypher Query Language + http://docs.neo4j.org/chunked/milestone/cypher-query-lang.html + For the Cypher version in Neo4J 2.0 + """ + name = 'Cypher' + aliases = ['cypher'] + filenames = ['*.cyp','*.cypher'] + + tokens = { + 'root': [ + include('comment'), + include('keywords'), + include('clauses'), + include('relations') + ], + 'comment': ["^.*//.*$"], + 'keywords': [], + 'clauses': [], + 'relations': [] + } + + + + |