/*
* Describe all known highlight languages.
*/
state describe_me
{
/ \*$/ {
}
/ \*\\\/.*/ {
print ("\n");
/* All done. */
return;
}
/ \* ?(.*)/ {
print ($1);
}
}
state describe_languages
{
/^\/\*\*.*$/ {
call (describe_me);
}
/[^\\\/]+/ {
/* NOP */
}
/./ {
/* NOP */
}
}
/*
* Create a HTML report of all supported highlighting rules.
*/
sub html_annotate_mailtos (str)
{
return regsuball (str, /[-_a-zA-Z0-9\\.]+@[-_a-zA-Z0-9\\.]+/,
"$0");
}
sub html_quote (str)
{
str = regsuball (str, /\&/, "&");
str = regsuball (str, /, "<");
str = regsuball (str, />/, ">");
str = regsuball (str, /\"/, """);
return str;
}
sub describe_me_html_print_pending_name ()
{
if (!language_name_pending)
return;
print ("
\n
\n- Name:
- ",
html_quote (language_name), "\n");
language_name_pending = 0;
}
state describe_me_html
{
/ \*$/ {
}
/ \*\\\/.*/ {
/* Terminate this state. */
describe_me_html_print_pending_name ();
print ("
\n");
return;
}
/ \* ?(.*)/ {
row = $1;
if (regmatch (row, /Name:(.*)/))
{
language_name = $1;
language_name_pending = 1;
}
else if (regmatch (row, /Description:(.*)/))
{
/* This starts the new language. */
title = $1;
title = regsub (title, /^[ \t]+/, "");
title = regsub (title, /[ \t\\.]+$/, "");
print ("", html_quote (title), "\n");
}
else if (regmatch (row, /([a-zA-Z]+:)(.*)/))
{
describe_me_html_print_pending_name ();
print ("
", html_quote ($1), "",
html_annotate_mailtos (html_quote ($2)));
}
else
print (html_annotate_mailtos (html_quote (row)));
}
}
current_input_file = 0;
state describe_languages_html
{
BEGIN {
if (current_input_file == 0)
{
title = "Enscript Highlighting Languages And File Formats";
print ("\n",
"\n\n", title, "\n",
"\n",
"\n",
"\n",
"", title, "
\n
\n\n");
}
current_input_file++;
}
END {
if (current_input_file == length (argv))
print ("\n
\n
By ", version,
"\n\n\n");
}
/^\/\*\*.*$/ {
call (describe_me_html);
}
/[^\\\/]+/ {
/* NOP */
}
/./ {
/* NOP */
}
}
/*
Local variables:
mode: c
End:
*/