[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: GNU Source-highlight -> Lua Highlighter for enscript
- From: Salvador Espana <sespana@...>
- Date: Mon, 26 Apr 2004 17:37:18 +0200 (CEST)
On Mon, 26 Apr 2004, Luiz Henrique de Figueiredo wrote:
> GNU Source-highlight 1.9 now includes support for Lua.
> http://www.gnu.org/software/src-highlite/
I have modified enscript.st file in my computer in order to include
support for Lua code in enscript, other gnu source-highlight formatter
(http://people.ssh.fi/mtr/genscript/). I did not know about src-highlite,
but I will try it and maybe it replaces enscript :). Anyway, I sent you
the configuration file needed to give support to Lua.
Best regards,
Salvador E.
Post.data: I sent you only diff output with respect to the original
configuration file enscript.st, I can send you the entire file If you
want. It seems to work well, but I have coded it with no knowledge of
"awk-like" enscript language, only by analogy to other source.
1290d1289
< /\.lua$/ lua;
4534,4656d4532
< /**
< * Name: lua
< * Description: Lua programming language.
< */
<
< state lua_string
< {
< /(\]\])/ {
< language_print ($0);
< return;
< }
< lua_string_end {
< language_print ($0);
< return;
< }
< LANGUAGE_SPECIALS {
< language_print ($0);
< }
< }
<
< state lua_long_comment
< {
< /(\]\])/ {
< language_print ($0);
< return;
< }
< LANGUAGE_SPECIALS {
< language_print ($0);
< }
< }
<
< state lua
< {
< /* Comments. */
< /^#|--/ {
< comment_face (true);
< language_print ($0);
< call (eat_one_line);
< comment_face (false);
< }
<
< /* Lua long comment */
< /(--\[\[)/ {
< comment_face (true);
< language_print ($0);
< call (lua_long_comment);
< comment_face (false);
< }
<
< /* Lua strings */
< /(\[\[)/ {
< string_face (true);
< language_print ($0);
< call (lua_string);
< string_face (false);
< }
<
< /(\"|[\'])/ {
< lua_string_end = regexp( $0 );
< string_face (true);
< language_print ($0);
< call (lua_string);
< string_face (false);
< }
<
< /* Function */
< /([ \t]*)(function)([ \t]+)([^(]*)/ {
< /* indentation */
< language_print ($1);
<
< /* def */
< keyword_face (true);
< language_print ($2);
< keyword_face (false);
<
< /* middle */
< language_print ($3);
<
< /* Function name. */
< function_name_face (true);
< language_print ($4);
< function_name_face (false);
< }
<
< /* local variable */
< /([ \t]*)(local)([ \t,]+)([^=]*)/ {
< /* indentation */
< language_print ($1);
<
< keyword_face (true);
< language_print ($2);
< keyword_face (false);
<
< /* middle */
< language_print ($3);
<
< /* Function name. */
< variable_name_face (true);
< language_print ($4);
< variable_name_face (false);
< }
<
< /* Keywords
< (build-re '(and assert break class continue def del elif else
< else: except except: exec finally for from global if import in
< is lambda not or pass print raise return try try: while
< yield)) */
< /\b(and|break|do|e(lse(|if)|nd)|f(alse|or|unction)|i(f|n)|local|n(il|ot)|\
< or|re(peat|turn)|t(hen|rue)|until|while)\b/ {
< keyword_face (true);
< language_print ($0);
< keyword_face (false);
< }
< }
<
<
< /*
< Local variables:
< mode: c
< End:
< */
<