# -*- coding: utf-8 -*- """ Oracle SQL lexer ~~~~~~~~~~~ Pygments lexer for Oracle SQL. :copyright: Copyright 2012 Hugo Maia Vieira :license: BSD, see LICENSE for details. """ from pygments.lexers.sql import SqlLexer from pygments.token import Name, Keyword __all__ = ['OracleLexer'] class OracleLexer(SqlLexer): name = 'Oracle' aliases = ['oracle'] filenames = ['*.sql'] # just to have one if you whant to use EXTRA_KEYWORDS = ['partition', 'over', 'model', 'pivot', 'unpivot', 'rank', 'first_value', 'last_value', 'row_number', 'nulls', 'range', 'unbounded', 'preceding', 'following', 'trunc', 'nth_value', 'dense_rank', 'lag', 'lead', 'listagg', 'dimension', 'round', 'numtoyminterval'] 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