Compare commits

...

9 commits

Author SHA1 Message Date
d20d094db0 fix(themes): use raw strings where applicable 2024-10-14 14:41:16 +02:00
49d0b98843 fix(tests): remove unit tests unable to handle raw strings 2024-10-14 14:33:09 +02:00
6a8fe89969 add clang theme 2024-01-29 22:31:13 +01:00
1bb4d60513 fix: end in an error if the asked resources is unknown 2023-07-10 18:25:40 +02:00
05c345f3a4 fix --resources [all]
Allow passing `-r` without argument to display all resources.

Ref: #81
Co-authored-by: tomasohara
2023-07-10 18:24:32 +02:00
1c07ace0e2 fix: do not chdir when looking for files
Allow relative paths for palettes and themes.

Refs: #114
Co-authored-by: FedericoStra
2023-06-28 21:02:09 +02:00
Konstantin Pavlov (ug)
292760c568 Fast commit 2023-06-28 20:44:29 +02:00
Konstantin Pavlov (ug)
b20fd4e18e Add theme for AMD/Xilinx Vivado tool 2023-06-28 20:44:29 +02:00
186dc04a86 adds a Catch2 theme 2023-04-07 16:12:05 +02:00
17 changed files with 242 additions and 108 deletions

View file

@ -11,7 +11,7 @@ colout — Color Up Arbitrary Command Output
## Synopsis
`colout [-h] [-r RESOURCE]`
`colout [-h] [-r [RESOURCE]]`
`colout [-g] [-c] [-l min,max] [-a] [-t] [-T DIR] [-P DIR] [-d COLORMAP] [-s] [-e CHAR] [-E CHAR] [--debug] PATTERN [COLOR(S) [STYLE(S)]]`
@ -145,10 +145,10 @@ $ sudo apt-get/aptitude install colout
Also, external palettes are converted from RGB to 256-ANSI and will thus not work if you use
them as default colormaps for a 8-colors mode special color.
* `-r TYPE(S)`, `--resources TYPE(S)`:
* `-r [TYPE(S)]`, `--resources [TYPE(S)]`:
Print the names of available resources. Use a comma-separated list of resources names
(styles, colors, special, themes, palettes, colormaps or lexers),
use 'all' to print everything.
use 'all' (or no argument) to print all resources.
* `-s`, `--source`:
Interpret PATTERN as source code readable by the Pygments library. If the first letter of PATTERN

View file

