|
|
@ -26,6 +26,197 @@ format2csv.main(["",
|
|
|
|
os.path.join(this_dir, "format-table.csv"),
|
|
|
|
os.path.join(this_dir, "format-table.csv"),
|
|
|
|
os.path.join(src_dir, "formats")])
|
|
|
|
os.path.join(src_dir, "formats")])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import re
|
|
|
|
|
|
|
|
from pygments.lexer import RegexLexer, words
|
|
|
|
|
|
|
|
from pygments.token import Punctuation, Whitespace, Text, Comment, Operator, \
|
|
|
|
|
|
|
|
Keyword, Name, String, Number, Generic
|
|
|
|
|
|
|
|
from sphinx.highlighting import lexers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CustSqliteLexer(RegexLexer):
|
|
|
|
|
|
|
|
name = 'custsqlite'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flags = re.IGNORECASE
|
|
|
|
|
|
|
|
tokens = {
|
|
|
|
|
|
|
|
'root': [
|
|
|
|
|
|
|
|
(r'\s+', Text),
|
|
|
|
|
|
|
|
(r'--.*\n?', Comment.Single),
|
|
|
|
|
|
|
|
(r'/\*', Comment.Multiline, 'multiline-comments'),
|
|
|
|
|
|
|
|
(words((
|
|
|
|
|
|
|
|
'ABORT',
|
|
|
|
|
|
|
|
'ACTION',
|
|
|
|
|
|
|
|
'ADD',
|
|
|
|
|
|
|
|
'AFTER',
|
|
|
|
|
|
|
|
'ALL',
|
|
|
|
|
|
|
|
'ALTER',
|
|
|
|
|
|
|
|
'ALWAYS',
|
|
|
|
|
|
|
|
'ANALYZE',
|
|
|
|
|
|
|
|
'AND',
|
|
|
|
|
|
|
|
'AS',
|
|
|
|
|
|
|
|
'ASC',
|
|
|
|
|
|
|
|
'ATTACH',
|
|
|
|
|
|
|
|
'AUTOINCREMENT',
|
|
|
|
|
|
|
|
'BEFORE',
|
|
|
|
|
|
|
|
'BEGIN',
|
|
|
|
|
|
|
|
'BETWEEN',
|
|
|
|
|
|
|
|
'BY',
|
|
|
|
|
|
|
|
'CAS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|
|
|
'PRIMARY',
|
|
|
|
|
|
|
|
'QUERY',
|
|
|
|
|
|
|
|
'RAISE',
|
|
|
|
|
|
|
|
'RANGE',
|
|
|
|
|
|
|
|
'RECURSIVE',
|
|
|
|
|
|
|
|
'REFERENCES',
|
|
|
|
|
|
|
|
'REGEXP',
|
|
|
|
|
|
|
|
'REINDEX',
|
|
|
|
|
|
|
|
'RELEASE',
|
|
|
|
|
|
|
|
'RENAME',
|
|
|
|
|
|
|
|
'REPLACE',
|
|
|
|
|
|
|
|
'RESTRICT',
|
|
|
|
|
|
|
|
'RIGHT',
|
|
|
|
|
|
|
|
'ROLLBACK',
|
|
|
|
|
|
|
|
'ROW',
|
|
|
|
|
|
|
|
'ROWS',
|
|
|
|
|
|
|
|
'SAVEPOINT',
|
|
|
|
|
|
|
|
'SELECT',
|
|
|
|
|
|
|
|
'SET',
|
|
|
|
|
|
|
|
'TABLE',
|
|
|
|
|
|
|
|
'TEMP',
|
|
|
|
|
|
|
|
'TEMPORARY',
|
|
|
|
|
|
|
|
'THEN',
|
|
|
|
|
|
|
|
'TIES',
|
|
|
|
|
|
|
|
'TO',
|
|
|
|
|
|
|
|
'TRANSACTION',
|
|
|
|
|
|
|
|
'TRIGGER',
|
|
|
|
|
|
|
|
'UNBOUNDED',
|
|
|
|
|
|
|
|
'UNION',
|
|
|
|
|
|
|
|
'UNIQUE',
|
|
|
|
|
|
|
|
'UPDATE',
|
|
|
|
|
|
|
|
'USING',
|
|
|
|
|
|
|
|
'VACUUM',
|
|
|
|
|
|
|
|
'VALUES',
|
|
|
|
|
|
|
|
'VIEW',
|
|
|
|
|
|
|
|
'VIRTUAL',
|
|
|
|
|
|
|
|
'WHEN',
|
|
|
|
|
|
|
|
'WHERE',
|
|
|
|
|
|
|
|
'WINDOW',
|
|
|
|
|
|
|
|
'WITH',
|
|
|
|
|
|
|
|
'WITHOUT'), suffix=r'\b'),
|
|
|
|
|
|
|
|
Keyword),
|
|
|
|
|
|
|
|
(words((
|
|
|
|
|
|
|
|
'ARRAY', 'BIGINT', 'BINARY', 'BIT', 'BLOB', 'BOOLEAN', 'CHAR',
|
|
|
|
|
|
|
|
'CHARACTER', 'DATE', 'DEC', 'DECIMAL', 'FLOAT', 'INT', 'INTEGER',
|
|
|
|
|
|
|
|
'INTERVAL', 'NUMBER', 'NUMERIC', 'REAL', 'SERIAL', 'SMALLINT',
|
|
|
|
|
|
|
|
'VARCHAR', 'VARYING', 'INT8', 'SERIAL8', 'TEXT'), suffix=r'\b'),
|
|
|
|
|
|
|
|
Name.Builtin),
|
|
|
|
|
|
|
|
(r'[+*/<>=~!@#%^&|`?-]', Operator),
|
|
|
|
|
|
|
|
(r'[0-9]+', Number.Integer),
|
|
|
|
|
|
|
|
# TODO: Backslash escapes?
|
|
|
|
|
|
|
|
(r"'(''|[^'])*'", String.Single),
|
|
|
|
|
|
|
|
(r'"(""|[^"])*"', String.Symbol), # not a real string literal in ANSI SQL
|
|
|
|
|
|
|
|
(r'[a-z_][\w$]*', Name), # allow $s in strings for Oracle
|
|
|
|
|
|
|
|
(r'\$[a-z_]+', Name),
|
|
|
|
|
|
|
|
(r'[;:()\[\],.]', Punctuation)
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
'multiline-comments': [
|
|
|
|
|
|
|
|
(r'/\*', Comment.Multiline, 'multiline-comments'),
|
|
|
|
|
|
|
|
(r'\*/', Comment.Multiline, '#pop'),
|
|
|
|
|
|
|
|
(r'[^/*]+', Comment.Multiline),
|
|
|
|
|
|
|
|
(r'[/*]', Comment.Multiline)
|
|
|
|
|
|
|
|
]
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def analyse_text(text):
|
|
|
|
|
|
|
|
return 0.01
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lexers['custsqlite'] = CustSqliteLexer(startinline=True)
|
|
|
|
|
|
|
|
|
|
|
|
# -- General configuration -----------------------------------------------------
|
|
|
|
# -- General configuration -----------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
# If your documentation needs a minimal Sphinx version, state it here.
|
|
|
|
# If your documentation needs a minimal Sphinx version, state it here.
|
|
|
|