summaryrefslogtreecommitdiff
path: root/pygments/lexers/cypher.py
blob: ea92a6f86f0ae2417028f61df1c4556272f2f0c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# -*- coding: utf-8 -*-
"""
    pygments.lexers.cypher
    ~~~~~~~~~~~~~~~~~~~~~~

    A Lexer for the cypher graph query language use in the neo4j graph database.

    `CypherLexer`

    the ``tests/examplefiles`` contains file "test.cyp" which has valid
    cypher queries that execute against the example database shipped with Neo4J


    :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

import re

from pygments.lexer import RegexLexer, include, bygroups
from pygments.token import Punctuation, Text, Comment, Operator, Name, \
String, Number, Generic


__all__ = ['CypherLexer']


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': []
        }