### HighLight ###
HighLight (HL) is a small domain-specific language for encoding basic
syntax-highlighting information in-line with source code. Here is an example:
%Tint %Vx = %N3 ;
%Tstring %Vs = %{S"line 1%{E\n%}line 2"%} ;
HL has only 3 syntax rules:
* `%A` applies rule `A` from the next character until before the next
whitespace character or at the start/end of another rule, or a
"word style".
* `%{A...%}` applies rule `A` across all of `...`, or a "region style".
* `%%` applies no rule but instead simply expands to a literal `%`
character.
Rules only have a "start" and "end" and will not modify any text that is not
part of a rule marker. Rule identifiers are single characters in the range
`A-Za-z`.
Config files store rules in this format:
<identifier>\t<start>\t<end>[\t<comment>]
For example, a config file that converts the example at the top into HTML using
`<span>` tags might look like this:
T <span class="type"> </span> A type
V <span class="var"> </span> A variable
N <span class="num"> </span> A numeric literal
S <span class="str"> </span> A string literal
E <span class="escape"> </span> An escape sequence
For configs that will not work properly when "nested" e.g. with an ANSI escape
sequence based config that uses "\x1b[0m" as the end markers, the first (and
only the first) line of the config file can be given as `#nonest`. This will
mean that this:
%{Aaaa%{Bbbb%}ccc%}
will be treated as though it is this:
%{Aaaa%}%{Bbbb%}%{Accc%}
# USAGE
hl -c|--config <config> [-o|--output <output>] [<input>]
-c|--config <config>
Use the given config file. This has no default.
-o|--output <output>
Write output to the given file. If not provided, will write to stdout.
<input>
Read from the given input file. If not provided, will read from stdin.
# INSTALLING
Where $PREFIX is somewhere in your $PATH (e.g. "~/.bin"):
dmd hl.d -of="$PREFIX/hl"
# EXAMPLES
Use the `test.src` example source file with the two provided example config
files like this:
hl -c term.conf test.src
hl -c html.conf test.src
`term.conf` uses escape sequences so the output to your terminal will be
coloured. `html.conf` uses `<span>` tags instead and can be used e.g. for adding
syntax-highlighted code snippets to websites.