summarylogtreecommitdiffstats
path: root/tlc-colour
blob: f5535a6f41bfc7be22dd111101ad442db8d40c4e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/bin/bash

if [ $# -eq 0 ]; then

  # Colour stdin
  exec perl -pe '
    s/^(Warning:.*)$/\e[30;43m$1\e[0m/;
    s/^(Error:(?! The behavior up to this point is).*|\*\*\*.*Error.*)$/\e[97;41m$1\e[0m/;
    s/^(State \d+: <)(\S+?)( line.+)$/\e[93m$1\e[0;30;43m$2\e[0;93m$3\e[0m/;
    s/^(State \d+:.*)$/\e[93m$1\e[0m/;
    s/^(Model checking completed. No error.*)$/\e[30;42m$1\e[0m/;
  '

else

  # Run tlc
  exec "$(dirname "$0")"/tlc "$@" | "$0"

fi