Commits

Kirill Simonov committed 4d08443

added HTSQL lexer

  • Participants
  • Parent commits 2f2a9d7

Comments (0)

Files changed (2)

File pygments/lexers/_mapping.py

     'HtmlLexer': ('pygments.lexers.web', 'HTML', ('html',), ('*.html', '*.htm', '*.xhtml', '*.xslt'), ('text/html', 'application/xhtml+xml')),
     'HtmlPhpLexer': ('pygments.lexers.templates', 'HTML+PHP', ('html+php',), ('*.phtml',), ('application/x-php', 'application/x-httpd-php', 'application/x-httpd-php3', 'application/x-httpd-php4', 'application/x-httpd-php5')),
     'HtmlSmartyLexer': ('pygments.lexers.templates', 'HTML+Smarty', ('html+smarty',), (), ('text/html+smarty',)),
+    'HtsqlLexer': ('pygments.lexers.other', 'HTSQL', ('htsql',), ('*.htsql',), ('text/x-htsql', 'application/x-htsql')),
     'HybrisLexer': ('pygments.lexers.other', 'Hybris', ('hybris', 'hy'), ('*.hy', '*.hyb'), ('text/x-hybris', 'application/x-hybris')),
     'IniLexer': ('pygments.lexers.text', 'INI', ('ini', 'cfg'), ('*.ini', '*.cfg'), ('text/x-ini',)),
     'IoLexer': ('pygments.lexers.agile', 'Io', ('io',), ('*.io',), ('text/x-iosrc',)),

File pygments/lexers/other.py

            'BashSessionLexer', 'ModelicaLexer', 'RebolLexer', 'ABAPLexer',
            'NewspeakLexer', 'GherkinLexer', 'AsymptoteLexer',
            'PostScriptLexer', 'AutohotkeyLexer', 'GoodDataCLLexer',
-           'MaqlLexer', 'ProtoBufLexer', 'HybrisLexer']
+           'MaqlLexer', 'ProtoBufLexer', 'HybrisLexer', 'HtsqlLexer']
 
 line_re  = re.compile('.*?\n')
 
             (r'[a-zA-Z0-9_.]+\*?', Name.Namespace, '#pop')
         ],
     }
+
+
+class HtsqlLexer(RegexLexer):
+    """
+    Lexer for `HTSQL <http://htsql.org/>`_ query language.
+    """
+
+    name = 'HTSQL'
+    aliases = ['htsql']
+    filenames = ['*.htsql']
+    mimetypes = ['text/x-htsql', 'application/x-htsql']
+
+    tokens = {
+        'root': [
+            (r'\s+', Text),
+            (r'(?<=:)(?!\d)\w+', Name.Function),
+            (r'(?!\d)\w+(?=\s*\()', Name.Function),
+            (r'(?!\d)\w+', Name.Builtin),
+            (r'(?:\d*\.)?\d+[eE][+-]?\d+|\d*\.\d+|\d+\.?', Number),
+            (r'\'(?:[^\']|\'\')*\'', String),
+            (r'=~~|=~|\^~~|\^~|\$~~|\$~|~~|~|'
+             r'!=~~|!=~|!\^~~|!\^~|!\$~~|!\$~|!~~|!~|'
+             r'<=|<|>=|>|==|=|!==|!=|!|'
+             r'&|\||->|\?|\^|/|\*|\+|-', Operator),
+            (r'\.|,|\(|\)|\{|\}|\[|\]|:', Punctuation),
+        ]
+    }
+
+