GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
LaTeX
Browse code
• Added a couple of keywords.
master
1 parent
4f4692c
commit
d6cf20e933736ceddf48f3c213e5c5a4c87c7cdb
Nigel Stanger
authored
on 21 Mar 2018
Patch
Showing
1 changed file
minted/oracle.py
Ignore Space
Show notes
View
minted/oracle.py
# -*- 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
# -*- 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', 'nth_value', 'dense_rank', 'lag', 'lead', 'listagg', 'dimension'] 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
Show line notes below