Newer
Older
LaTeX / minted / orientdb.py
# -*- coding: utf-8 -*-
"""
    OrientDB SQL lexer
    ~~~~~~~~~~~
    Pygments lexer for OrientDB SQL.
"""

from pygments.lexers.sql import SqlLexer
from pygments.token import Name, Keyword

__all__ = ['OrientDBLexer']

class OrientDBLexer(SqlLexer):
    name = 'OrientDB'
    aliases = ['orientdb']
    filenames = ['*.sql'] # just to have one if you whant to use

    EXTRA_KEYWORDS = ['property', 'extends', 'link', 'mandatory', 'edge',
        'to', 'traverse', 'unwind', 'inE']

    def get_tokens_unprocessed(self, text):
        for index, token, value in SqlLexer.get_tokens_unprocessed(self, text):
            if token is Name and value in self.EXTRA_KEYWORDS:
                yield index, Keyword, value
            else:
                yield index, token, value