Skip to content
Snippets Groups Projects
Commit 5d255551 authored by Hans-Jörg Schurr's avatar Hans-Jörg Schurr
Browse files

Fix syntax highliging for new minted versions

parent bab61d95
No related branches found
No related tags found
1 merge request!2Backport specification from my PhD thesis
This commit is part of merge request !2. Comments created here will be created in the context of that merge request.
......@@ -10,9 +10,9 @@
\usepackage{minted}
\usemintedstyle{trac}
% TODO: tweak hilighter
\newminted[AletheVerb]{smtlib2.py -x}{}
\newmintinline[inlineAlethe]{smtlib2.py -x}{}
\renewcommand{\MintedPygmentize}{./highlight.py}
\newminted[AletheVerb]{smt-lib}{}
\newmintinline[inlineAlethe]{smt-lib}{}
\usepackage{cite}
\usepackage{url}
......
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# This is a thin wraper arround pygmentize that adds support for SMT-LIB/Alethe.
# More precicely: it parses the command line arguments and uses a custom
# SMT-LIB lexer if the user selects smt-lib as the language.
# This wrapper was made necessary by version 2.7 of minted: it started to
# quote command line arguments hended to pygmentize and thereby made the old
# tick to use "smtlib2.py -x" as the language unworkable.
import re
import argparse
import sys
from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, \
default, include
import pygments.cmdline as _cmdline
from pygments.lexer import RegexLexer
from pygments.token import Text, Comment, Operator, Keyword, Name, String, \
Number, Punctuation, Generic
from pygments import unistring as uni
__all__ = ['Smt2Lexer']
Number, Punctuation
def main(args):
parser = argparse.ArgumentParser()
parser.add_argument('-l', dest='lexer', type=str)
opts, rest = parser.parse_known_args(args[1:])
if opts.lexer == 'smt-lib':
args = [__file__, '-l', __file__ + ':SMTLibLexer', '-x', *rest]
_cmdline.main(args)
line_re = re.compile('.*?\n')
class CustomLexer(RegexLexer):
class SMTLibLexer(RegexLexer):
"""
A SMT-Lib 2 parser
"""
......@@ -117,3 +131,6 @@ class CustomLexer(RegexLexer):
(r'[^()]+', Comment),
],
}
if __name__ == '__main__':
main(sys.argv)
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment