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 ntile keyword
master
1 parent
1820db5
commit
0b06eaf505cabd6df908609432a163708e4b0730
Nigel Stanger
authored
on 28 Mar 2022
Patch
Showing
1 changed file
minted/postgresql.py
Ignore Space
Show notes
View
minted/postgresql.py
# -*- coding: utf-8 -*- """ PostgreSQL SQL lexer """ from pygments.lexers.sql import SqlLexer from pygments.token import Name, Keyword __all__ = ['PostgreSQLLexer'] class PostgreSQLLexer(SqlLexer): name = 'PostgreSQL' aliases = ['postgresql', 'postgres'] filenames = ['*.sql'] # just to have one if you want to use EXTRA_KEYWORDS = ['partition', 'over', 'rank', 'ntile', 'first_value', 'last_value', 'row_number', 'nulls', 'range', 'unbounded', 'preceding', 'following', 'trunc', 'nth_value', 'dense_rank', 'lag', 'lead', 'round', 'make_interval', 'date_trunc'] 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 -*- """ PostgreSQL SQL lexer """ from pygments.lexers.sql import SqlLexer from pygments.token import Name, Keyword __all__ = ['PostgreSQLLexer'] class PostgreSQLLexer(SqlLexer): name = 'PostgreSQL' aliases = ['postgresql', 'postgres'] filenames = ['*.sql'] # just to have one if you want to use EXTRA_KEYWORDS = ['partition', 'over', 'rank', 'first_value', 'last_value', 'row_number', 'nulls', 'range', 'unbounded', 'preceding', 'following', 'trunc', 'nth_value', 'dense_rank', 'lag', 'lead', 'round', 'make_interval', 'date_trunc'] 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