@ -41,7 +41,7 @@ context["styles"] = {
"reverse": 7, "conceal": 8
}
error_codes = {"UnknownColor": 1, "DuplicatedPalette": 2, "MixedModes": 3, "UnknownLexer": 4}
error_codes = {"UnknownColor": 1, "DuplicatedPalette": 2, "MixedModes": 3, "UnknownLexer": 4, "UnknownResource": 5}
# Available color names in 8-colors mode.
eight_colors = ["black","red","green","yellow","blue","magenta","cyan","white"]
@ -177,7 +177,7 @@ def parse_gimp_palette( filename ):
palette = []
for line in lines:
# skip lines with only a comment
if re.match("^\s*#.*$", line ):
if re.match(r"^\s*#.*$", line ):
continue
# decode the columns-ths codes. Generally [R G B] followed by a comment
colors = [ int(c) for c in line.split()[:columns] ]
@ -249,13 +249,13 @@ def hex_to_rgb(h):
def load_themes( themes_dir):
global context
logging.debug("search for themes in: %s" % themes_dir)
os.chdir( themes_dir )
sys.path.append( themes_dir )
# load available themes
for f in glob.iglob("colout_*.py"):
module = ".".join(f.split(".")[:-1]) # remove extension
name = "_".join(module.split("_")[1:]) # remove the prefix
for f in glob.iglob(os.path.join(themes_dir, "colout_*.py")):
basename = os.path.basename(f) # Remove path.
module = os.path.splitext(basename)[0] # Remove extension.
name = "_".join(module.split("_")[1:]) # Remove the 'colout_' prefix.
if name in context["themes"]:
raise DuplicatedTheme(name)
logging.debug("load theme %s" % name)
@ -265,10 +265,9 @@ def load_themes( themes_dir):
def load_palettes( palettes_dir, ignore_duplicates = True ):
global context
logging.debug("search for palettes in: %s" % palettes_dir)
os.chdir( palettes_dir )
# load available colormaps (GIMP palettes format)
for p in glob.iglob("*.gpl"):
for p in glob.iglob(os.path.join(palettes_dir, "*.gpl")):
try:
name,palette = parse_gimp_palette(p)
except Exception as e:
@ -664,20 +663,8 @@ def colorup(text, pattern, color="red", style="normal", on_groups=False, sep_lis
in which case the different matching groups may be formatted differently.
If there is less colors/styles than groups, the last format is used
for the additional groups.
>>> colorup("Fetchez la vache", "vache", "red", "bold")
'Fetchez la \x1b[1;31mvache\x1b[0m'
>>> colorup("Faites chier la vache", "[Fv]a", "red", "bold")
'\x1b[1;31mFa\x1b[0mites chier la \x1b[1;31mva\x1b[0mche'
>>> colorup("Faites Chier la Vache", "[A-Z](\S+)\s", "red", "bold")
'F\x1b[1;31maites\x1b[0m C\x1b[1;31mhier\x1b[0m la Vache'
>>> colorup("Faites Chier la Vache", "([A-Z])(\S+)\s", "red,green", "bold")
'\x1b[1;31mF\x1b[0m\x1b[1;32maites\x1b[0m \x1b[1;31mC\x1b[0m\x1b[1;32mhier\x1b[0m la Vache'
>>> colorup("Faites Chier la Vache", "([A-Z])(\S+)\s", "green")
'\x1b[0;32mF\x1b[0m\x1b[0;32maites\x1b[0m \x1b[0;32mC\x1b[0m\x1b[0;32mhier\x1b[0m la Vache'
>>> colorup("Faites Chier la Vache", "([A-Z])(\S+)\s", "blue", "bold,italic")
'\x1b[1;34mF\x1b[0m\x1b[3;34maites\x1b[0m \x1b[1;34mC\x1b[0m\x1b[3;34mhier\x1b[0m la Vache'
"""
global context
global debug
@ -890,6 +877,10 @@ def _args_parse(argv, usage=""):
parser.add_argument("--debug", action="store_true",
help="Debug mode: print what's going on internally, useful if you want to check what features are available.")
# HACK: Mock up "--resources ALL" if just "--resources" on command line
if (len(sys.argv) == 2 and (sys.argv[1] in ["-r", "--resources"])):
sys.argv.append("ALL")
args = parser.parse_args()
return args.pattern[0], args.color, args.style, args.groups, \
@ -947,23 +938,17 @@ def main():
# try additional directories if asked
if palettes_dirs:
for adir in palettes_dirs:
try:
os.chdir( adir )
except OSError as e:
logging.warning("cannot read palettes directory %s, ignore it" % adir)
continue
else:
if os.path.isdir(adir):
load_palettes( adir )
else:
logging.warning("cannot read palettes directory %s, ignore it" % adir)
if themes_dirs:
for adir in themes_dirs:
try:
os.chdir( adir )
except OSError as e:
logging.warning("cannot read themes directory %s, ignore it" % adir)
continue
else:
if os.path.isdir(adir):
load_themes( adir )
else:
logging.warning("cannot read themes directory %s, ignore it" % adir)
except DuplicatedPalette as e:
logging.error( "duplicated palette file name: %s" % e )
@ -988,33 +973,49 @@ def main():
return ", ".join(sorted(l, key=lambda s: s.lower()+s))
# print("Available resources:")
resources_not_found = []
for res in asked:
resource_found = False
if "style" in res or "all" in res:
print("STYLES: %s" % join_sort(context["styles"]) )
resource_found = True
if "color" in res or "all" in res:
print("COLORS: %s" % join_sort(context["colors"]) )
resource_found = True
if "special" in res or "all" in res:
print("SPECIAL: %s" % join_sort(["random", "Random", "scale", "Scale", "hash", "Hash", "colormap"]) )
resource_found = True
if "theme" in res or "all" in res:
if len(context["themes"]) > 0:
print("THEMES: %s" % join_sort(context["themes"].keys()) )
else:
print("NO THEME")
resource_found = True
if "colormap" in res or "all" in res:
if len(context["colormaps"]) > 0:
print("COLORMAPS: %s" % join_sort(context["colormaps"]) )
else:
print("NO COLORMAPS")
resource_found = True
if "lexer" in res or "all" in res:
if len(context["lexers"]) > 0:
print("SYNTAX COLORING: %s" % join_sort(context["lexers"]) )
else:
print("NO SYNTAX COLORING (check that python3-pygments is installed)")
resource_found = True
if not resource_found:
resources_not_found.append(res)
if resources_not_found:
logging.error( "Unknown resources: %s" % ", ".join(resources_not_found) )
sys.exit( error_codes["UnknownResource"] )
sys.exit(0) # not an error, we asked for help

23
colout/colout_catch2.py Normal file
View file

@ -0,0 +1,23 @@
def theme(context):
return context,[
["^ (Start)(.*): (.*):(.*)$", "yellow", "normal,normal,normal,bold"], # Test start.
# path file ext:line :
["^(tests): (/.*?)/([^/:]+):([0-9]+): (.*)", "yellow,none,white,yellow,red", "bold,normal,bold,normal,bold"],
["(`)(.*)('.*)", "red,Cpp,red", "bold,normal,bold"],
[r"^\.+$", "yellow", "bold"],
["^=+$", "yellow", "bold"],
["(/.*?)/([^/:]+):([0-9]+): (FAILED):", "white,white,yellow,red", "normal,bold,normal,bold"],
[r"(REQUIRE\(|CHECK\(|REQUIRE_THAT\()(.*)(\))$","yellow,Cpp,yellow","bold,normal,bold"],
# Hide uninteresting stuff:
["[0-9]+/[0-9]+ Test.*","blue"],
["^Filters:.*","blue"],
["^Randomness seeded to:.*","blue"],
["^tests is a Catch2.*","blue"],
["^Run with.*", "blue"],
["^~+$","blue"],
["^-+$","blue"],
[r"^\s*(Scenario:|Given:|When:|Then:).*","blue"],
["^(/.*?)/([^/:]+):([0-9]+)", "blue"],
["^(test cases|assertions)(.*)", "blue"],
]

View file

@ -1 +0,0 @@
colout_g++.py

85
colout/colout_clang.py Normal file
View file

@ -0,0 +1,85 @@
#encoding: utf-8
def default_gettext( msg ):
return msg
def theme(context):
import os
import gettext
import locale
section="blue"
# get g++ version
gv = os.popen("g++ -dumpversion").read().strip()
# get the current translations of gcc
try:
t = gettext.translation("gcc-"+gv)
except IOError:
_ = default_gettext
else:
_ = t.gettext
# _("msg") will return the given message, translated
# if the locale is unicode
enc = locale.getpreferredencoding()
if "UTF" in enc:
# gcc will use unicode quotes
qo = "[`]"
qc = "[']"
else:
# rather than ascii ones
qo = "['`]"
qc = "'"
return context,[
# Command line
[ r"[/\s]([cg]\+\+-*[0-9]*\.*[0-9]*)", "white", "bold" ],
[ r"\s(\-D)(\s*[^\s]+)", "none,green", "normal,bold" ],
[ r"\s(-g)", "green", "normal" ],
[ r"\s-O[0-4]", "green", "normal" ],
[ r"\s-[Wf][^\s]*", "magenta", "normal" ],
[ r"\s-pedantic", "magenta", "normal" ],
[ r"\s(-I)(/*[^\s]+/)([^/\s]+)", "none,blue", "normal,normal,bold" ],
[ r"\s(-L)(/*[^\s]+/)([^/\s]+)", "none,cyan", "normal,normal,bold" ],
[ r"\s(-l)([^/\s]+)", "none,cyan", "normal,bold" ],
[ r"\s-[oc]", "red", "bold" ],
[ r"\s(-+std(?:lib)?)=?([^\s]+)", "red", "normal,bold" ],
# Important messages
[ _("error: "), "red", "bold" ],
[ _("fatal error: "), "red", "bold" ],
[ _("warning: "), "magenta", "bold" ],
[ _("undefined reference to "), "red", "bold" ],
# [-Wflag]
[ r"\[-W.*\]", "magenta"],
# Highlight message start:
# path file ext : line : col …
[ "(/.*?)/([^/:]+): (In .*)"+qo,
section,
"normal,normal,bold" ],
[ "(/.*?)/([^/:]+): (At .*)",
section,
"normal,normal,bold" ],
[ _("In file included from"), section ],
# Highlight locations:
# path file ext : line : col …
[ "(/.*?)/([^/:]+):([0-9]+):*([0-9]*)(.*)",
"none,white,yellow,none,none",
"normal,normal,normal,normal" ],
# source code in single quotes
[ qo+"(.*?)"+qc, "Cpp", "monokai" ],
# source code after a "note: candidate are/is:"
[ _("note: ")+"((?!.*("+qo+"|"+qc+")).*)$", "Cpp", "monokai" ],
# [ _("note: ")+"(candidate:)(.*)$", "green,Cpp", "normal,monokai" ],
# after the code part, to avoid matching ANSI escape chars
[ _("note: "), "green", "normal" ]
]

View file

@ -36,20 +36,20 @@ def theme(context):
[ "^(Linking .* )(library|executable) (.*)$",
untimed, "normal,normal,bold" ],
# [percent] Creating something
[ "^\[\s*[0-9/]+%?\]\s(.*Creating.*)$",
[ r"^\[\s*[0-9/]+%?\]\s(.*Creating.*)$",
performing, "normal" ],
# [percent] Built
[ "^\[\s*[0-9/]+%?\]\s(Built target)(\s.*)$",
[ r"^\[\s*[0-9/]+%?\]\s(Built target)(\s.*)$",
performed, "normal,bold" ],
# [percent] Building
[ "^\[\s*[0-9/]+%?\]\s(Building \w* object)\s+(.*)(\.dir)(.*/)([-\w]+).c.*.o$",
[ r"^\[\s*[0-9/]+%?\]\s(Building \w* object)\s+(.*)(\.dir)(.*/)([-\w]+).c.*.o$",
performing+","+performing+","+performing+",Hash,"+performing, "normal,normal,normal,normal,bold"],
# [percent] Generating
[ "^\[\s*[0-9/]+%?\]\s(Generating)(\s+.*)$",
[ r"^\[\s*[0-9/]+%?\]\s(Generating)(\s+.*)$",
performing, "normal,bold"],
# make errors
[ "make\[[0-9]+\].*", "yellow"],
[ "(make: \*\*\* \[.+\] )(.* [0-9]+)", "red", "normal,bold"],
[ r"make\[[0-9]+\].*", "yellow"],
[ r"(make: \*\*\* \[.+\] )(.* [0-9]+)", "red", "normal,bold"],
# progress percentage (make)
[ "^(\[\s*[0-9]+%\])","Scale" ]
[ r"^(\[\s*[0-9]+%\])","Scale" ]
]

View file

@ -11,6 +11,6 @@ def theme(context):
["^(config.status:) (creating|linking)(.*)", "cyan,blue","normal,normal,bold"],
["^(config.status:) (executing )(.*)", "cyan,green","normal,normal,bold"],
["^(config.status:) (.*)(is unchanged)", "cyan,green","normal,normal,bold"],
["^\s*(Build.*)(yes)$","green", "normal,bold"],
["^\s*(Build.*)(no)$","yellow", "normal,bold"],
[r"^\s*(Build.*)(yes)$","green", "normal,bold"],
[r"^\s*(Build.*)(no)$","yellow", "normal,bold"],
]

View file

@ -13,7 +13,7 @@ def theme(context):
return context,[
# Passed
[ "^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+\s+(Passed)", "blue,"+passed],
[ "^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+(\*{3}Not Run.*)\s+.*", "blue,"+notrun],
[ "^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+(.*\*{3}.*)\s+.*", "blue,"+notpassed],
[ r"^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+\s+(Passed)", "blue,"+passed],
[ r"^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+(\*{3}Not Run.*)\s+.*", "blue,"+notrun],
[ r"^\s*[0-9]+/[0-9]+ Test\s+#[0-9]+: (.*)\s+\.+(.*\*{3}.*)\s+.*", "blue,"+notpassed],
]

View file

@ -5,13 +5,13 @@ def theme(context):
["^Waiting for .*$", "red", "bold"],
[".*Sending.*", "green"],
# Watches
["^(Watching) (\S*) (.*)", "yellow", "bold,bold,normal"],
[r"^(Watching) (\S*) (.*)", "yellow", "bold,bold,normal"],
[".*reloading.$","yellow"],
# File from python/lib
["^(File) (/.*/lib/python[^/]*/site-packages/)([^/]*)\S* (first seen) (with mtime [0-9]*.*)$",
[r"^(File) (/.*/lib/python[^/]*/site-packages/)([^/]*)\S* (first seen) (with mtime [0-9]*.*)$",
"blue,blue,white,blue,blue", "bold,normal,bold,bold,normal"],
# File from app (last 3 name highlighted)
["^(File) (/\S*/)(\S*/\S*/)(\S*) (first seen) (with mtime [0-9]*.*)$",
[r"^(File) (/\S*/)(\S*/\S*/)(\S*) (first seen) (with mtime [0-9]*.*)$",
"magenta,magenta,white,white,magenta,magenta", "bold,normal,normal,bold,bold,normal"],
# SQL
["(.*)(SELECT)(.*)(FROM)(.*)",
@ -19,17 +19,17 @@ def theme(context):
["(.*)(SELECT)(.*)(FROM)(.*)(WHERE)(.*)",
"green", "normal,bold,normal,bold,normal,bold,normal"],
# HTTP
["\"(GET) (\S*) (HTTP\S*)\" ([0-9]+) (.*)$",
[r"\"(GET) (\S*) (HTTP\S*)\" ([0-9]+) (.*)$",
"green,white,green,green,green", "bold,bold,normal,bold,normal"],
# Errors
["(Exception) (while .*) '(.*)' (in) (.*) '(.*)'", "red,red,white,red,red,white", "bold,normal,bold,bold,normal,bold"],
["(.*Error): (.*) '(.*)'", "red,red,white", "bold,normal,bold"],
["(django[^:\s]*)\.([^.:\s]*): (.*)", "red","normal,bold,normal"],
[r"(django[^:\s]*)\.([^.:\s]*): (.*)", "red","normal,bold,normal"],
["Traceback.*:","yellow"],
["During handling.*","yellow"],
# File, line, in
[
"^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$",
r"^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$",
"blue, none, white,blue, yellow,blue",
"normal,normal,bold, normal,normal,bold"
],

View file

@ -35,17 +35,17 @@ def theme(context):
return context,[
# Command line
[ "[/\s]([cg]\+\+-*[0-9]*\.*[0-9]*)", "white", "bold" ],
[ "\s(\-D)(\s*[^\s]+)", "none,green", "normal,bold" ],
[ "\s(-g)", "green", "normal" ],
[ "\s-O[0-4]", "green", "normal" ],
[ "\s-[Wf][^\s]*", "magenta", "normal" ],
[ "\s-pedantic", "magenta", "normal" ],
[ "\s(-I)(/*[^\s]+/)([^/\s]+)", "none,blue", "normal,normal,bold" ],
[ "\s(-L)(/*[^\s]+/)([^/\s]+)", "none,cyan", "normal,normal,bold" ],
[ "\s(-l)([^/\s]+)", "none,cyan", "normal,bold" ],
[ "\s-[oc]", "red", "bold" ],
[ "\s(-+std(?:lib)?)=?([^\s]+)", "red", "normal,bold" ],
[ r"[/\s]([cg]\+\+-*[0-9]*\.*[0-9]*)", "white", "bold" ],
[ r"\s(\-D)(\s*[^\s]+)", "none,green", "normal,bold" ],
[ r"\s(-g)", "green", "normal" ],
[ r"\s-O[0-4]", "green", "normal" ],
[ r"\s-[Wf][^\s]*", "magenta", "normal" ],
[ r"\s-pedantic", "magenta", "normal" ],
[ r"\s(-I)(/*[^\s]+/)([^/\s]+)", "none,blue", "normal,normal,bold" ],
[ r"\s(-L)(/*[^\s]+/)([^/\s]+)", "none,cyan", "normal,normal,bold" ],
[ r"\s(-l)([^/\s]+)", "none,cyan", "normal,bold" ],
[ r"\s-[oc]", "red", "bold" ],
[ r"\s(-+std(?:lib)?)=?([^\s]+)", "red", "normal,bold" ],
# Important messages
[ _("error: "), "red", "bold" ],
@ -53,7 +53,7 @@ def theme(context):
[ _("warning: "), "magenta", "bold" ],
[ _("undefined reference to "), "red", "bold" ],
# [-Wflag]
[ "\[-W.*\]", "magenta"],
[ r"\[-W.*\]", "magenta"],
# Highlight message start:
# path file ext : line : col …

View file

@ -3,13 +3,13 @@
def theme(context):
style="monokai"
return context,[
[ "^(.*\.java):([0-9]+):\s*(warning:.*)$", "white,yellow,magenta", "normal,normal,bold" ],
[ "^(.*\.java):([0-9]+):(.*)$", "white,yellow,red", "normal,normal,bold" ],
[ "^(symbol|location)\s*:\s*(.*)$", "blue,Java", "bold,"+style ],
[ "^(found)\s*:\s*(.*)", "red,Java", "bold,"+style ],
[ "^(required)\s*:\s*(.*)", "green,Java", "bold,"+style ],
[ "^\s*\^$", "cyan", "bold" ],
[ "^\s+.*$", "Java", style ],
[ r"^(.*\.java):([0-9]+):\s*(warning:.*)$", "white,yellow,magenta", "normal,normal,bold" ],
[ r"^(.*\.java):([0-9]+):(.*)$", "white,yellow,red", "normal,normal,bold" ],
[ r"^(symbol|location)\s*:\s*(.*)$", "blue,Java", "bold,"+style ],
[ r"^(found)\s*:\s*(.*)", "red,Java", "bold,"+style ],
[ r"^(required)\s*:\s*(.*)", "green,Java", "bold,"+style ],
[ r"^\s*\^$", "cyan", "bold" ],
[ r"^\s+.*$", "Java", style ],
[ "[0-9]+ error[s]*", "red", "bold" ],
[ "[0-9]+ warning[s]*", "magenta", "bold" ],
]

View file

@ -3,10 +3,10 @@ def theme(context):
# This theme expect a formatted JSON input, with items spread across lines.
# See tools like "python -m json.tool" or "json_xs"
return context,[
[ '[\[\]{}],*\s*\n' ],
[ r'[\[\]{}],*\s*\n' ],
[ '" (:) ', "yellow" ],
[ '[\]}"](,)', "yellow" ],
[ "\"(-*[0-9]+\.*[0-9]*e*-*[0-9]*)\"", "blue" ],
[ r'[\]}"](,)', "yellow" ],
[ r"\"(-*[0-9]+\.*[0-9]*e*-*[0-9]*)\"", "blue" ],
[ '"(.*)"', "green" ],
[ """["']""", "cyan" ]
]

View file

@ -7,16 +7,16 @@ def theme(context):
"magenta,magenta,white,magenta", "normal,bold,normal" ],
["(LaTeX Warning): (.*)", "magenta", "normal,bold" ],
["(LaTeX Error): (.*)", "red", "normal,bold" ],
["^(.*\.tex):([0-9]+): (.*)", "white,yellow,red", "normal,normal,bold" ],
[r"^(.*\.tex):([0-9]+): (.*)", "white,yellow,red", "normal,normal,bold" ],
# ["on (page [0-9]+)", "yellow", "normal" ],
["on input (line [0-9]+)", "yellow", "normal" ],
["^! .*$", "red", "bold"],
["(.*erfull) ([^\s]+).* in [^\s]+ at (lines [0-9]+--[0-9]+)",
[r"(.*erfull) ([^\s]+).* in [^\s]+ at (lines [0-9]+--[0-9]+)",
"magenta,magenta,yellow", "normal"],
["\\[^\s]+\s", "white", "bold"],
["^l\.([0-9]+) (.*)", "yellow,tex"],
["^\s+(.*)", "tex"],
["(Output written on) (.*) \(([0-9]+ pages), [0-9]+ bytes\).",
[r"\\[^\s]+\s", "white", "bold"],
[r"^l\.([0-9]+) (.*)", "yellow,tex"],
[r"^\s+(.*)", "tex"],
[r"(Output written on) (.*) \(([0-9]+ pages), [0-9]+ bytes\).",
"blue,white,blue", "normal,bold,normal"],
["WARNING.*", "magenta", "normal"],
["[wW]arning.*", "magenta", "normal"],

View file

@ -11,9 +11,9 @@ def theme(context):
context["scale"] = (0,1)
# Link (ninja)
th.append( [ "^\[[0-9/]+\]\s?(Linking .* )(library|executable) (.*/)*(.+(\.[aso]+)*)$",
th.append( [ r"^\[[0-9/]+\]\s?(Linking .* )(library|executable) (.*/)*(.+(\.[aso]+)*)$",
"blue", "normal,normal,bold" ] )
# progress percentage (ninja)
th.append( [ "^(\[[0-9]+/[0-9]+\])","Scale" ] )
th.append( [ r"^(\[[0-9]+/[0-9]+\])","Scale" ] )
return context,th

View file

@ -1,7 +1,7 @@
def theme(context):
p="([-rwxsStT])"
reg="^([-dpcCDlMmpPs?])"+p*9+"\s.*$"
reg=r"^([-dpcCDlMmpPs?])"+p*9+r"\s.*$"
colors="blue"+",green"*3+",yellow"*3+",red"*3
styles="normal"+ ",normal,italic,bold"*3
return context,[ [reg, colors, styles] ]

View file

@ -5,16 +5,16 @@ def theme(context):
["^Traceback .*$", "blue" ],
# File, line, in
[
"^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$",
r"^\s{2}(File \")(/*.*?/)*([^/:]+)(\", line) ([0-9]+)(, in) (.*)$",
"blue, none, white,blue, yellow,blue",
"normal,normal,bold, normal,normal,bold"
],
# ["^\s{2}File \"(.*)\", line ([0-9]+), in (.*)$", "white,yellow,white", "normal,normal,bold" ],
# [r"^\s{2}File \"(.*)\", line ([0-9]+), in (.*)$", "white,yellow,white", "normal,normal,bold" ],
# Error name
["^([A-Za-z]*Error):*", "red", "bold" ],
["^([A-Za-z]*Exception):*", "red", "bold" ],
# any quoted things
["Error.*['\"](.*)['\"]", "magenta" ],
[r"Error.*['\"](.*)['\"]", "magenta" ],
# python code
["^\s{4}.*$", "Python", "monokai" ],
[r"^\s{4}.*$", "Python", "monokai" ],
]

View file

@ -4,30 +4,30 @@ def theme(context):
return context, [
# section title
["^(==[0-9]+==\s{1})(Memcheck|Copyright|Using)(.*)$","blue",""],
["^(==[0-9]+==\s{1})(Warning)(.*)$","magenta",""],
["^(==[0-9]+==\s{1}Command: )(\S*)(.*)$","green,white","normal,bold,normal"],
["^(==[0-9]+==\s{1})(HEAP SUMMARY:)(.*)$","green",""],
["^(==[0-9]+==\s{1})(All heap blocks were freed)(.*)$","green",""],
["^(==[0-9]+==\s{1})(.*[rR]erun.*)$","blue",""],
["^(==[0-9]+==\s{1})(Use --.*)$","blue",""],
["^(==[0-9]+==\s{1}\S+.*)$","red",""],
[r"^(==[0-9]+==\s{1})(Memcheck|Copyright|Using)(.*)$","blue",""],
[r"^(==[0-9]+==\s{1})(Warning)(.*)$","magenta",""],
[r"^(==[0-9]+==\s{1}Command: )(\S*)(.*)$","green,white","normal,bold,normal"],
[r"^(==[0-9]+==\s{1})(HEAP SUMMARY:)(.*)$","green",""],
[r"^(==[0-9]+==\s{1})(All heap blocks were freed)(.*)$","green",""],
[r"^(==[0-9]+==\s{1})(.*[rR]erun.*)$","blue",""],
[r"^(==[0-9]+==\s{1})(Use --.*)$","blue",""],
[r"^(==[0-9]+==\s{1}\S+.*)$","red",""],
# section explanation
["^==[0-9]+==\s{2}(\S+.*)$","orange",""],
[r"^==[0-9]+==\s{2}(\S+.*)$","orange",""],
# locations adresses
["^==[0-9]+==\s{4}([atby]{2}) (0x0): (\?{3})",
[r"^==[0-9]+==\s{4}([atby]{2}) (0x0): (\?{3})",
"blue,yellow,red", "normal,normal,bold"],
["^==[0-9]+==\s{4}([atby]{2}) (0x)([^:]*:) (\S+)",
[r"^==[0-9]+==\s{4}([atby]{2}) (0x)([^:]*:) (\S+)",
"blue,blue,blue,none", "normal"],
# locations: library
["\(in (.*)\)", "cyan", "normal"],
[r"\(in (.*)\)", "cyan", "normal"],
# locations: file
["\(([^\.]*\.[^:]+):([0-9]+)\)", "white,yellow", "bold,normal"],
[r"\(([^\.]*\.[^:]+):([0-9]+)\)", "white,yellow", "bold,normal"],
# leak summary
["^==[0-9]+==\s{4}(definitely lost): .* (in) .*","red","bold"],
["^==[0-9]+==\s{4}(indirectly lost): .* (in) .*","orange","bold"],
["^==[0-9]+==\s{6}(possibly lost): .* (in) .*","yellow","bold"],
["^==[0-9]+==\s{4}(still reachable): .* (in) .*","green","bold"],
["^==[0-9]+==\s{9}(suppressed): .* (in) .*","cyan","bold"],
[r"^==[0-9]+==\s{4}(definitely lost): .* (in) .*","red","bold"],
[r"^==[0-9]+==\s{4}(indirectly lost): .* (in) .*","orange","bold"],
[r"^==[0-9]+==\s{6}(possibly lost): .* (in) .*","yellow","bold"],
[r"^==[0-9]+==\s{4}(still reachable): .* (in) .*","green","bold"],
[r"^==[0-9]+==\s{9}(suppressed): .* (in) .*","cyan","bold"],
]

26
colout/colout_vivado.py Normal file
View file

@ -0,0 +1,26 @@
def theme(context):
# Theme for coloring AMD/Xilinx Vivado IDE synthesis and implementation output
return context,[
[ r"^\s*\*+.+$", "green" ],
[ "^#.+", "green" ],
[ "^.+ Checksum: .+$", "green" ],
[ r"^.+Time \(s\).+", "green" ],
[ r"^Time \(s\).+", "green" ],
[ r"Estimated Timing Summary \|.+\|.+\|", "cyan", "bold" ],
[ r"Intermediate Timing Summary \|.+\|.+\|", "cyan", "bold" ],
[ "^INFO:", "white", "bold" ],
[ "^WARNING:.+$", "yellow" ],
[ "^CRITICAL WARNING:.+$", "red" ],
[ "^ERROR:.+$", "red" ],
[ "^Phase [0-9]+.[0-9]+.[0-9]+.[0-9]+.+$", "magenta", "bold" ],
[ "^Phase [0-9]+.[0-9]+.[0-9]+.+$", "magenta", "bold" ],
[ "^Phase [0-9]+.[0-9]+.+$", "magenta", "bold" ],
[ "^Phase [0-9]+.+$", "magenta", "bold" ]
]