From 36088d128bddbd813d317fafc5aebf701c01fc93 Mon Sep 17 00:00:00 2001 From: Automatic Build System Date: Fri, 5 Jan 2024 22:06:47 +0100 Subject: [PATCH] automatic version update by autodist [release 1.6.6-1mamba;Thu Oct 11 2012] --- README.md | 2 + enscript-1.6.1-CAN-2004-1185.patch | 22 + enscript-1.6.1-CAN-2004-1186.patch | 14 + enscript-1.6.1-config.patch | 95 + enscript-1.6.1-locale.patch | 26 + enscript-1.6.4-hilight.patch | 1255 ++++++ enscript-doublefree.patch | 15 + enscript-wrap_header.patch | 121 + enscript.spec | 107 + enscript.st | 6026 ++++++++++++++++++++++++++++ 10 files changed, 7683 insertions(+) create mode 100644 enscript-1.6.1-CAN-2004-1185.patch create mode 100644 enscript-1.6.1-CAN-2004-1186.patch create mode 100644 enscript-1.6.1-config.patch create mode 100644 enscript-1.6.1-locale.patch create mode 100644 enscript-1.6.4-hilight.patch create mode 100644 enscript-doublefree.patch create mode 100644 enscript-wrap_header.patch create mode 100644 enscript.spec create mode 100644 enscript.st diff --git a/README.md b/README.md index fc6b3a2..3656e3c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,4 @@ # enscript +GNU enscript is a free replacement for Adobe's Enscript program. Enscript converts ASCII files to PostScript(TM) and spools generated PostScript output to the specified printer or saves it to a file. Enscript can be extended to handle different output media and includes many options for customizing printouts. + diff --git a/enscript-1.6.1-CAN-2004-1185.patch b/enscript-1.6.1-CAN-2004-1185.patch new file mode 100644 index 0000000..9dd8fad --- /dev/null +++ b/enscript-1.6.1-CAN-2004-1185.patch @@ -0,0 +1,22 @@ +--- enscript-1.6.1/src/psgen.c.CAN-2004-1185 2005-01-10 15:55:33.560648363 +0000 ++++ enscript-1.6.1/src/psgen.c 2005-01-10 15:56:30.266830723 +0000 +@@ -2210,9 +2210,10 @@ + MESSAGE (2, (stderr, "^@epsf=\"%s\"\n", token->u.epsf.filename)); + + i = strlen (token->u.epsf.filename); ++ /* + if (i > 0 && token->u.epsf.filename[i - 1] == '|') + { +- /* Read EPS data from pipe. */ ++ / * Read EPS data from pipe. * / + token->u.epsf.pipe = 1; + token->u.epsf.filename[i - 1] = '\0'; + token->u.epsf.fp = popen (token->u.epsf.filename, "r"); +@@ -2225,6 +2226,7 @@ + } + } + else ++ */ + { + /* Read EPS data from file. */ + tilde_subst (token->u.epsf.filename, filename); diff --git a/enscript-1.6.1-CAN-2004-1186.patch b/enscript-1.6.1-CAN-2004-1186.patch new file mode 100644 index 0000000..7c8f8e1 --- /dev/null +++ b/enscript-1.6.1-CAN-2004-1186.patch @@ -0,0 +1,14 @@ +--- enscript-1.6.1/src/psgen.c.CAN-2004-1186 2005-01-10 15:57:07.432740602 +0000 ++++ enscript-1.6.1/src/psgen.c 2005-01-10 15:58:24.606016206 +0000 +@@ -1914,8 +1914,9 @@ + else + { + ftail++; +- strncpy (buf, fname, ftail - fname); +- buf[ftail - fname] = '\0'; ++ i = ftail - fname >= sizeof (buf)-1 ? sizeof (buf)-1 : ftail - fname; ++ strncpy (buf, fname, i); ++ buf[i] = '\0'; + } + + if (nup > 1) diff --git a/enscript-1.6.1-config.patch b/enscript-1.6.1-config.patch new file mode 100644 index 0000000..5823a9d --- /dev/null +++ b/enscript-1.6.1-config.patch @@ -0,0 +1,95 @@ +--- enscript-1.6.4/afm/Makefile.am.config 2003-03-05 07:26:16.000000000 +0000 ++++ enscript-1.6.4/afm/Makefile.am 2005-12-23 09:56:52.000000000 +0000 +@@ -36,11 +36,11 @@ + EXTRA_DIST = font.map $(default_afm) $(public_fonts) + + install-data-local: +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript/afm ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/afm + for f in $(EXTRA_DIST); do \ +- $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/afm/$$f; \ ++ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/afm/$$f; \ + done + + uninstall-local: +- rm -rf $(datadir)/enscript/afm ++ rm -rf $(DESTDIR)/$(datadir)/enscript/afm +--- enscript-1.6.4/afm/Makefile.in.config 2003-03-05 07:40:06.000000000 +0000 ++++ enscript-1.6.4/afm/Makefile.in 2005-12-23 09:56:52.000000000 +0000 +@@ -319,14 +319,14 @@ + + + install-data-local: +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript/afm ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/afm + for f in $(EXTRA_DIST); do \ +- $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/afm/$$f; \ ++ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/afm/$$f; \ + done + + uninstall-local: +- rm -rf $(datadir)/enscript/afm ++ rm -rf $(DESTDIR)/$(datadir)/enscript/afm + # Tell versions [3.59,3.63) of GNU make to not export all variables. + # Otherwise a system limit (for SysV at least) may be exceeded. + .NOEXPORT: +--- enscript-1.6.4/lib/Makefile.in.config 2003-03-05 07:40:07.000000000 +0000 ++++ enscript-1.6.4/lib/Makefile.in 2005-12-23 09:56:52.000000000 +0000 +@@ -345,15 +345,16 @@ + all-local: enscript.cfg + + install-data-local: enscript.cfg +- $(top_srcdir)/mkinstalldirs $(sysconfdir) +- if test -r $(sysconfdir)/enscript.cfg; then \ +- cp $(sysconfdir)/enscript.cfg $(sysconfdir)/enscript.cfg.old; \ ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)$(sysconfdir) ++ if test -r $(DESTDIR)$(sysconfdir)/enscript.cfg; then \ ++ cp $(DESTDIR)$(sysconfdir)/enscript.cfg \ ++ $(DESTDIR)$(sysconfdir)/enscript.cfg.old; \ + else :; \ + fi +- $(INSTALL_DATA) enscript.cfg $(sysconfdir)/enscript.cfg ++ $(INSTALL_DATA) enscript.cfg $(DESTDIR)$(sysconfdir)/enscript.cfg + + uninstall-local: +- rm -f $(sysconfdir)/enscript.cfg ++ rm -f $(DESTDIR)$(sysconfdir)/enscript.cfg + + enscript.cfg: $(srcdir)/enscript.cfg.in Makefile + sed 's%@DATADIR@%$(datadir)%g; s%@media@%@MEDIA@%g; s%@BINDIR@%$(bindir)%g; s%@spooler@%@SPOOLER@%g; s%@pslevel@%@PSLEVEL@%g' \ +--- enscript-1.6.4/states/hl/Makefile.am.config 2005-12-23 09:59:55.000000000 +0000 ++++ enscript-1.6.4/states/hl/Makefile.am 2005-12-23 10:00:09.000000000 +0000 +@@ -45,10 +45,10 @@ + EXTRA_DIST = $(states) + + install-data-local: +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript/hl ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/hl + for f in $(states); do \ +- $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/hl/$$f; \ ++ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/hl/$$f; \ + done + + uninstall-local: +--- enscript-1.6.4/states/hl/Makefile.in.config 2005-12-23 10:00:13.000000000 +0000 ++++ enscript-1.6.4/states/hl/Makefile.in 2005-12-23 10:00:34.000000000 +0000 +@@ -330,10 +330,10 @@ + + + install-data-local: +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript +- $(top_srcdir)/mkinstalldirs $(datadir)/enscript/hl ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript ++ $(top_srcdir)/mkinstalldirs $(DESTDIR)/$(datadir)/enscript/hl + for f in $(states); do \ +- $(INSTALL_DATA) $(srcdir)/$$f $(datadir)/enscript/hl/$$f; \ ++ $(INSTALL_DATA) $(srcdir)/$$f $(DESTDIR)/$(datadir)/enscript/hl/$$f; \ + done + + uninstall-local: diff --git a/enscript-1.6.1-locale.patch b/enscript-1.6.1-locale.patch new file mode 100644 index 0000000..5325ed0 --- /dev/null +++ b/enscript-1.6.1-locale.patch @@ -0,0 +1,26 @@ +--- enscript-1.6.1/src/main.c.locale Mon Mar 18 11:23:14 2002 ++++ enscript-1.6.1/src/main.c Mon Mar 18 11:24:08 2002 +@@ -912,9 +912,8 @@ + * We want to change only messages (gs do not like decimals in 0,1 + * format ;) + */ +-#if HAVE_LC_MESSAGES +- setlocale (LC_MESSAGES, ""); +-#endif ++ setlocale (LC_ALL, ""); ++ setlocale (LC_NUMERIC, "C"); + #endif + #if ENABLE_NLS + bindtextdomain (PACKAGE, LOCALEDIR); +--- enscript-1.6.1/src/psgen.c.locale Mon Mar 18 11:23:14 2002 ++++ enscript-1.6.1/src/psgen.c Mon Mar 18 11:23:14 2002 +@@ -1103,7 +1103,8 @@ + /* Get escape name. */ + for (i = 0; i < sizeof (escname) - 1 && (ch = is_getc (is)) != EOF; i++) + { +- if (!isalnum (ch)) ++ if (!((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') || ++ (ch >= 'a' && ch <= 'z'))) + { + is_ungetc (ch, is); + break; diff --git a/enscript-1.6.4-hilight.patch b/enscript-1.6.4-hilight.patch new file mode 100644 index 0000000..effafae --- /dev/null +++ b/enscript-1.6.4-hilight.patch @@ -0,0 +1,1255 @@ +04_hilight.dpatch from Debian's 1.6.4-7 patchset, with a few changes: +o hilight *.xhtml as html +o install php.st and ruby.st bits +o patch Makefile.am too + +diff -Nru enscript-1.6.4.orig/states/hl/changelog.st enscript-1.6.4/states/hl/changelog.st +--- enscript-1.6.4.orig/states/hl/changelog.st 2003-03-05 09:26:33.000000000 +0200 ++++ enscript-1.6.4/states/hl/changelog.st 2006-01-09 22:02:28.000000000 +0200 +@@ -43,7 +43,7 @@ + } + + /* File descriptions without function names. */ +- /(^\t\* )([^ :]+)(:)/ { ++ /(^\t\* )([^:]+)(:)/ { + language_print ($1); + + function_name_face (true); +diff -Nru enscript-1.6.4.orig/states/hl/dylan.st enscript-1.6.4/states/hl/dylan.st +--- enscript-1.6.4.orig/states/hl/dylan.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/dylan.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,124 @@ ++/** ++ * Name: dylan ++ * Description: Dylan Programming Language template for Enscript. ++ * Author: Brent Fulgham ++ * (based on the Scheme version by Markku Rossi ) ++ */ ++ ++dylan_mod_re = ++/* Definition Modifiers ++ (build-re '(abstract block concrete constant class domain exception exclude ++ export function functional generic handler import inherited inline ++ instance interface library macro method open primary sealed sideways ++ singleton slot subclass variable virtual)) ++ */ ++ /\b(subclass|abstract|block|c(on(crete|stant)|lass)|domain\ ++|ex(c(eption|lude)|port)|f(unction(|al))|generic|handler\ ++|i(n(herited|line|stance|terface)|mport)|library|m(acro|ethod)\ ++|open|primary|sealed|si(deways|ngleton)|slot\ ++|v(ariable|irtual))\b/; ++ ++state dylan extends HighlightEntry ++{ ++ BEGIN { ++ /* ++ * Modify regexp character syntax so that we can distinguish all ++ * dylan symbols. ++ */ ++ extras = list ('!', '$', '%', '&', '*', '/', ':', ++ '=', '?', '~', '^', '.', '+', '-'); ++ for (i = 0; i < length (extras); i = i + 1) ++ regexp_syntax (extras[i], 'w'); ++ } ++ ++ /* Modifiers */ ++ dylan_mod_re { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* Types */ ++ /<\w+>/ { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* Symbols */ ++ /#\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Comments. */ ++ /\/\// { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ /\/\*/ { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Character constants. */ ++ /'.*'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Keywords. ++ "=>" + ++ (build-re '(above afterwards begin below by case cleanup create ++ define end else elseif finally for from if in let local otherwise rename ++ select signal then to unless until use variable virtual when while ++ */ ++ /=>|\b(a(bove|fterwards)|b(e(gin|low)|y)|c(ase|leanup|reate)\ ++|define|else(|if)|end|f(inally|or|rom)|i[fn]|l(et|ocal)|otherwise\ ++|rename|s(elect|ignal)|t(hen|o)|u(n(less|til)|se)|wh(en|ile))\b/ { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* ':'-names, Emacs highlights these, so do we. */ ++ /([ \t])([!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*:)/ { ++ language_print ($1); ++ reference_face (true); ++ language_print ($2); ++ reference_face (false); ++ } ++ ++ /* Function faces */ ++ /([ \t]*)(\w+[^:])([ \t]*\([ \t]*)/ { ++ language_print ($1); ++ function_name_face(true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face(false); ++ language_print ($3); ++ } ++} ++ ++ ++/* ++Local variables: ++mode: c ++End: ++*/ +diff -Nru enscript-1.6.4.orig/states/hl/eiffel.st enscript-1.6.4/states/hl/eiffel.st +--- enscript-1.6.4.orig/states/hl/eiffel.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/eiffel.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,132 @@ ++/** ++ * Name: eiffel ++ * Description: Eiffel programming language. ++ * Author: Julien Lemoine ++ * Brent Fulgham ++ */ ++ ++eiffel_types = ++/* Types */ ++ /\b(ABSTRACT_(FRACTION|INTEGER)|ANY|AR(GUMENTS|RAY(|2|3|ED_COLLECTION))\ ++|BASIC_(DIRECTORY|TIME)|BINARY_FILE_(READ|WRITE)|BIT_(N|STRING)|BOOLEAN\ ++|CHARACTER(|_CONSTANTS)|CLOCK|COLLECTION(|2|3|_SORTER)|COMPARABLE\ ++|COUNTER|DICTIONARY(|_NODE)|D(IRECTORY|OUBLE)|EXCEPTIONS|FILE(|_TOOLS)\ ++|FIXED_ARRAY(|2|3)|GE(NERAL|N_RAND)|HASH(ABLE|_TABLE_SIZE)|INPUT_STREAM\ ++|INTEGER(|_8|_16|_32|_64|_FRACTION|_GENERAL)\ ++|ITERATOR(|_ON_(COLLECTION|DICTIONARY(_ITEMS|_KEYS)|LINKED_LIST|SET\ ++|STRING|TWO_WAY_LINKED_LIST|UNICODE_STRING))\ ++|LARGE(|_NEGATIVE|_POSITIVE)_INTEGER|LINK(|2|ED(_COLLECTION|_LIST))\ ++|MATH_CONSTANTS|MEMO(|RY)|MICROSECOND_TIME|MINI_PARSER_BUFFER\ ++|MIN_STAND|MUTABLE_BIG_INTEGER|NATIVE_ARRAY|NULL_(INPUT|OUTPUT)\ ++|NUMBER(|_FRACTION|_TOOLS)|NUMERIC|OUTPUT_STREAM|PLATFORM|POINTER\ ++|REAL|REVERSE_COLLECTION_SORTER|SAFE_EQUAL|SCOOP_UTILITIES|SET(|_NODE)\ ++|SMALL_INTEGER|STD_(ERROR|FILE_(READ|READ_WRITE|WRITE)|INPUT(|_OUTPUT)\ ++|OUTPUT|RAND)|STRING(|_HANDLER)|SYSTEM|TIME(|_IN_(ENGLISH|FRENCH|GERMAN\ ++|ITALIAN|SOME_LANGUAGE|SPANISH))|TWO_WAY_LINKED_LIST\ ++|UNICODE_STRING(|_HANDLER)|UTF8_PARSER)\b/; ++ ++eiffel_keywords = ++/* Keywords */ ++ /\b(agent|a(ll|lias)|and|as(|sign)|check|class|convert|create|Current|debug\ ++|deferred|do|else(|if)|en(d|sure)|ex(panded|port|ternal)|False\ ++|feature|fro(m|zen)|if|implies|in(dexing|fix|herit|spect|variant)\ ++|is|like|local|loop|not|o(r|bsolete|ld|nce)|prefix|Precursor|pure\ ++|re(define|ference|name|quire|scue|try)|Result|separate|then|True\ ++|TUPLE|un(define|til)|creation)\b/; ++ ++state eiffel extends HighlightEntry ++{ ++ ++ /* One line comments. */ ++ /\-\-/ { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ ++ /* Keywords. */ ++ eiffel_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Types. */ ++ eiffel_types { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Character constants. */ ++ /'.'|'\\\\.'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Symbols, etc. */ ++ /:=|==|<=|>=|=|!=|\/=|!|!!/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* Type declarations */ ++ /([ \t])*([a-zA-Z]+[, \ta-zA-Z0-9_]*):[^=]/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ ++ /* ++ * Function definitions, with args ++ * fct_name (args...) is ++ */ ++ /^([ \t]*[a-zA-Z_][a-zA-Z_0-9]*[ \t]*)(\([ \t]*[ \ta-z,A-Z_0-9]+)(:[ \ta-zA-Z0-9_\[\]]+)?(\)[ \t]*)(:[ \ta-zA-Z0-9_\[\]]+)?([ \t]+is)[ \t]*$/ { ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($1); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print ($2); ++ type_face (true); ++ language_print ($3); ++ type_face (false); ++ language_print ($4); ++ type_face (true); ++ language_print ($5); ++ type_face (false); ++ keyword_face (true); ++ language_print ($6); ++ keyword_face (false); ++ language_print ($7); ++ } ++ ++ /* ++ * Function definitions, without args ++ * fct_name is ++ */ ++ /^([ \t]*[a-zA-Z_][a-zA-Z_0-9]*)([ \t]*)(is)[ \t]*$/ { ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($1); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print(" "); ++ keyword_face (true); ++ language_print ($3); ++ keyword_face (false); ++ } ++ ++} +diff -Nru enscript-1.6.4.orig/states/hl/enscript.st enscript-1.6.4/states/hl/enscript.st +--- enscript-1.6.4.orig/states/hl/enscript.st 2003-03-05 10:31:31.000000000 +0200 ++++ enscript-1.6.4/states/hl/enscript.st 2006-01-09 22:04:22.000000000 +0200 +@@ -474,24 +474,31 @@ + /\.m$/ matlab; + /\.(mpl|mp|maple)$/ maple; + /\.(scm|scheme)$/ scheme; ++ /\.e$/ eiffel; ++ /\.erl$/ erlang; + /\b\.emacs$|\.el$/ elisp; + /\.ad(s|b|a)$/ ada; + /\.[Ss]$/ asm; ++ /\.sml$/ sml; + /\.st$/ states; ++ /\.lua$/ lua; + /(M|m)akefile.*/ makefile; + /\.(MOD|DEF|mi|md)$/ modula_2; ++ /\.oz$/ oz; + /\.tcl$/ tcl; + /\.(v|vh)$/ verilog; +- /\.html?$/ html; ++ /\.x?html?$/ html; + /\bChangeLog$/ changelog; + /\.(vhd|vhdl)$/ vhdl; + /\.(scr|.syn|.synth)$/ synopsys; + /\.idl$/ idl; + /\.(hs|lhs|gs|lgs)$/ haskell; + /\.(pm|pl)$/ perl; ++ /\.php[34]?$/ php; + /\.(eps|EPS|ps|PS)$/ postscript; + /\.py$/ python; + /\.pyx$/ pyrex; ++ /\.rbw?$/ ruby; + /\.js$/ javascript; + /\.java$/ java; + /\.([Pp][Aa][Ss]|[Pp][Pp]|[Pp])$/ pascal; +@@ -530,6 +537,10 @@ + /-\*- [Ii][Dd][Ll] -\*-/ idl; + /-\*- [Pp][Ee][Rr][Ll] -\*-/ perl; + /^#![ \t]*\/.*\/perl/ perl; ++ /-\*- [Pp][Hh][Pp] -\*-/ php; ++ /^<\?php/ php; ++ /-\*- [Rr][Uu][Bb][Yy] -\*-/ ruby; ++ /^#![ \t]*\/.*\/ruby/ ruby; + /^From:/ mail; + /^#![ \t]*(\/usr)?\/bin\/[ngmt]?awk/ awk; + /^#![ \t]*(\/usr)?\/bin\/sh/ sh; +diff -Nru enscript-1.6.4.orig/states/hl/erlang.st enscript-1.6.4/states/hl/erlang.st +--- enscript-1.6.4.orig/states/hl/erlang.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/erlang.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,161 @@ ++/** ++ * Name: erlang ++ * Description: Erlang programming language. ++ * Author: Sean Hinde ++ */ ++ ++ ++/* Erlang atom: ([a-z][a-zA-Z0-9_]*|\'[^\n]*\') */ ++ ++state erlang extends HighlightEntry ++{ ++ /* Comments */ ++ /%/ { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Special -record(rec_name, {}). pre-processor case */ ++ /(-record)(\([ \t]*)([a-z][a-zA-Z0-9_]*|\'[^\n]*\')/ { ++ reference_face (true); ++ language_print ($1); ++ reference_face (false); ++ language_print ($2); ++ type_face (true); ++ language_print ($3); ++ type_face (false); ++ } ++ ++ /* Special -define(Alter, "Hello"). pre-processor case */ ++ /(-define)(\([ ++\t]*)([a-z][a-zA-Z0-9_]*|\'[^\n]*\'|[A-Z_][a-zA-Z0-9_]*)/ { ++ reference_face (true); ++ language_print ($1); ++ reference_face (false); ++ language_print ($2); ++ builtin_face (true); ++ language_print ($3); ++ builtin_face (false); ++ } ++ ++ /* Pre-processor lines. */ ++ /^-([a-z][a-zA-Z0-9_]*)/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* Defines */ ++ /(\?)([a-z][a-zA-Z0-9_]*|\'[^\n]*\'|[A-Z_][a-zA-Z0-9_]*)/ { ++ language_print ($1); ++ builtin_face (true); ++ language_print ($2); ++ builtin_face (false); ++ } ++ ++ /* Records */ ++ /(#)([a-z][a-zA-Z0-9_]*|\'[^\n]*\')/ { ++ language_print ($1); ++ type_face (true); ++ language_print ($2); ++ type_face (false); ++ } ++ ++ /* Keywords. ++ '(after begin case try catch end fun if of receive when) ++ Regexp taken from emacs Erlang mode R9C ++ */ ++ /\b(a(fter|ndalso)|begin|c(atch|ase)\ ++|end|fun|if|o(f|relse)|receive|try|when\ ++|query)\b/ { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Guards. ++ Regexp taken from emacs Erlang mode R9C ++ */ ++ /\b((is_)*(atom|function|binary|constant|float\ ++|integer|list|number|p(id|ort)\ ++|re(ference|cord)|tuple))\b/ { ++ builtin_face (true); ++ language_print ($0); ++ builtin_face (false); ++ } ++ ++ /* Built in functions */ ++ ++/\b(a(bs|live|pply|tom_to_list)\ ++|binary_to_(list|term)\ ++|concat_binary|d(ate|isconnect_node)\ ++|e(lement|rase|xit)\ ++|float(|_to_list)\ ++|g(arbage_collect|et(|_keys)|roup_leader)\ ++|h(alt|d)\ ++|i(nte(ger_to_list|rnal_bif)|s_alive)\ ++|l(ength|i(nk|st_to_(atom|binary|float|integer\ ++|pid|tuple)))\ ++|make_ref|no(de(|_(link|unlink)|s)|talive)\ ++|open_port\ ++|p(id_to_list|rocess(_(flag|info)|es)|ut)\ ++|r(egister(|ed)|ound)\ ++|s(e(lf|telement)|ize\ ++|p(awn(|_link)|lit_binary)|tatistics)\ ++|t(erm_to_binary|hrow|ime|l\ ++|r(ace|unc)|uple_to_list)\ ++|un(link|register)|whereis)\b/ { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* ++ * Function definitions. ++ */ ++ /^([a-z][a-zA-Z0-9_]*|'[^\n]*')/ { ++ function_name_face (true); ++ language_print ($1); ++ function_name_face (false); ++ language_print ($2); ++ } ++ ++ /* Atom like strings */ ++ /('[^\n]*')/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Characters */ ++ /(\$.)/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Variable Names */ ++ /* /([\{\(\,\[ \t]+)([A-Z_][a-zA-Z0-9_]*)/ { */ ++ /([^a-z0-9_\"])([A-Z_][a-zA-Z0-9_]*)/ { ++ language_print ($1); ++ variable_name_face (true); ++ language_print ($2); ++ variable_name_face (false); ++ } ++} ++ ++/* ++Local variables: ++mode: erlang ++End: ++*/ +diff -Nru enscript-1.6.4.orig/states/hl/forth.st enscript-1.6.4/states/hl/forth.st +--- enscript-1.6.4.orig/states/hl/forth.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/forth.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,96 @@ ++/** ++ * Name: forth ++ * Description: Forth Programming Language. ++ * Author: Brent Fulgham ++ */ ++ ++forth_builtins = ++/* builtins */ ++ /\b(abort|bye|c(atch|o(ld|ntext))|d(rop|up)|f(d(rop|up)|nip|o(r(get|th)|ver)|rot\ ++|s(eal|wap)|tuck)|include|l(ink|oad)|n(ip|eeds)|o(rder|ver)|pick|ro(ll|t)|swap|t(hrow|uck)\ ++|within|2(drop|nip|dup|over|tuck|swap|rot)|3dup|4dup\ ++)\b/; ++ ++forth_types = ++/* types */ ++ /\b(base|c(ell|har)|decimal|float|hex)\b/; ++ ++forth_keywords = ++/* keywords */ ++ /\b(a(bs|gain|head|lso|nd)|begin|c(ase|onstant)|d(abs|efinitions|m(ax|in)|negate|o(|ne))\ ++|e(lse|nd(|case|if|of)|xit)|f(a(bs|cos(|h)|log|sin(|h)|tan(|2|h))|cos(|h)|exp(|m1)|l(n(|p1)\ ++|o(g|or)|s(in(|cos|h)|qrt)|tan(|h))|m(ax|in)|negate|or|round|sqrt)|h(ere|old)|i(f|nvert)\ ++|l(eave|oop)|m(ax|in|od)|n(e(gate|xt)|ot)|o(f|nly|r)|r(epeat|oot)|s(eal|ign)|then\ ++|un(til|loop)|v(ariable|oc(abulary|s))|while|xor\ ++)\b/; ++ ++state forth extends HighlightEntry ++{ ++ /* Comments. */ ++ /\\\\/ { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ ++ /* keywords. */ ++ forth_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Types. */ ++ forth_types { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* Builtins support */ ++ forth_builtins { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* character constants. */ ++ /'.'|'\\\\.'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* symbols, etc. */ ++ />|>=|<=|<>|!|\+|\-|\^|\/|\*|\|/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* ++ * function definitions, with args ++ * fct_name (args...) is ++ */ ++ /^(:[ \t]+)([^ ^\t]+)([ \t]*)/ { ++ keyword_face (true); ++ language_print ($1); ++ keyword_face (false); ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print ($3); ++ } ++} ++ +diff -Nru enscript-1.6.4.orig/states/hl/icon.st enscript-1.6.4/states/hl/icon.st +--- enscript-1.6.4.orig/states/hl/icon.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/icon.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,93 @@ ++/** ++ * Name: icon ++ * Description: Icon Programming Language. ++ * Author: Brent Fulgham ++ */ ++ ++icon_builtins = ++/* Builtins */ ++ /\b(break|create|default|fail|initial|l(ink|ocal)|not|s(tatic|uspend))\b/; ++ ++icon_types = ++/* Types */ ++ /\b(char|error|function|integer|proc|procedure|real|variable)\b/; ++ ++icon_keywords = ++/* Keywords */ ++ /\b(a(bs|cos|ny|rgs|sin|tan)|b(al|y)|c(a(llout|se)|enter|hdir|lose|o(llect|py|s)|set)\ ++|d(e(lay|lete|tab|isplay|tor)|o)|e(lse|n(d|tab)|rrorclear|very|xit|xp)|f(ind|lush)\ ++|get(|ch|che|env)|i(and|com|f|mage|nsert|or|shift|xor)|k(bhit|ey)|l(eft|ist|o(adfunc|g))\ ++|m(a(ny|p|tch)|ember|ove)|n(ame|ext|umeric)|o(f|pen|rd)|p(op|os|ull|ush|ut)\ ++|r(e(ad(|s)|move|name|p(eat|l)|turn|verse)|ight|tod|unerr)|s(ave|eek|eq|et|in|ort(|f)\ ++|qrt|top|tring|ystem)|t(a(b(|le)|n)|hen|o|rim|ype)|u(ntil|pto)|w(h(ere|ile)|rite(|s))\ ++)\b/; ++ ++state icon extends HighlightEntry ++{ ++ /* Comments. */ ++ /#/ { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ ++ /* Keywords. */ ++ icon_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Types. */ ++ icon_types { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* Structure support */ ++ icon_builtins { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Character constants. */ ++ /'.'|'\\\\.'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Symbols, etc. */ ++ />|>=|:=|<=|#|=+|!|::|\+|\-|\^|\/|\*|\|/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* ++ * Function definitions, with args ++ * fct_name (args...) is ++ */ ++ /([ \t]*procedure[ \t]+)(\w+)([ \t]*)/ { ++ keyword_face (true); ++ language_print ($1); ++ keyword_face (false); ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print ($3); ++ } ++} +diff -Nru enscript-1.6.4.orig/states/hl/lua.st enscript-1.6.4/states/hl/lua.st +--- enscript-1.6.4.orig/states/hl/lua.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/lua.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,91 @@ ++/** ++ * Name: lua ++ * Description: Lua Programming Language template for Enscript. ++ * Author: Brent Fulgham ++ */ ++ ++lua_builtins = ++/* Builtins */ ++ /\b(assert|call|foreach|globals|print|require|to(number|string))\b/; ++ ++lua_keywords = ++/* Keywords */ ++ /\b(and|break|do|e(nd|lse(|if))|f(alse|or|unction)|i(f|n)|local\ ++|or|n(il|ot)|re(peat|turn)|t(hen|rue)|until|while\ ++)\b/; ++ ++state lua extends HighlightEntry ++{ ++ ++ /* One line comments. */ ++ /\-\-|^#!/ { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ ++ /* Keywords. */ ++ lua_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Types. */ ++ lua_builtins { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Character constants. */ ++ /'.'|'\\\\.'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Symbols, etc. */ ++ /+|-|\*|=|!=|==|<|>|<=|>=|~=|!/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* Class references */ ++ /([ \t])*([a-zA-Z]+[, \ta-zA-Z0-9_]*):[^=]/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* ++ * Function definitions, with args ++ * function fct_name (args...) ++ */ ++ /^([ \t]*function[ \t]+)([a-zA-Z_][a-zA-Z_:0-9]*)([ \t]*)(\([^)]*\)[ \t]*)[ \t]*$/ { ++ keyword_face (true); ++ language_print ($1); ++ keyword_face (false); ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print(" "); ++ language_print ($3); ++ keyword_face (true); ++ language_print ($4); ++ keyword_face (false); ++ } ++ ++} +diff -Nru enscript-1.6.4.orig/states/hl/mail.st enscript-1.6.4/states/hl/mail.st +--- enscript-1.6.4.orig/states/hl/mail.st 2003-03-05 09:26:33.000000000 +0200 ++++ enscript-1.6.4/states/hl/mail.st 2006-01-09 22:02:28.000000000 +0200 +@@ -27,7 +27,7 @@ + END { + comment_face (true); + } +- /:/ { ++ /[ \t:]/ { + language_print ($0); + return; + } +diff -Nru enscript-1.6.4.orig/states/hl/Makefile.am enscript-1.6.4/states/hl/Makefile.am +--- enscript-1.6.4.orig/states/hl/Makefile.am 2003-03-05 09:26:33.000000000 +0200 ++++ enscript-1.6.4/states/hl/Makefile.am 2006-01-09 22:06:23.000000000 +0200 +@@ -38,7 +38,8 @@ + matlab.st nroff.st objc.st outline.st pascal.st passthrough.st perl.st \ + postscript.st python.st pyrex.st rfc.st scheme.st sh.st skill.st \ + sql.st states.st synopsys.st tcl.st tcsh.st tex.st vba.st verilog.st \ +-vhdl.st vrml.st wmlscript.st zsh.st ++vhdl.st vrml.st wmlscript.st zsh.st eiffel.st erlang.st dylan.st oz.st \ ++lua.st oberon2.st icon.st smalltalk.st forth.st sml.st php.st ruby.st + + states = $(misc) $(styles) $(languages) $(highlightings) + +diff -Nru enscript-1.6.4.orig/states/hl/Makefile.in enscript-1.6.4/states/hl/Makefile.in +--- enscript-1.6.4.orig/states/hl/Makefile.in 2003-03-05 09:40:07.000000000 +0200 ++++ enscript-1.6.4/states/hl/Makefile.in 2006-01-09 22:05:26.000000000 +0200 +@@ -188,7 +188,8 @@ + matlab.st nroff.st objc.st outline.st pascal.st passthrough.st perl.st \ + postscript.st python.st pyrex.st rfc.st scheme.st sh.st skill.st \ + sql.st states.st synopsys.st tcl.st tcsh.st tex.st vba.st verilog.st \ +-vhdl.st vrml.st wmlscript.st zsh.st ++vhdl.st vrml.st wmlscript.st zsh.st eiffel.st erlang.st dylan.st oz.st \ ++lua.st oberon2.st icon.st smalltalk.st forth.st sml.st php.st ruby.st + + + states = $(misc) $(styles) $(languages) $(highlightings) +diff -Nru enscript-1.6.4.orig/states/hl/oberon2.st enscript-1.6.4/states/hl/oberon2.st +--- enscript-1.6.4.orig/states/hl/oberon2.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/oberon2.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,111 @@ ++/** ++ * Name: oberon2 ++ * Description: Oberon 2 Programming Language. ++ * Author: Brent Fulgham ++ */ ++ ++oberon2_builtins = ++/* Builtins */ ++ /\b(CONST|IMPORT)\b/; ++ ++oberon2_types = ++/* Types */ ++ /\b(ARRAY|B(OOLEAN|YTE)|CHAR|INTEGER|LONG(|INT|REAL)|MODULE|NIL\ ++|P(OINTER|ROCEDURE)|RE(AL|CORD)|SHORT(|INT))\b/; ++ ++oberon2_keywords = ++/* Keywords */ ++ /\b(A(BS|ND|SH)|BEGIN|C(A(P|SE)|HR)|D(O|EC|IV)\ ++|E(LS(E|IF)|N(D|TIER)|X(CL|IT))|F(ALSE|OR)|HALT|I(F|S|N(|C(|L)))\ ++|L(EN|OOP)|M(AX|IN|OD)|NEW|O(F|DD|R(|D))|S(ET|IZE)|T(HEN|O|RUE|YPE)\ ++|UNTIL|RE(PEAT|TURN)|VAR|W(HILE|ITH))\b/; ++ ++state oberon2_comment extends Highlight ++{ ++ /\*\)/ { ++ language_print ($0); ++ return; ++ } ++} ++ ++state oberon2 extends HighlightEntry ++{ ++ /* Comments. */ ++ /\(\*/ { ++ comment_face (true); ++ language_print ($0); ++ call (oberon2_comment); ++ comment_face (false); ++ } ++ ++ /* Keywords. */ ++ oberon2_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Types. */ ++ oberon2_types { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* Structure support */ ++ oberon2_builtins { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Character constants. */ ++ /'.'|'\\\\.'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Symbols, etc. */ ++ /\->|>|>=|:=|<=|#|=|!|::|\+|\-|\^|\/|\*|\|/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* ++ * Function definitions, with args ++ * fct_name (args...) is ++ */ ++ /([ \t]*PROCEDURE[ \t]+)(\w+)([ \t]*)/ { ++ keyword_face (true); ++ language_print ($1); ++ keyword_face (false); ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print ($3); ++ } ++ ++ /([ \t]*END[ \t]+)(\w+)([ \t]*[;\.])/ { ++ keyword_face (true); ++ language_print ($1); ++ keyword_face (false); ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print ($3); ++ } ++} +diff -Nru enscript-1.6.4.orig/states/hl/oz.st enscript-1.6.4/states/hl/oz.st +--- enscript-1.6.4.orig/states/hl/oz.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/oz.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,89 @@ ++/** ++ * Name: oz ++ * Description: Mozart/Oz Programming Language. ++ * Author: Brent Fulgham ++ */ ++ ++oz_builtins = ++/* Builtins */ ++ /\b(export|import|local|require)\b/; ++ ++oz_types = ++/* Types */ ++ /\b(attr|c(lass|atch)|f(eat|unctor)|nil|prop|raise|try)\b/; ++ ++oz_keywords = ++/* Keywords */ ++ /\b(at|c(ase|hoice|ond)|d(e(clare|fine)|o|is)|e(lse(|case|if|of)|nd)\ ++|f(inally|or|rom|un)|i(f|n)|lock|meth|not|o(f|r)|p(repare|roc)|then\ ++|thread)\b/; ++ ++state oz extends HighlightEntry ++{ ++ ++ /* Comments. */ ++ /%/ { ++ comment_face (true); ++ language_print ($0); ++ call (eat_one_line); ++ comment_face (false); ++ } ++ ++ /* Keywords. */ ++ oz_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Types. */ ++ oz_types { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* Structure support */ ++ oz_builtins { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Character constants. */ ++ /'.'|'\\\\.'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Symbols, etc. */ ++ /\.\.|=[=]|<\-|\\=|\|/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* ++ * Function definitions, with args ++ * fct_name (args...) is ++ */ ++ /([ \t]*\{)(\w+)([\. \t]*)/ { ++ language_print ($1); ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print ($3); ++ } ++ ++} +diff -Nru enscript-1.6.4.orig/states/hl/perl.st enscript-1.6.4/states/hl/perl.st +--- enscript-1.6.4.orig/states/hl/perl.st 2003-03-05 09:32:09.000000000 +0200 ++++ enscript-1.6.4/states/hl/perl.st 2006-01-09 22:02:28.000000000 +0200 +@@ -60,6 +60,11 @@ + + state perl extends HighlightEntry + { ++ /* stuff after $# is a variable, not a comment */ ++ /\$#\w+/ { ++ language_print ($0); ++ } ++ + /* Comments. */ + /#.*$/ { + comment_face (true); +@@ -127,7 +132,6 @@ + + /* Variables */ + /[$%@&]+\w+/ { +- keyword_face (false); + language_print ($0); + } + +diff -Nru enscript-1.6.4.orig/states/hl/smalltalk.st enscript-1.6.4/states/hl/smalltalk.st +--- enscript-1.6.4.orig/states/hl/smalltalk.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/smalltalk.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,80 @@ ++/** ++ * Name: Smalltalk ++ * Description: Smalltalk Programming Language. ++ * Author: Brent Fulgham ++ */ ++ ++smalltalk_keywords = ++/* Keywords */ ++ /\b(class|false|inspect|isNil|new|nil|not(|Nil)|out|s(elf|uper)|true\ ++|do|whileTrue|whileFalse|ifTrue|ifFalse|put|to|at|add|new\ ++|for)\b/ ; ++ ++state smalltalk_quot_string extends Highlight ++{ ++ /\\\\./ { ++ language_print ($0); ++ } ++ /[\']/ { ++ language_print ($0); ++ return; ++ } ++} ++ ++state smalltalk extends HighlightEntry ++{ ++ ++ /* Comments. */ ++ /\"/ { ++ comment_face (true); ++ language_print ($0); ++ call (c_string); ++ comment_face (false); ++ } ++ ++ /* Keywords. */ ++ smalltalk_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Declarations */ ++ /[ \t]*\|.*\|/ { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* String constants. */ ++ /[\']/ { ++ string_face (true); ++ language_print ($0); ++ call (smalltalk_quot_string); ++ string_face (false); ++ } ++ ++ /* Symbols, etc. */ ++ /:=|>|>=|==|<=|<>|=|!|::|@|\+|\-|\^|\/|\*|\||\[|\]/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* ++ * Function definitions, with args ++ * fct_name (args...) is ++ */ ++ /([ \t]*)(\w+)(:[ \t]*)/ { ++ keyword_face (true); ++ language_print ($1); ++ keyword_face (false); ++ function_name_face (true); ++ face_on(face_bold); ++ language_print ($2); ++ face_off(face_bold); ++ function_name_face (false); ++ language_print ($3); ++ } ++ ++} +diff -Nru enscript-1.6.4.orig/states/hl/sml.st enscript-1.6.4/states/hl/sml.st +--- enscript-1.6.4.orig/states/hl/sml.st 1970-01-01 02:00:00.000000000 +0200 ++++ enscript-1.6.4/states/hl/sml.st 2006-01-09 22:02:28.000000000 +0200 +@@ -0,0 +1,101 @@ ++/** ++ * Name: sml ++ * Description: Standard ML Programming Language. ++ * Author: Brent Fulgham ++ */ ++ ++sml_builtins = ++/* Builtins */ ++ /\b(functor|lambda|s(ig(|nature)|truct(|ure))|NONE|SOME)\b/; ++ ++sml_types = ++/* Types */ ++ /\b(\'(a|b|c|d)|array|bool|char|int|list|real|string|unit|vector|word)\b/; ++ ++sml_keywords = ++/* Keywords */ ++ /\b(a(bs(traction|type)|nd(|also)|s|toi)|before|c(ase|oncat)|d(o|atatype)\ ++|e(lse|nd|qtype|xception)|f(n|un(|sig))|handle|i(f|n(|clude|fix|fixr))\ ++|l(et|ocal)|nonfix|o(|f|p(|en)|relse|verload)|print|r(aise|ec|ef)|sharing\ ++|t(hen|ype)|val|w(h(ere|ile)|ith(|type)))\b/ ; ++ ++state sml_comment extends Highlight ++{ ++ /\*\)/ { ++ language_print ($0); ++ return; ++ } ++} ++ ++state sml extends HighlightEntry ++{ ++ ++ /* Comments. */ ++ /\(\*/ { ++ comment_face (true); ++ language_print ($0); ++ call (sml_comment); ++ comment_face (false); ++ } ++ ++ /* Keywords. */ ++ sml_keywords { ++ keyword_face (true); ++ language_print ($0); ++ keyword_face (false); ++ } ++ ++ /* Types. */ ++ sml_types { ++ type_face (true); ++ language_print ($0); ++ type_face (false); ++ } ++ ++ /* Structure support */ ++ sml_builtins { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* String constants. */ ++ /\"/ { ++ string_face (true); ++ language_print ($0); ++ call (c_string); ++ string_face (false); ++ } ++ ++ /* Character constants. */ ++ /'.'|'\\\\.'/ { ++ string_face (true); ++ language_print ($0); ++ string_face (false); ++ } ++ ++ /* Symbols, etc. */ ++ /:=|>|>=|==|<=|<>|=|!|::|@|\+|\-|\^|\/|\*|\||\b(quot|rem|div|mod\ ++|hd|tl)\b/ { ++ reference_face (true); ++ language_print ($0); ++ reference_face (false); ++ } ++ ++ /* ++ * Function definitions, with args ++ * fct_name (args...) is ++ */ ++ /([ \t]*f[u]n[ \t]+)(\w+)([ \t]*)/ { ++ keyword_face (true); ++ language_print ($1); ++ keyword_face (false); ++ function_name_face (true); ++ face_on(face_bold_italic); ++ language_print ($2); ++ face_off(face_bold_italic); ++ function_name_face (false); ++ language_print ($3); ++ } ++ ++} +diff -Nru enscript-1.6.4.orig/states/hl/tcl.st enscript-1.6.4/states/hl/tcl.st +--- enscript-1.6.4.orig/states/hl/tcl.st 2003-03-05 09:26:33.000000000 +0200 ++++ enscript-1.6.4/states/hl/tcl.st 2006-01-09 22:02:28.000000000 +0200 +@@ -128,7 +128,7 @@ + |e(ntry|of|rror|v(al|ent)|x(ec|it|pr))\ + |f(blocked|configure|ile(|event|name)|lush|o(cus|nt|r(|each|mat))|rame)\ + |g(ets|lob(|al)|r(ab|id))|history|i(f|mage|n(cr|fo|terp))|join\ +-|l(a(bel|ppend)|i(brary|n(dex|sert)|st(|box))|length|o(ad|se|wer)\ ++|l(a(bel|ppend|st)|i(brary|n(dex|sert)|st(|box))|length|o(ad|se|wer)\ + |r(ange|eplace)|s(earch|ort))\ + |me(nu(|button)|ssage)|op(en|tion(|s))\ + |p(ack(|age)|hoto|id|kg_mkIndex|lace|roc|uts|wd)\ diff --git a/enscript-doublefree.patch b/enscript-doublefree.patch new file mode 100644 index 0000000..ecdb618 --- /dev/null +++ b/enscript-doublefree.patch @@ -0,0 +1,15 @@ +--- enscript-1.6.1/src/main.c.doublefree 2004-09-27 14:21:29.954102199 +0100 ++++ enscript-1.6.1/src/main.c 2004-09-27 14:21:31.390828039 +0100 +@@ -1505,9 +1505,9 @@ + process_file (_("Table of Contents"), &is); + is_close (&is); + } +- +- /* Clean up toc file. */ +- fclose (toc_fp); ++ else ++ /* Clean up toc file. */ ++ fclose (toc_fp); + } + + /* Give trailer a chance to dump itself. */ diff --git a/enscript-wrap_header.patch b/enscript-wrap_header.patch new file mode 100644 index 0000000..3078817 --- /dev/null +++ b/enscript-wrap_header.patch @@ -0,0 +1,121 @@ +--- enscript-1.6.1/lib/simple.hdr.wrap_header 1997-03-03 09:00:08.000000000 +0100 ++++ enscript-1.6.1/lib/simple.hdr 2007-02-12 12:57:02.000000000 +0100 +@@ -1,50 +1,68 @@ +-% +-% Default simple header. +-% Copyright (c) 1995 Markku Rossi. +-% Author: Markku Rossi +-% +- +-% +-% This file is part of GNU enscript. +-% +-% This program is free software; you can redistribute it and/or modify +-% it under the terms of the GNU General Public License as published by +-% the Free Software Foundation; either version 2, or (at your option) +-% any later version. +-% +-% This program is distributed in the hope that it will be useful, +-% but WITHOUT ANY WARRANTY; without even the implied warranty of +-% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-% GNU General Public License for more details. +-% +-% You should have received a copy of the GNU General Public License +-% along with this program; see the file COPYING. If not, write to +-% the Free Software Foundation, 59 Temple Place - Suite 330, +-% Boston, MA 02111-1307, USA. +-% +- +-% -- code follows this line -- +-%Format: fmodstr $D{%a %b %d %H:%M:%S %Y} +-%Format: pagenumstr $V$% +- +-/do_header { % print default simple header +- gsave +- d_header_x d_header_y HFpt_h 3 div add translate +- +- HF setfont +- user_header_p { +- 5 0 moveto user_header_left_str show +- +- d_header_w user_header_center_str stringwidth pop sub 2 div +- 0 moveto user_header_center_str show +- +- d_header_w user_header_right_str stringwidth pop sub 5 sub +- 0 moveto user_header_right_str show +- } { +- 5 0 moveto fname show +- 45 0 rmoveto fmodstr show +- 45 0 rmoveto pagenumstr show +- } ifelse +- +- grestore +-} def ++% ++% Default simple header. ++% Copyright (c) 1995 Markku Rossi. ++% Author: Markku Rossi ++% ++% Modified: Chris Josefy, USA, MAY 2006 ++% + Added line wrapping to header to work more like AIX enscript ++% + This assumes that one does not change the header font size from the default ++% + This also assumes that the line only wraps once ++ ++% ++% This file is part of GNU enscript. ++% ++% This program is free software; you can redistribute it and/or modify ++% it under the terms of the GNU General Public License as published by ++% the Free Software Foundation; either version 2, or (at your option) ++% any later version. ++% ++% This program is distributed in the hope that it will be useful, ++% but WITHOUT ANY WARRANTY; without even the implied warranty of ++% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++% GNU General Public License for more details. ++% ++% You should have received a copy of the GNU General Public License ++% along with this program; see the file COPYING. If not, write to ++% the Free Software Foundation, 59 Temple Place - Suite 330, ++% Boston, MA 02111-1307, USA. ++% ++ ++% -- code follows this line -- ++%Format: fmodstr $D{%a %b %d %H:%M:%S %Y} ++%Format: pagenumstr $V$% ++%HeaderHeight: 44 ++ ++/do_header { % print default simple header ++ gsave ++ d_header_x d_header_y HFpt_h 3 div add translate ++ ++ HF setfont ++ user_header_p { ++ 5 0 moveto user_header_left_str show ++ ++ d_header_w user_header_center_str stringwidth pop sub 2 div ++ 0 moveto user_header_center_str show ++ ++ d_header_w user_header_right_str stringwidth pop sub 5 sub ++ 0 moveto user_header_right_str show ++ } { ++ fname length fmodstr length add pagenumstr length add 95 6 idiv add d_header_w 6 idiv le{ ++ 5 0 moveto fname show ++ 45 0 rmoveto fmodstr show ++ 45 0 rmoveto pagenumstr show ++ } { ++ 5 0 moveto fmodstr show ++ 45 0 rmoveto pagenumstr show ++ fname length d_header_w 6 idiv idiv 1 add 10 mul 5 exch moveto ++ 1 1 fname length d_header_w 6 idiv idiv ++ { ++ dup fname exch 1 sub d_header_w 6 idiv mul d_header_w 6 idiv getinterval show ++ 5 exch 10 mul fname length d_header_w 6 idiv idiv 1 add 10 mul exch sub moveto ++ } for ++ 5 10 moveto ++ fname fname length d_header_w 6 idiv idiv d_header_w 6 idiv mul dup fname length exch sub getinterval show ++ }ifelse ++ }ifelse ++ ++ grestore ++} def diff --git a/enscript.spec b/enscript.spec new file mode 100644 index 0000000..ef17b0e --- /dev/null +++ b/enscript.spec @@ -0,0 +1,107 @@ +Name: enscript +Version: 1.6.6 +Release: 1mamba +Summary: Converts plain ASCII to PostScript. +Group: Applications/Publishing +Vendor: openmamba +Distribution: openmamba +Packager: Silvan Calarco +URL: http://www.codento.com/people/mtr/genscript/ +Source0: http://ftp.gnu.org/gnu/enscript/enscript-%{version}.tar.gz +Source1: http://neugierig.org/software/ruby/ruby-enscript.tar.gz +Source2: http://home.raxnet.net/downloads/viewcvs/enscript.st +License: GPL +Patch1: enscript-1.6.1-CAN-2004-1185.patch +Patch2: enscript-1.6.1-CAN-2004-1186.patch +Patch3: enscript-1.6.1-locale.patch +Patch4: enscript-doublefree.patch +Patch5: enscript-1.6.1-config.patch +Patch6: enscript-1.6.4-hilight.patch +Patch7: enscript-wrap_header.patch +## AUTOBUILDREQ-BEGIN +BuildRequires: glibc-devel +## AUTOBUILDREQ-END +Requires(post): %{__install_info} +BuildRoot: %{_tmppath}/%{name}-%{version}-root +#Option Change with configure's option Current value +#--------------------------------------------------------- +#Media --with-media=MEDIA Letter +#Spooler --with-spooler=SPOOLER lpr +#PS level --with-ps-level=LEVEL 2 + +%description +GNU enscript is a free replacement for Adobe's Enscript program. Enscript converts ASCII files to PostScript(TM) and spools generated PostScript output to the specified printer or saves it to a file. Enscript can be extended to handle different output media and includes many options for customizing printouts. + +%prep +%setup -q +#%patch1 -p1 +#%patch2 -p1 +#%patch3 -p1 +#%patch4 -p1 +#%patch5 -p1 +#%patch6 -p1 +#%patch7 -p1 +tar -C states/hl -zxf %{S:1} ruby.st +install -pm 644 %{S:2} states/hl/php.st + +%build +%configure --with-media=Letter +%make + +%install +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" +%makeinstall +rm -f %{buildroot}%{_datadir}/info/dir + +%find_lang %{name} + +%clean +[ "%{buildroot}" != / ] && rm -rf "%{buildroot}" + +%post +%install_info enscript.info +/sbin/ldconfig +: + +%preun +%uninstall_info enscript.info +/sbin/ldconfig +: + +%files -f %{name}.lang +%defattr(-,root,root) +%config(noreplace) %{_sysconfdir}/enscript.cfg +%{_bindir}/diffpp +%{_bindir}/enscript +%{_bindir}/mkafmmap +%{_bindir}/over +%{_bindir}/sliceprint +%{_bindir}/states +%dir %{_datadir}/enscript +%{_datadir}/enscript/enscript.pro +%{_datadir}/enscript/*.hdr +%{_datadir}/enscript/*.enc +%dir %{_datadir}/enscript/afm +%{_datadir}/enscript/afm/MustRead.html +%{_datadir}/enscript/afm/font.map +%{_datadir}/enscript/afm/*.pfa +%{_datadir}/enscript/afm/*.afm +%dir %{_datadir}/enscript/hl +%{_datadir}/enscript/hl/*.st +%{_infodir}/enscript.info.gz +%{_mandir}/man1/diffpp.1.gz +%{_mandir}/man1/enscript.1.gz +%{_mandir}/man1/sliceprint.1.gz +%{_mandir}/man1/states.1.gz +%doc AUTHORS COPYING +# ChangeLog NEWS README README.DOS README.ESCAPES THANKS TODO + +%changelog +* Thu Oct 11 2012 Automatic Build System 1.6.6-1mamba +- automatic version update by autodist + +* Sat Jul 21 2012 Automatic Build System 1.6.5.2-1mamba +- update to 1.6.5.2 + +* Wed Oct 15 2008 gil 1.6.1-1mamba +- package created by autospec diff --git a/enscript.st b/enscript.st new file mode 100644 index 0000000..ab66f78 --- /dev/null +++ b/enscript.st @@ -0,0 +1,6026 @@ +/* + * States definitions file for GNU Enscript. + * Copyright (c) 1997-1998 Markku Rossi. + * Author: Markku Rossi + * + * The latest version of this file can be downloaded from URL: + * + * http://www.iki.fi/~mtr/genscript/enscript.st + */ + +/* + * This file is part of GNU enscript. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +/* + * $Id: enscript.st,v 1.76 1998/07/01 08:41:23 mtr Exp $ + */ + +/* + * Guildelines for writing new highlighting rules for the GNU Enscript. + * + * - all pretty-printing states should have a document comment like this: + * + * /** + * * Name: c + * * Description: C programming language. + * * Author: Author Name + * * ... + * + * It is used by enscript's --help-pretty-print option to print + * description about supported pretty-printing modes. + * + * - BEGIN and END rules must call header() and trailer() subroutines: + * + * state c + * { + * BEGIN { + * header (); + * } + * END { + * trailer (); + * } + * + * - each state and possible help-states should have LANGUAGE_SPECIALS rule: + * + * LANGUAGE_SPECIALS { + * language_print ($0); + * } + * + * - all printing should be done with the language_print() procedure + * instead of the print() primitive. + * + * These rules ensures that enscript's --help-pretty-print option works + * and that the many2html utility script can convert all the + * --pretty-print supported languages to HTML. + */ + +/* This script needs at least this version of the States program. */ +prereq ("1.5.0"); + +/* + * Constants, fonts, etc. + */ + +debug = "0"; + +/* Boolean values. */ +true = 1; +false = 0; + +font_spec = "Courier@10"; + +/* These components are resolved from . */ +font = ""; +ptsize = ""; + +/* + * Highlight levels. Possible values are: + * - none no highlighting + * - light light highlighting (comments and highlights) + * - heavy give all + */ +hl_level = "heavy"; + +/* + * Colormodel. Possible values are: + * - blackwhite no colors, just black and white + * - emacs similar to emacs' font lock highlighting + */ +colormodel = "blackwhite"; + +/* + * Target language. Possible values are: + * - enscript generate enscript special escapes + * - html generate HTML + * - overstrike generate overstrike (line printers, less) + * - texinfo generate Texinfo + * - rtf generate Rich Text Format (rtf - MS Word, WordPerfect) + * This code can be suched into MS Word or PowerPoint + * for a pretty version of the code + */ +language = "enscript"; + +/* + * How many input files we have. + */ +num_input_files = "1"; +current_input_file = 0; + +/* + * Document title. + */ +document_title = "Enscript Output"; + + +/* + * Color definitions. + */ + +cindex = 0; +rgb_values = list (); + +sub define_color (name, r, g, b) +{ + rgb_values[cindex] = list (name, r, g, b); + cindex = cindex + 1; +} + +sub color_index (name) +{ + local i; + + for (i = 0; i < length (rgb_values); i = i + 1) + if (strcmp (rgb_values[i][0], name) == 0) + return i; + + return -1; +} + +sub language_color (name) +{ + local idx; + + idx = color_index (name); + if (idx < 0) + panic ("unknown color `", name, "'"); + + /* + * The map_color() subroutine is language specific and defined in + * *_faces() subroutine. + */ + map_color (rgb_values[idx][1], rgb_values[idx][2], rgb_values[idx][3]); +} + +/* RGB definitions for colors. These are borrowed from X's rgb.txt file. */ + +define_color ("black", 0, 0, 0); +define_color ("blue", 0, 0, 255); +define_color ("cadet blue", 27, 127, 139); +define_color ("navy blue", 13, 75, 138); +define_color ("dark goldenrod", 184, 134, 11); +define_color ("dark olive green", 85, 107, 47); +define_color ("firebrick", 178, 34, 34); +define_color ("forest green", 26, 121, 26); +define_color ("orchid", 218, 112, 214); +define_color ("purple", 160, 32, 240); +define_color ("rosy brown", 188, 143, 143); + +define_color ("DarkSeaGreen", 139, 179, 129); +define_color ("Goldenrod", 237, 218, 116); +define_color ("Aquamarine", 67, 183, 186); +define_color ("SeaGreen2", 100, 233, 134); +define_color ("Coral", 247, 101, 65); +define_color ("DarkSlateGray1", 154, 254, 255); + + +/* + * General helpers. + */ + +sub debug (msg) +{ + if (debug_level) + print ("DEBUG: ", msg, "\n"); +} + +sub is_prefix (prefix, string) +{ + return strncmp (prefix, string, length (prefix)) == 0; +} + +sub strchr (string, ch) +{ + local len = length (string), i; + + for (i = 0; i < len; i = i + 1) + if (string[i] == ch) + return i; + + return -1; +} + +sub need_version (major, minor, beta) +{ + local r, v, i; + + regmatch (version, (/([0-9]+)\.([0-9]+)\.([0-9]+)/)); + v = list (int ($1), int ($2), int ($3)); + r = list (major, minor, beta); + + for (i = 0; i < 3; i = i + 1) + if (v[i] > r[i]) + return 1; + else if (v[i] < r[i]) + return 0; + + /* Exact match. */ + return 1; +} + +/* Highlight types which match expression from string . */ +sub highlight_types (data, re) +{ + local match_len; + + while (regmatch (data, re)) + { + language_print ($B); + type_face (true); + language_print ($0); + type_face (false); + + match_len = length ($B, $0); + + data = substring (data, match_len, length (data)); + } + + language_print (data); +} + + +/* + * Output face definitions for different target languages. + */ + +sub enscript_faces () +{ + /* RGB -> PostScript color mapper function. */ + sub map_color (r, g, b) + { + return sprintf ("%f %f %f", r div 255.0, g div 255.0, b div 255.0); + } + + /* No language special characters. */ + LANGUAGE_SPECIALS = 0; + + sub language_print (str) + { + print (str); + } + + sub header () + { + /* Nothing here. */ + } + + sub trailer () + { + /* Nothing here. */ + } + + sub font (name) + { + print ("\0font{", name, "@", ptsize, "}"); + } + + sub color (name) + { + print ("\0color{", name, "}"); + } + + sub default () + { + print ("\0font{default}"); + if (color) + print ("\0color{default}"); + } + + sub bold (on) + { + if (on) + { + font (bold_font); + if (color) + color (bold_color); + } + else + default (); + } + + sub italic (on) + { + if (on) + { + font (italic_font); + if (color) + color (italic_color); + } + else + default (); + } + + sub bold_italic (on) + { + if (on) + { + font (bold_italic_font); + if (color) + color (bold_italic_color); + } + else + default (); + } + + sub comment_face (on) + { + if (on) + { + font (comment_face_font); + if (color) + color (comment_face_color); + } + else + default (); + } + + sub function_name_face (on) + { + if (on) + { + font (function_name_face_font); + if (color) + color (function_name_face_color); + } + else + default (); + } + + sub variable_name_face (on) + { + if (on) + { + font (variable_name_face_font); + if (color) + color (variable_name_face_color); + } + else + default (); + } + + sub keyword_face (on) + { + if (on) + { + font (keyword_face_font); + if (color) + color (keyword_face_color); + } + else + default (); + } + + sub reference_face (on) + { + if (on) + { + font (reference_face_font); + if (color) + color (reference_face_color); + } + else + default (); + } + + sub string_face (on) + { + if (on) + { + font (string_face_font); + if (color) + color (string_face_color); + } + else + default (); + } + + sub builtin_face (on) + { + if (on) + { + font (builtin_face_font); + if (color) + color (builtin_face_color); + } + else + default (); + } + + sub type_face (on) + { + if (on) + { + font (type_face_font); + if (color) + color (type_face_color); + } + else + default (); + } +} + + +sub html_faces () +{ + /* RGB -> HTML color mapper function. */ + sub map_color (r, g, b) + { + return sprintf ("#%02X%02X%02X", r, g, b); + } + + LANGUAGE_SPECIALS = /[<>\&\"]/; + + sub language_print (str) + { + str = regsuball (str, /\&/, "&"); + str = regsuball (str, //, ">"); + str = regsuball (str, /\"/, """); + print (str); + } + + sub header () + { + local i; + + if (current_input_file == 1) + { + print ("\n"); + print ("\n\n"); + language_print (document_title); + print ("\n\n", + color + ? "" + : "", + "\n\n"); + + if (need_version (1, 5, 1) && int (toc) == 1) + { + if (length (argv) == 0) + argv[0] = "(stdin)"; + + print ("

Contents

\n
    \n"); + for (i = 0; i < length (argv); i = i + 1) + print ("
  1. ", argv[i], + "\n"); + print ("
\n
\n"); + } + } + + print ("\n

"); + language_print (filename); + + if (int (num_input_files) > 1) + print (" ", current_input_file, "/", num_input_files); + + print ("

\n"); + + /* Navigation bar. */ + if (need_version (1, 5, 1)) + { + if (length (argv) >= 2 ) + { + print ("[
top]"); + + if (current_input_file == 1) + print ("[prev]"); + else + print ("[prev]"); + + if (current_input_file == length (argv)) + print ("[next]"); + else + print ("[next]"); + } + } + else + print ("[top]"); + print ("\n
\n");
+    }
+
+  sub trailer ()
+    {
+      print ("
+
\n"); + if (current_input_file == int (num_input_files)) + print ("
Generated by ", + "", + substring (version, strchr (version, 'G'), length (version)), + ".
+ +\n"); + } + + sub color_on (name) + { + print (""); + } + + sub color_off () + { + print (""); + } + + sub bold (on) + { + if (on) + print (""); + else + print (""); + } + + sub italic (on) + { + if (on) + print (""); + else + print (""); + } + + sub bold_italic (on) + { + if (on) + print (""); + else + print (""); + } + + sub comment_face (on) + { + if (on) + { + print (""); + if (color) + color_on (comment_face_color); + } + else + { + if (color) + color_off (); + print (""); + } + } + + sub function_name_face (on) + { + if (on) + { + print (""); + if (color) + color_on (function_name_face_color); + } + else + { + if (color) + color_off (); + print (""); + } + } + + sub variable_name_face (on) + { + if (on) + { + if (color) + color_on (variable_name_face_color); + else + print (""); + } + else + { + if (color) + color_off (); + else + print (""); + } + } + + sub keyword_face (on) + { + if (on) + { + print (""); + if (color) + color_on (keyword_face_color); + } + else + { + if (color) + color_off (); + print (""); + } + } + + sub reference_face (on) + { + if (on) + { + print (""); + if (color) + color_on (reference_face_color); + } + else + { + if (color) + color_off (); + print (""); + } + } + + sub string_face (on) + { + if (on) + { + if (color) + color_on (string_face_color); + } + else + { + if (color) + color_off (); + } + } + + sub builtin_face (on) + { + if (on) + { + if (color) + color_on (builtin_face_color); + print (""); + } + else + { + if (color) + color_off (); + print (""); + } + } + + sub type_face (on) + { + if (on) + { + if (color) + color_on (type_face_color); + print (""); + } + else + { + if (color) + color_off (); + print (""); + } + } +} + + +sub overstrike_faces () +{ + sub map_color (r, g, b) + { + return ""; + } + + LANGUAGE_SPECIALS = /./; + + sub language_print (str) + { + if (italic_flag) + print (regsuball (str, /[A-Za-z0-9]/, "_\010$0")); + else if (bold_flag) + print (regsuball (str, /./, "$0\010$0")); + else + print (str); + } + + sub header () + { + bold_flag = 0; + italic_flag = 0; + } + + sub trailer () + { + } + + sub bold (on) + { + bold_flag = on; + } + + sub italic (on) + { + italic_flag = on; + } + + sub bold_italic (on) + { + } + + sub comment_face (on) + { + italic (on); + } + + sub function_name_face (on) + { + bold (on); + } + + sub variable_name_face (on) + { + bold (on); + } + + sub keyword_face (on) + { + bold (on); + } + + sub reference_face (on) + { + bold (on); + } + + sub string_face (on) + { + bold (on); + } + + sub builtin_face (on) + { + bold (on); + } + + sub type_face (on) + { + italic (on); + } +} + + +sub texinfo_faces () +{ + /* Nop since Texinfo doesn't have colors. */ + sub map_color (r, g, b) + { + return ""; + } + + LANGUAGE_SPECIALS = /[{}@]/; + + sub language_print (str) + { + str = regsuball (str, /@/, "@@"); + str = regsuball (str, /{/, "@{"); + str = regsuball (str, /}/, "@}"); + print (str); + } + + sub header () + { + print ("@example\n"); + } + + sub trailer () + { + print ("@end example\n"); + } + + sub bold (on) + { + if (on) + print ("@strong{"); + else + print ("}"); + } + + sub italic (on) + { + if (on) + print ("@emph{"); + else + print ("}"); + } + + sub bold_italic (on) + { + } + + sub comment_face (on) + { + italic (on); + } + + sub function_name_face (on) + { + bold (on); + } + + sub variable_name_face (on) + { + bold (on); + } + + sub keyword_face (on) + { + bold (on); + } + + sub reference_face (on) + { + bold (on); + } + + sub string_face (on) + { + } + + sub builtin_face (on) + { + bold (on); + } + + sub type_face (on) + { + if (on) + print ("@emph{"); + else + print ("}"); + } +} + +/* + * Definition for RTF output + * Kevin Grover, + */ + +sub rtf_color_map() +{ + local i; + + print ("{\\colortbl;"); + for (i = 0; i < length (rgb_values); i = i + 1) + print (sprintf ("\\red%d\\green%d\\blue%d;", + rgb_values[i][1], + rgb_values[i][2], + rgb_values[i][3])); + + print ("}\n"); + + return; +} + +sub rtf_faces () +{ + sub language_color (name) + { + local idx; + + idx = color_index (name); + if (idx < 0) + panic ("unknown color `", name, "'"); + + return sprintf("\\cf%d",idx); + } + + LANGUAGE_SPECIALS = /[\\{}\n]/; + + sub language_print (str) + { + str = regsuball (str, /\\\\/, "\\\\"); + str = regsuball (str, /{/, "\\{"); + str = regsuball (str, /}/, "\\}"); + str = regsuball (str, /\n/, "\\line\n"); + print (str); + } + + sub header () + { + local i; + + if (current_input_file == 1) + { + print ("{\\rtf\\ansi\\deff0\n"); + print ("{\\fonttbl{\\f0\\fswiss Courier New;}}\n"); + rtf_color_map(); + } + } + + sub trailer () + { + if (current_input_file == int (num_input_files)) + print ("}\n"); + } + + sub color_on (name) + { + print ("{", name, " "); + } + + sub color_off () + { + print ("}"); + } + + sub bold (on) + { + if (on) + print ("{\\b "); + else + print ("}"); + } + + sub italic (on) + { + if (on) + print ("{\\i "); + else + print ("}"); + } + + sub bold_italic (on) + { + if (on) + print ("{\\b\\i "); + else + print ("}"); + } + + sub comment_face (on) + { + if (on) + { + print ("{\\i "); + if (color) + color_on (comment_face_color); + } + else + { + if (color) + color_off (); + print ("}"); + } + } + + sub function_name_face (on) + { + if (on) + { + print ("{\\b "); + if (color) + color_on (function_name_face_color); + } + else + { + if (color) + color_off (); + print ("}"); + } + } + + sub variable_name_face (on) + { + if (on) + { + if (color) + color_on (variable_name_face_color); + else + print ("{\\b "); + } + else + { + if (color) + color_off (); + else + print ("}"); + } + } + + sub keyword_face (on) + { + if (on) + { + print ("{\\b "); + if (color) + color_on (keyword_face_color); + } + else + { + if (color) + color_off (); + print ("}"); + } + } + + sub reference_face (on) + { + if (on) + { + print ("{\\b "); + if (color) + color_on (reference_face_color); + } + else + { + if (color) + color_off (); + print ("}"); + } + } + + sub string_face (on) + { + if (on) + { + if (color) + color_on (string_face_color); + print ("{\\b "); + } + else + { + if (color) + color_off (); + print ("}"); + } + } + + sub builtin_face (on) + { + if (on) + { + if (color) + color_on (builtin_face_color); + print ("{\\b "); + } + else + { + if (color) + color_off (); + print ("}"); + } + } + + sub type_face (on) + { + if (on) + { + if (color) + color_on (type_face_color); + print ("{\\i "); + } + else + { + if (color) + color_off (); + print ("}"); + } + } +} /* End RTF */ + + +sub define_faces () +{ + if (strcmp (language, "enscript") == 0) + enscript_faces (); + else if (strcmp (language, "html") == 0) + html_faces (); + else if (strcmp (language, "overstrike") == 0) + overstrike_faces (); + else if (strcmp (language, "texinfo") == 0) + texinfo_faces (); + else if (strcmp (language, "rtf") == 0) + rtf_faces (); + else + panic ("unknown output language `", language, "'"); +} + + +/* + * Initializations. + */ + +start +{ + /* Set debug level. */ + debug_level = int (debug); + + /* Increment input file count. */ + current_input_file = current_input_file + 1; + + /* Resolve fonts. */ + idx = strchr (font_spec, '@'); + if (idx < 0) + panic ("malformed font spec: `", font_spec, "'"); + + font = substring (font_spec, 0, idx); + ptsize = substring (font_spec, idx + 1, length (font_spec)); + + debug (concat ("start: ", font, "@", ptsize)); + + /* Construct bold, italic, etc. fonts for our current body font. */ + if (is_prefix ("AvantGarde", font)) + { + bold_font = "AvantGarde-Demi"; + italic_font = "AvantGarde-BookOblique"; + bold_italic_font = "AvantGarde-DemiOblique"; + } + else if (regmatch (font, /^Bookman|Souvenir/)) + { + bold_font = concat ($0, "-Demi"); + italic_font = concat ($0, "-LightItalic"); + bold_italic_font = concat ($0, "-DemiItalic"); + } + else if (regmatch (font, /^(.*)-Roman$/)) + { + bold_font = concat ($1, "-Bold"); + italic_font = concat ($1, "-Italic"); + bold_italic_font = concat ($1, "-BoldItalic"); + } + else if (regmatch (font, /^LucidaSans-/)) + { + bold_font = concat (font, "Bold"); + italic_font = concat (font, "Oblique"); + bold_italic_font = concat (font, "BoldOblique"); + } + else + { + bold_font = concat (font, "-Bold"); + italic_font = concat (font, "-Oblique"); + bold_italic_font = concat (font, "-BoldOblique"); + } + + /* Define output faces. */ + define_faces (); + + /* Select colormodel. */ + if (strcmp (colormodel, "blackwhite") == 0) + { + color = 0; + } + else if (strcmp (colormodel, "emacs") == 0) + { + color = 1; + bold_color = language_color ("black"); + italic_color = language_color ("black"); + bold_italic_color = language_color ("black"); + comment_face_color = language_color ("forest green"); + function_name_face_color = language_color ("firebrick"); + variable_name_face_color = language_color ("dark goldenrod"); + keyword_face_color = language_color ("blue"); + reference_face_color = language_color ("navy blue"); + string_face_color = language_color ("cadet blue"); + builtin_face_color = language_color ("orchid"); + type_face_color = language_color ("forest green"); + } + else if (strcmp (colormodel, "ifh") == 0) + { + color = 1; + bold_color = language_color ("black"); + italic_color = language_color ("black"); + bold_italic_color = language_color ("black"); + comment_face_color = language_color ("DarkSeaGreen"); + function_name_face_color = language_color ("Coral"); + variable_name_face_color = language_color ("dark goldenrod"); + keyword_face_color = language_color ("SeaGreen2"); + reference_face_color = language_color ("forest green"); + string_face_color = language_color ("Goldenrod"); + reference_face_color = language_color ("Aquamarine"); + builtin_face_color = language_color ("purple"); + type_face_color = language_color ("DarkSlateGray1"); + } + else + panic ("unknown color model `", colormodel, "'"); + + /* Select highlight level. */ + if (strcmp (hl_level, "none") == 0) + { + comment_face_font = font; + function_name_face_font = font; + variable_name_face_font = font; + keyword_face_font = font; + reference_face_font = font; + string_face_font = font; + builtin_face_font = font; + type_face_font = font; + } + else if (strcmp (hl_level, "light") == 0) + { + comment_face_font = italic_font; + function_name_face_font = bold_font; + + if (color) + variable_name_face_font = font; + else + variable_name_face_font = bold_font; + + keyword_face_font = bold_font; + reference_face_font = bold_font; + string_face_font = font; + builtin_face_font = font; + type_face_font = font; + } + else if (strcmp (hl_level, "heavy") == 0) + { + comment_face_font = italic_font; + function_name_face_font = bold_font; + + if (color) + variable_name_face_font = font; + else + variable_name_face_font = bold_font; + + keyword_face_font = bold_font; + reference_face_font = bold_font; + string_face_font = font; + builtin_face_font = bold_font; + type_face_font = bold_font; + } + else + panic ("unknown highlight level `", hl_level, "'"); + + /* Resolve start state. */ + if (check_startrules ()) + debug ("startstate from startrules"); + if (check_namerules ()) + debug ("startstate from namerules"); +} + +namerules +{ + /\.(c|h)$/ c; + /\.(c++|C|H|cpp|cc|cxx)$/ cpp; + /\.m$/ objc; + /\.(scm|scheme)$/ scheme; + /\b\.emacs$|\.el$/ elisp; + /\.ad(s|b|a)$/ ada; + /\.[Ss]$/ asm; + /\.st$/ states; + /(M|m)akefile.*/ makefile; + /\.tcl$/ tcl; + /\.(v|vh)$/ verilog; + /\.html?$/ html; + /\bChangeLog$/ changelog; + /\.(vhd|vhdl)$/ vhdl; + /\.(scr|.syn|.synth)$/ synopsys; + /\.idl$/ idl; + /\.(hs|lhs|gs|lgs)$/ haskell; + /\.(pm|pl)$/ perl; + /\.(php|php3)$/ php; + /\.(eps|EPS|ps|PS)$/ postscript; + /\.py$/ python; + /\.js$/ javascript; + /\.java$/ java; + /\.([Pp][Aa][Ss]|[Pp][Pp]|[Pp])$/ pascal; + /\.[fF]$/ fortran; + /\.awk$/ awk; + /\.sh$/ sh; + /\.vba$/ vba; + /^.*$/ passthrough; +} + +startrules +{ + /.\010.\010.\010./ nroff; + /-\*- [Cc] -\*-/ c; + /-\*- [Cc]\+\+ -\*-/ cpp; + /-\*- [Aa][Dd][Aa] -\*-/ ada; + /-\*- [Aa][Ss][Mm] -\*-/ asm; + /-\*- [Oo][Bb][Jj][Cc] -\*-/ objc; + /-\*- [Ss][Cc][Hh][Ee][Mm][Ee] -\*-/ scheme; + /-\*- [Ee][Mm][Aa][Cc][Ss] [Ll][Ii][Ss][Pp] -\*-/ elisp; + /-\*- [Tt][Cc][Ll] -\*-/ tcl; + /-\*- [Vv][Hh][Dd][Ll] -\*-/ vhdl; + /-\*- [Hh][Aa][Ss][Kk][Ee][Ll][Ll] -\*-/ haskell; + /-\*- [Ii][Dd][Ll] -\*-/ idl; + /-\*- [Pp][Ee][Rr][Ll] -\*-/ perl; + /^#![ \t]*\/.*\/perl/ perl; + /^<\?php/ php; + /^\04?%!/ postscript; + /^From:/ mail; + /^#![ \t]*(\/usr)?\/bin\/[ngmt]?awk/ awk; + /^#![ \t]*(\/usr)?\/bin\/sh/ sh; +} + + +/* + * Helper subroutines and states. + */ + +state match_balanced_block +{ + match_balanced_block_start { + language_print ($0); + match_balanced_block_count = match_balanced_block_count + 1; + } + + match_balanced_block_end { + match_balanced_block_count = match_balanced_block_count - 1; + if (match_balanced_block_count == 0) + return $0; + + language_print ($0); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +sub match_balanced_block (starter, ender) +{ + match_balanced_block_count = 1; + match_balanced_block_start = starter; + match_balanced_block_end = ender; + return call (match_balanced_block); +} + +state eat_one_line +{ + /.*\n/ { + language_print ($0); + return; + } +} + +/* + * Pass all input through handling only output language specific headers + * and LANGUAGE_SPECIALS. + */ +state passthrough +{ + BEGIN { + header (); + } + END { + trailer (); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/* + * Describe all known highlight languages. + */ + +state describe_me +{ + / \*$/ { + } + + / \*\\\/.*/ { + /* All done. */ + return; + } + + / \* ?(.*)/ { + print ($1); + } +} + +state describe_languages +{ + BEGIN { + print ("Highlighting is supported for the following languages and file formats:\n"); + } + END { + print ("\n"); + } + /^\/\*\*.*$/ { + 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, /\"/, """); + 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))); + } +} + +state describe_languages_html +{ + BEGIN { + title = "Enscript Highlighting Languages And File Formats"; + print ("\n\n", title, "\n\n\n

    ", + title, "

    \n
    \n
      \n"); + } + END { + print ("\n
    \n
    By ", version, + "
    \n\n\n"); + } + /^\/\*\*.*$/ { + call (describe_me_html); + } + /[^\\\/]+/ { + /* NOP */ + } + /./ { + /* NOP */ + } +} + + + +/* + * Language specific states + */ + +/** + * Name: ada + * Description: Ada95 programming language. + * Author: Rolf Ebert + */ + +state ada +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /--/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + + /* Character constants. */ + /'.'|'\\\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + + /* Keywords. + (build-re '(abort abs abstract accept access aliased + all and array at begin body case constant declare + delay delta digits do else elsif end entry + exception exit for function generic goto if in + is limited loop mod new not null of or others + out package pragma private procedure protected raise + range record rem renames requeue return reverse + select separate subtype tagged task terminate then type + until use when while with xor)) + */ + /\b(a(b(ort|s(|tract))|cce(pt|ss)|l(iased|l)|nd|rray|t)|b(egin|ody)\ +|c(ase|onstant)|d(e(clare|l(ay|ta))|igits|o)\ +|e(ls(e|if)|n(d|try)|x(ception|it))|f(or|unction)|g(eneric|oto)\ +|i(f|n|s)|l(imited|oop)|mod|n(ew|ot|ull)|o(f|r|thers|ut)\ +|p(ackage|r(agma|ivate|o(cedure|tected)))\ +|r(a(ise|nge)|e(cord|m|names|queue|turn|verse))\ +|s(e(lect|parate)|ubtype)|t(a(gged|sk)|erminate|hen|ype)|u(ntil|se)\ +|w(h(en|ile)|ith)|xor)\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: asm + * Description: Assembler listings. + * Author: Markku Rossi + */ + +state asm +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /;/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* Labels are averything at the beginning of the line, ending to ':' */ + /^[^\t ]+:/ { + function_name_face (true); + language_print ($0); + function_name_face (true); + } + + /* Asm operands are indented. */ + /^([ \t]+)([^ \t]+)/ { + language_print ($1); + + keyword_face (true); + language_print ($2); + keyword_face (false); + } + + /* And finally, highlight string constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } +} + + +/** + * Name: awk + * Description: AWK programming language. + * Author: Juergen Kahrs + */ + +state awk +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /#/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Excutable script. */ + /^#!/ { + reference_face (true); + language_print ($0); + call (eat_one_line); + reference_face (false); + } + + /* Keywords. */ + /\b(ARG(C|V|IND)|BEGIN|CONVFMT|E(N(D|VIRON)|RRNO)\ +|F(I(ELDWIDTHS|LENAME)|NR|S)|IGNORECASE|N[FR]|O(FMT|FS|RS)\ +|R(LENGTH|S(TART)?|T)|SUBSEP\ +|atan2|break|c(lose|o(ntinue|s))|d(elete|o)|e(lse|x(it|p))\ +|f(flush|or|unction)|g(((en)?sub)|etline)|i(f|n(dex|t)?)\ +|l(ength|og)|match|next(file)?|return|while|print[f]?\ +|rand|s(in|ub(str)?|ystem|p(lit|rintf)|qrt|rand|trftime|ystime)\ +|to(lower|upper))\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: c + * Description: C programming language. + * Author: Markku Rossi + */ + +c_keyword_re = +/* Keywords, but not types, goto, and case. + (build-re '(break continue default do else for if return sizeof + switch while)) + */ + /\b(break|continue|d(efault|o)|else|for|if|return|s(izeof|witch)|while)\b/; + +c_type_re = +/* Types. + (build-re '(auto char const double enum extern float int long + register short signed static struct typedef union unsigned void + volatile)) + */ + /\b(auto|c(har|onst)|double|e(num|xtern)|float|int|long|register\ +|s(hort|igned|t(atic|ruct))|typedef|un(ion|signed)|vo(id|latile))\b/; + +state c_comment +{ + /\*\\\// { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state c_string +{ + /\\\\./ { + language_print ($0); + } + /\"/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state c_ppline +{ + /* Comments within a pre-processor line. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /* Include line. */ + /(include)([ \t]+)/ { + reference_face (true); + language_print ($1); + reference_face (false); + language_print ($2); + call (c_ppline_include); + return; + } + /* Define line. */ + /(define)([ \t]+)/ { + reference_face (true); + language_print ($1); + reference_face (false); + language_print ($2); + call (c_ppline_define); + return; + } + /* Simple directives: + (build-re '(undef if ifdef ifndef endif elif else line error pragma)) + */ + /\b(e(l(if|se)|ndif|rror)|if(|def|ndef)|line|pragma|undef)\b/ { + reference_face (true); + language_print ($0); + reference_face (false); + call (c_ppline_tokensequence); + return; + } + /* An unknown pre-processor directive. */ + /[a-zA-Z_][^ \t\n]*/ { + reference_face (true); + language_print ($0); + reference_face (false); + call (c_ppline_tokensequence); + return; + } + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state c_ppline_include +{ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + call (c_ppline_comments_strings_chars); + return; + } + /<[^<>]+>/ { + string_face (true); + language_print ($0); + string_face (false); + call (c_ppline_comments_strings_chars); + return; + } + /[a-zA-Z_][a-zA-Z_0-9]*/ { + variable_name_face (true); + print ($0); + variable_name_face (false); + call (c_ppline_comments_strings_chars); + return; + } + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state c_ppline_define +{ + /([a-zA-Z_][a-zA-Z_0-9]*)(\([^\)]*\))?/ { + if (strcmp ($2, "") != 0) + { + function_name_face (true); + language_print ($1); + function_name_face (false); + language_print ($2); + } + else + { + variable_name_face (true); + language_print ($1); + variable_name_face (false); + } + call (c_ppline_comments_strings_chars); + return; + } + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state c_ppline_comments_strings_chars +{ + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + /* Character constants. */ + /'.'|'\\\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state c_ppline_tokensequence +{ + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + /* Character constants. */ + /'.'|'\\\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + /* defined() operators. */ + /(defined)(\()([^\)]+)(\))/ { + reference_face (true); + language_print ($1); + reference_face (false); + language_print ($2); + + variable_name_face (true); + language_print ($3); + variable_name_face (false); + + language_print ($4); + } + /* Variable references. */ + /\b[a-zA-Z_][a-zA-Z_0-9]*\b/ { + variable_name_face (true); + language_print ($0); + variable_name_face (false); + } + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state c +{ + BEGIN { + if (need_version (1, 5, 1)) + c_function_name_re + = /^([A-Za-z][a-zA-Z0-9_\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/; + else + c_function_name_re = 0; + + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Pre-processor lines. */ + /^#/ { + language_print ($0); + call (c_ppline); + } + + /* Character constants. */ + /'.'|'\\\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + + /* Keywords. */ + c_keyword_re { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* Types. */ + c_type_re { + type_face (true); + language_print ($0); + type_face (false); + } + + /* Labels and case tags. Emacs accepts also bare numbers. */ + /([a-zA-Z0-9_]+)(:)/ { + if (strcmp ($1, "default") == 0) + { + /* `default' is a keyword. */ + keyword_face (true); + language_print ($1); + keyword_face (false); + } + else + { + reference_face (true); + language_print ($1); + reference_face (false); + } + + language_print ($2); + } + + /* Goto, case and the target. */ + /\<(goto|case)\>([ \t]+)(-?[A-Za-z_][A-Za-z_0-9]*)?/ { + keyword_face (true); + language_print ($1); + keyword_face (false); + + language_print ($2); + + if (length ($3) > 0) + { + reference_face (true); + language_print ($3); + reference_face (false); + } + } + + /* + * Function definitions, but only if you code with the one and only + * usable indentation style (GNU). + */ + /^([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/ { + function_name_face (true); + language_print ($1); + function_name_face (false); + + language_print ($2); + } + + /* Function definitions and prototypes for other (loser) coding styles. */ + c_function_name_re { + garbage = $1; + middle_garbage = $2; + function_name = $3; + tail_garbage = $4; + + highlight_types (garbage, c_type_re); + + language_print (middle_garbage); + + function_name_face (true); + language_print (function_name); + function_name_face (false); + + language_print (tail_garbage); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: changelog + * Description: ChangeLog files. + * Author: Markku Rossi + */ + +state changelog +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Date entries. Both new and old formats. */ + /^([^ \t]........[0-9: ]*)([^<]+)(<)([A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+)(>)/ { + string_face (true); + language_print ($1); + string_face (false); + + reference_face (true); + language_print ($2); + reference_face (false); + + language_print ($3); + + variable_name_face (true); + language_print ($4); + variable_name_face (false); + + language_print ($5); + } + + /* File descriptions with function names. */ + /(^\t\* )([^\(]+)(\()([^\)]+)(\):)/ { + language_print ($1); + + function_name_face (true); + language_print ($2); + function_name_face (false); + + language_print ($3); + + keyword_face (true); + language_print ($4); + keyword_face (false); + + language_print ($5); + } + + /* File descriptions without function names. */ + /(^\t\* )([^ :]+)(:)/ { + language_print ($1); + + function_name_face (true); + language_print ($2); + function_name_face (false); + + language_print ($3); + } + + /* Function name descriptions without file names. */ + /(^\t\()([^\)]+)(\):)/ { + language_print ($1); + + keyword_face (true); + language_print ($2); + keyword_face (false); + + language_print ($3); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: cpp + * Description: C++ programming language. + * Author: Markku Rossi + */ + +cpp_keyword_re = +/* Keywords, but not types, goto, and case. + (build-re '(asm break catch continue default delete do else for if + new operator overload return sizeof switch this throw try while)) + */ + /\b(asm|break|c(atch|ontinue)|d(e(fault|lete)|o)|else|for|if|new\ +|o(perator|verload)|return|s(izeof|witch)|t(h(is|row)|ry)|while)\b/; + +cpp_type_re = +/* Types. + (build-re '(auto bool char class complex const double enum extern + float friend inline int long private protected public register + short signed static struct template typedef union unsigned virtual + void volatile)) + */ + /\b(auto|bool|c(har|lass|o(mplex|nst))|double|e(num|xtern)|f(loat|riend)\ +|in(line|t)|long|p(r(ivate|otected)|ublic)|register\ +|s(hort|igned|t(atic|ruct))|t(emplate|ypedef)|un(ion|signed)\ +|v(irtual|o(id|latile)))\b/; + +state cpp +{ + BEGIN { + if (need_version (1, 5, 1)) + cpp_function_name_re + = /^([A-Za-z][a-zA-Z0-9_\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/; + else + cpp_function_name_re = 0; + + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Pre-processor lines. */ + /^#/ { + language_print ($0); + call (c_ppline); + } + + /* Character constants. */ + /'.'|'\\\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + + /* Keywords. */ + cpp_keyword_re { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* Types. */ + cpp_type_re { + type_face (true); + language_print ($0); + type_face (false); + } + + /* Remove false labels. */ + /[a-zA-Z0-9_]+::/ { + language_print ($0); + } + + /* Labels and case tags. Emacs accepts also bare numbers. */ + /([a-zA-Z0-9_]+)(:)/ { + if (strcmp ($1, "default") == 0) + { + /* `default' is a keyword. */ + keyword_face (true); + language_print ($1); + keyword_face (false); + } + else if (strcmp ($1, "public") == 0 + || strcmp ($1, "private") == 0 + || strcmp ($1, "protected") == 0) + { + /* These use the `type' face. */ + type_face (true); + language_print ($1); + type_face (false); + } + else + { + reference_face (true); + language_print ($1); + reference_face (false); + } + + language_print ($2); + } + + /* Goto and its target. */ + /\<(goto|case)\>([ \t]+)(-?[A-Za-z_][A-Za-z_0-9]*)?/ { + keyword_face (true); + language_print ($1); + keyword_face (false); + + language_print ($2); + + if (length ($3) > 0) + { + reference_face (true); + language_print ($3); + reference_face (false); + } + } + + /* + * Function definitions, but only if you code with the one and only + * usable indentation style (GNU). + */ + /^([a-zA-Z_][a-zA-Z_0-9:~]*)([ \t]*\()/ { + function_name_face (true); + language_print ($1); + function_name_face (false); + + language_print ($2); + } + + /* Function definitions and prototypes for other (loser) coding styles. */ + cpp_function_name_re { + garbage = $1; + middle_garbage = $2; + function_name = $3; + tail_garbage = $4; + + highlight_types (garbage, cpp_type_re); + + language_print (middle_garbage); + + function_name_face (true); + language_print (function_name); + function_name_face (false); + + language_print (tail_garbage); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: diff + * Description: normal diffs + * Author: buchal@ifh.bau-verm.uni-karlsruhe.de + */ + +state diff +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /^[0-9]/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /^/ { + reference_face (true); + language_print ($0); + call (eat_one_line); + reference_face (false); + } + /^[^\ ]/ { + string_face (true); + language_print ($0); + call (eat_one_line); + string_face (false); + } +} + + +/** + * Name: diffu + * Description: unified diffs + * Author: buchal@ifh.bau-verm.uni-karlsruhe.de + */ + +state diffu +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /^\@\@/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /^-/ { + function_name_face (true); + language_print ($0); + call (eat_one_line); + function_name_face (false); + } + + /^+/ { + reference_face (true); + language_print ($0); + call (eat_one_line); + reference_face (false); + } + /^[^\ ]/ { + string_face (true); + language_print ($0); + call (eat_one_line); + string_face (false); + } +} + + +/** + * Name: delphi + * Description: Delphi programming language. + * Author: Michael Van Canneyt + */ + +state delphi +{ + BEGIN { + header (); + } + END { + trailer (); + } + /* comments */ + /(\{|\(\*)/ { + comment_face (true); + language_print ($0); + call (pascal_comment); + comment_face (false); + } + /* C++ -style comments */ + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + /* strings */ + /[\']/ { + string_face (true); + language_print ($0); + call (pascal_string); + string_face (false); + } + /* Keywords. + (build-re '(and asm array begin case const constructor destructor + div do downto else end file for function goto if implementation + in inline interface label mod nil not object of or packed + procedure program record repeat set shlr string then to type + unit until uses var while with xor As class except exports + finalization finally inherited initialization is library property + raise threAdvar try absolute abstract assembler automated cdecl + default dispid dynamic export external far forward index message + name near nodefault override pascal private protected public + published read register resident stdcall stored virtual write) + t) + */ + /\b(A[sS]\ +|[aA]([bB][sS]([oO][lL][uU][tT][eE]|[tT][rR][aA][cC][tT])|[nN][dD]\ +|[rR][rR][aA][yY]|[sS]([mM]|[sS][eE][mM][bB][lL][eE][rR])\ +|[uU][tT][oO][mM][aA][tT][eE][dD])\ +|[bB][eE][gG][iI][nN]\ +|[cC]([aA][sS][eE]|[dD][eE][cC][lL]|[lL][aA][sS][sS]\ +|[oO][nN][sS][tT](|[rR][uU][cC][tT][oO][rR]))\ +|[dD]([eE]([fF][aA][uU][lL][tT]|[sS][tT][rR][uU][cC][tT][oO][rR])\ +|[iI]([sS][pP][iI][dD]|[vV])|[oO](|[wW][nN][tT][oO])\ +|[yY][nN][aA][mM][iI][cC])\ +|[eE]([lL][sS][eE]|[nN][dD]\ +|[xX]([cC][eE][pP][tT]|[pP][oO][rR][tT](|[sS])|[tT][eE][rR][nN][aA][lL]))\ +|[fF]([aA][rR]\ +|[iI]([lL][eE]|[nN][aA][lL]([iI][zZ][aA][tT][iI][oO][nN]|[lL][yY]))\ +|[oO][rR](|[wW][aA][rR][dD])|[uU][nN][cC][tT][iI][oO][nN])\ +|[gG][oO][tT][oO]\ +|[iI]([fF]|[mM][pP][lL][eE][mM][eE][nN][tT][aA][tT][iI][oO][nN]\ +|[nN](|[dD][eE][xX]|[hH][eE][rR][iI][tT][eE][dD]\ +|[iI][tT][iI][aA][lL][iI][zZ][aA][tT][iI][oO][nN]|[lL][iI][nN][eE]\ +|[tT][eE][rR][fF][aA][cC][eE])\ +|[sS])\ +|[lL]([aA][bB][eE][lL]|[iI][bB][rR][aA][rR][yY])\ +|[mM]([eE][sS][sS][aA][gG][eE]|[oO][dD])\ +|[nN]([aA][mM][eE]|[eE][aA][rR]|[iI][lL]\ +|[oO]([dD][eE][fF][aA][uU][lL][tT]|[tT]))\ +|[oO]([bB][jJ][eE][cC][tT]|[fF]|[rR]|[vV][eE][rR][rR][iI][dD][eE])\ +|[pP]([aA]([cC][kK][eE][dD]|[sS][cC][aA][lL])\ +|[rR]([iI][vV][aA][tT][eE]\ +|[oO]([cC][eE][dD][uU][rR][eE]|[gG][rR][aA][mM]|[pP][eE][rR][tT][yY]\ +|[tT][eE][cC][tT][eE][dD]))\ +|[uU][bB][lL][iI]([cC]|[sS][hH][eE][dD]))\ +|[rR]([aA][iI][sS][eE]\ +|[eE]([aA][dD]|[cC][oO][rR][dD]|[gG][iI][sS][tT][eE][rR]|[pP][eE][aA][tT]\ +|[sS][iI][dD][eE][nN][tT]))\ +|[sS]([eE][tT]|[hH][lL][rR]\ +|[tT]([dD][cC][aA][lL][lL]|[oO][rR][eE][dD]|[rR][iI][nN][gG]))\ +|[tT]([hH]([eE][nN]|[rR][eE]A[dD][vV][aA][rR])|[oO]|[rR][yY]|[yY][pP][eE])\ +|[uU]([nN]([iI][tT]|[tT][iI][lL])|[sS][eE][sS])\ +|[vV]([aA][rR]|[iI][rR][tT][uU][aA][lL])\ +|[wW]([hH][iI][lL][eE]|[iI][tT][hH]|[rR][iI][tT][eE])|[xX][oO][rR])\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } +} + + +/** + * Name: elisp + * Description: Emacs LISP. + */ + +state elisp +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /;/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Definitions. */ + /(\([ \t]*)(defun)([ \t]+\(?)([!\$%&\*\/:<=>\?~_^a-zA-Z][!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ { + /* Starting garbage. */ + language_print ($1); + + /* Keyword `defun'. */ + keyword_face (true); + language_print ($2); + keyword_face (false); + + /* Middle garbage. */ + language_print ($3); + + /* Function name. */ + function_name_face (true); + language_print ($4); + function_name_face (false); + } + + /* ':'-names, Emacs highlights these, so do we. */ + /([ \t])(:[!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ { + language_print ($1); + reference_face (true); + language_print ($2); + reference_face (false); + } + + /* Keywords taken out of fond-lock.el. Added: and, or, lambda. + (build-re '(and or lambda cond if while let let* prog progn + progv prog1 prog2 prog* inline catch throw save-restriction + save-excursion save-window-excursion save-selected-window + save-match-data unwind-protect condition-case track-mouse + eval-after-load eval-and-compile eval-when-compile when + unless do flet labels return return-from with-output-to-temp-buffer + with-timeout)) + */ + /\b(and|c(atch|ond(|ition-case))|do\ +|eval-(a(fter-load|nd-compile)|when-compile)|flet|i(f|nline)\ +|l(a(bels|mbda)|et(|*))|or|prog(|*|1|2|n|v)|return(|-from)\ +|save-(excursion|match-data|restriction|selected-window|window-excursion)\ +|t(hrow|rack-mouse)|un(less|wind-protect)\ +|w(h(en|ile)|ith-(output-to-temp-buffer|timeout)))\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: fortran + * Description: Fortran77 programming language. + * Author: Keith Refson + * Markku Rossi + */ + +state fortran_string +{ + /[\']/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state fortran_io +{ + /\)/ { + language_print ($0); + return; + } + + /* IO Keywords. (build-re '(FMT UNIT REC END ERR FILE STATUS + ACCESS FORM RECL BLANK IOSTAT EXIST OPENED NUMBER NAME + SEQUENTIAL DIRECT FORMATTED UNFORMATTED NEXTREC)) */ + /\BbACCESS|BLANK|DIRECT|E(ND|RR|XIST)|F(ILE|MT|ORM(|ATTED))|IOSTAT\ +|N(AME|EXTREC|UMBER)|OPENED|REC(|L)|S(EQUENTIAL|TATUS)\ +|UN(FORMATTED|IT))\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* IO Keywords. (build-re '(fmt unit rec end err file status + access form recl blank iostat exist opened number name + sequential direct formatted unformatted nextrec)) */ + /\b(access|blank|direct|e(nd|rr|xist)|f(ile|mt|orm(|atted))|iostat\ +|n(ame|extrec|umber)|opened|rec(|l)|s(equential|tatus)\ +|un(formatted|it))\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state fortran +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /^[cC!\*]/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /[\']/ { + string_face (true); + language_print ($0); + call (fortran_string); + string_face (false); + } + + /* Comparators. We have to roll by hand because of the + dots - "\b" doesn't delimit here. */ + /\.(and|eqv?|g(e|t)|l(e|t)|ne(qv)?|not|or)\./ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* Comparators. We have to roll by hand because of the + dots - "\b" doesn't delimit here. */ + /\.(AND|EQV?|G(E|T)|L(E|T)|NE(QV)?|NOT|OR)\./ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* IO Statement (build-re '(open close read + write inquire backspace endfile rewind )) */ + /\b(backspace|close|endfile|inquire|open|re(ad|wind)|write)\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + call (fortran_io); + } + + /* IO Statement (build-re '(OPEN CLOSE READ + WRITE INQUIRE BACKSPACE ENDFILE REWIND )) */ + /\b(BACKSPACE|CLOSE|ENDFILE|INQUIRE|OPEN|RE(AD|WIND)|WRITE)\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + call (fortran_io); + } + + /* Keywords. (build-re '( block\ *data call + character\\*\[0-9\]+ common complex\\*\[0-9\]+ continue + data dimension do double\ *precision else elseif end enddo + endfile endif entry equivalence external format function + go\ *to if implicit include integer\\*\[0-9\]+ intrinsic + logical\\*\[0-9\]+ parameter pause print program + real\\*\[0-9\]+ return save stop subroutine then while )) */ + /\b(block *data|c(all|haracter\*[0-9]+|o(m(mon|plex\*[0-9]+)|ntinue))\ +|d(ata|imension|o(|uble *precision))\ +|e(lse(|if)|n(d(|do|file|if)|try)|quivalence|xternal)|f(ormat|unction)\ +|go *to|i(f|mplicit|n(clude|t(eger\*[0-9]+|rinsic)))|logical\*[0-9]+\ +|p(a(rameter|use)|r(int|ogram))|re(al\*[0-9]+|turn)\ +|s(ave|top|ubroutine)|then|while)\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + } + /* Keywords. (build-re '( block\ *data call + character\\*\[0-9\]+ COMMON COMPLEX\\*\[0-9\]+ CONTINUE + DATA DIMENSION DO DOUBLE\ *PRECISION ELSE ELSEIF END ENDDO + ENDFILE ENDIF ENTRY EQUIVALENCE EXTERNAL FORMAT FUNCTION + GO\ *TO IF IMPLICIT INCLUDE INTEGER\\*\[0-9\]+ INTRINSIC + LOGICAL\\*\[0-9\]+ PARAMETER PAUSE PRINT PROGRAM + REAL\\*\[0-9\]+ RETURN SAVE STOP SUBROUTINE THEN WHILE )) */ + /\b(BLOCK *DATA|C(ALL|HARACTER\*[0-9]+|O(M(MON|PLEX\*[0-9]+)|NTINUE))\ +|D(ATA|IMENSION|O(|UBLE *PRECISION))\ +|E(LSE(|IF)|N(D(|DO|FILE|IF)|TRY)|QUIVALENCE|XTERNAL)|F(ORMAT|UNCTION)\ +|GO *TO|I(F|MPLICIT|N(CLUDE|T(EGER\*[0-9]+|RINSIC)))|LOGICAL\*[0-9]+\ +|P(A(RAMETER|USE)|R(INT|OGRAM))|RE(AL\*[0-9]+|TURN)\ +|S(AVE|TOP|UBROUTINE)|THEN|WHILE)\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: haskell + * Description: Haskell programming language. + * + * Simple highlighting treating keywords, comments, strings and type + * expressions specially. + * + * Author: Hans-Wolfgang Loidl + * Date: 27/2/97 + */ + +state haskell +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\{\-/ { + comment_face (true); + language_print ($0); + call (haskell_comment); + comment_face (false); + } + + /* One line comments. */ + /\-\-/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* Built-in beasts (GHC specific). */ + /\b\_/ { + keyword_face (true); + language_print ($0); + call (haskell_builtin); + keyword_face (false); + } + + /* Type declarations. */ + /::/ { + type_face (true); + language_print ($0); + call (eat_one_line); + /* call (haskell_type); */ + type_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (haskell_string); + string_face (false); + } + + /* Pre-processor lines. */ + /^#/ { + reference_face (true); + language_print ($0); + call (eat_one_line); + /* call (haskell_ppline); */ + reference_face (false); + } + + /* Character constants. */ + /'.'|'\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + + /* Keywords. + I took that from haskell.el. The True Way to do it would be to grab it + out of the on-line haskell report (actually, The Real True Way would + be to write a Haskell program that extracts different kinds of + keywords and to partially evaluate it wrt the Haskell report; but that + might be a wee overkill). + (let ((strings + '("case" "class" "data" "default" "deriving" "else" "hiding" "if" "import" "in" "\ + infix" "infixl" "infixr" "instance" "interface" "let" "module" "of" "renaming" "\ + then" "to" "type" "where" ))) + (make-regexp strings) + ) + ==> + \(infix\|then\)\|c\(ase\|lass\)\|d\(ata\|e\(fault\|riving\)\)\|else\|hiding\|i\([fn]\|mport\|n\(fix[lr]\|stance\|terface\)\)\|let\|module\|of\|renaming\|t\(o\|ype\)\|where + */ + /\b((infix|then)|c(ase|lass)|d(ata|e(fault|riving))|else|hiding|i([fn]|mport|n(fix[lr]|stance|terface))|let|module|of|renaming|t(o|ype)|where)\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state haskell_comment +{ + /\-\}/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +/* +state haskell_one_line_comment +{ + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} +*/ + +/* HWL: for GHC builtin objects like _parGlobal_ i.e. not std Haskell */ +state haskell_builtin +{ + /(\_\b)| / { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state haskell_type +{ + /* ToDo: Implement type continuation lines: + If the line ends in a -> or the next starts with a -> then we + are still in a type expression + */ + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state haskell_string +{ + /\\\\./ { + language_print ($0); + } + /\"/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state haskell_ppline +{ + /\/\*/ { + /* Comment within a pre-processor line. */ + reference_face (false); + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + reference_face (true); + } + /\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: html + * Description: Hypertext markup language HTML. + * Author: Markku Rossi + */ + +state html_tag +{ + />/ { + language_print ($0); + return; + } + /\"/ { + keyword_face (false); + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + keyword_face (true); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state html_entity +{ + /;/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state html_script_tag { + /\"/ { + keyword_face (false); + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + keyword_face (true); + } + /([lL][aA][nN][gG][uU][aA][gG][eE]=\")([^\"]*)(\")/ { + html_script_language = $2; + + language_print ($1); + keyword_face (false); + + string_face (true); + language_print ($2); + string_face (false); + + keyword_face (true); + language_print ($3); + } + />/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state html_skip_script +{ + /* Terminator for nested scripts. */ + /<\/[sS][cC][rR][iI][pP][tT]>/ { + from_html_terminator = $0; + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state html +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Scripts. */ + /<[sS][cC][rR][iI][pP][tT]/ { + keyword_face (true); + language_print ($0); + + /* The default script language is JavaScript. */ + html_script_language = "JavaScript"; + call (html_script_tag); + keyword_face (false); + + if (strcmp (html_script_language, "JavaScript") == 0) { + /* A nested JavaScript block. */ + from_html = 1; + from_html_terminator = ""; + call (javascript); + keyword_face (true); + language_print (from_html_terminator); + keyword_face (false); + } else { + /* An unknown scripting language, skip it. */ + from_html_terminator = ""; + call (html_skip_script); + keyword_face (true); + language_print (from_html_terminator); + keyword_face (false); + } + } + + / + */ + +state java +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Character constants. */ + /'.'|'\\\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + + /* Keywords. + (build-re '(abstract boolean break byte case catch char class + const continue default do double else extends false final finally + float for goto if implements import instanceof int interface long + native new null package private protected public return short static + super switch synchronized this throw throws transient true try void + volatile while)) + */ + /\b(abstract|b(oolean|reak|yte)|c(a(se|tch)|har|lass|on(st|tinue))\ +|d(efault|o(|uble))|e(lse|xtends)|f(alse|inal(|ly)|loat|or)|goto\ +|i(f|mp(lements|ort)|n(stanceof|t(|erface)))|long|n(ative|ew|ull)\ +|p(ackage|r(ivate|otected)|ublic)|return\ +|s(hort|tatic|uper|witch|ynchronized)|t(h(is|row(|s))|r(ansient|ue|y))\ +|vo(id|latile)|while)\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: javascript + * Description: JavaScript language. + * Author: Markku Rossi + */ + +from_html = 0; + +state javascript_string +{ + /\\\\./ { + language_print ($0); + } + /[\']/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state javascript +{ + BEGIN { + if (!from_html) + header (); + } + END { + if (!from_html) + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* '' strings. */ + /[\']/ { + string_face (true); + language_print ($0); + call (javascript_string); + string_face (false); + } + + /* Function definitions. */ + /\b(function)([ \t]+)([A-Za-z\$_][A-Za-z\$_0-9]*)([ \t]*\()/ { + keyword_face (true); + language_print ($1); + keyword_face (false); + + language_print ($2); + + function_name_face (true); + language_print ($3); + function_name_face (false); + + language_print ($4); + } + + /* Keywords. + (build-re '( + abstract boolean break byte case catch char class const continue + default do double else extends false final finally float for function + goto if implements import in instanceof int interface long native new + null package private protected public return short static super switch + synchronized this throw throws transient true try var void while with + )) + */ + /\b(abstract|b(oolean|reak|yte)|c(a(se|tch)|har|lass|on(st|tinue))\ +|d(efault|o(|uble))|e(lse|xtends)|f(alse|inal(|ly)|loat|or|unction)\ +|goto|i(f|mp(lements|ort)|n(|stanceof|t(|erface)))|long\ +|n(ative|ew|ull)|p(ackage|r(ivate|otected)|ublic)|return\ +|s(hort|tatic|uper|witch|ynchronized)|t(h(is|row(|s))|r(ansient|ue|y))\ +|v(ar|oid)|w(hile|ith))\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* Built-in objects. + (build-re '(Math Date eval parseInt parseFloat)) + */ + /\b(Date|Math|eval|parse(Float|Int))\b/ { + builtin_face (true); + language_print ($0); + builtin_face (false); + } + + /* Terminator for nested JavaScript programs. */ + /<\/[sS][cC][rR][iI][pP][tT]>/ { + from_html_terminator = $0; + return; + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: mail + * Description: Mail and news articles. + * Author: Markku Rossi + */ + +state mail_body +{ + BEGIN { + reference_face (false); + } + /^[ \t]+>/ { + reference_face (true); + language_print ($0); + call (eat_one_line); + reference_face (false); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state mail +{ + BEGIN { + header (); + reference_face (true); + } + END { + trailer (); + } + + /^[ \t]*$/ { + /* Move to the mail body. */ + call (mail_body); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: makefile + * Description: Make program's definition files. + * Author: Markku Rossi + */ + +state sh_eat_to_apostrophe +{ + /\'/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state sh_eat_to_grave +{ + /`/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state makefile +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /#/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + /* An escaped double quote, this doesn't start a string constant. */ + /\\\"/ { + language_print ($0); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Shell apostrophe quote. */ + /\'/ { + string_face (true); + language_print ($0); + call (sh_eat_to_apostrophe); + string_face (false); + } + + /* Shell grave quote. */ + /`/ { + string_face (true); + language_print ($0); + call (sh_eat_to_grave); + string_face (false); + } + + /* Variable references. */ + + /\$\(/ { + language_print ($0); + reference_face (true); + str = match_balanced_block (/\(/, /\)/); + reference_face (false); + language_print (str); + } + + /\${/ { + language_print ($0); + reference_face (true); + str = match_balanced_block (/{/, /}/); + reference_face (false); + language_print (str); + } + + /* Targets. */ + /^[^ \t\r\n]+:/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: nroff + * Description: Manual pages formatted with the nroff program. + * Author: Markku Rossi + */ + +state nroff_italic +{ + BEGIN { + } + /_\010(.)/ { + language_print ($1); + } + /([^_])\010.\010.\010./ { + bold (true); + language_print ($1); + call (nroff_bold); + bold (false); + italic (true); + } + /.|\n/ { + italic (false); + language_print ($0); + return; + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state nroff_bold +{ + /([^_])\010.\010.\010./ { + language_print ($1); + } + /_\010(.)/ { + italic (true); + language_print ($1); + call (nroff_italic); + italic (false); + bold (true); + } + /.|\n/ { + bold (false); + language_print ($0); + return; + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state nroff +{ + BEGIN { + header (); + } + + END { + trailer (); + } + + /_\010(.)/ { + italic (true); + language_print ($1); + call (nroff_italic); + } + /([^_])\010.\010.\010./ { + bold (true); + language_print ($1); + call (nroff_bold); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: objc + * Description: Objective-C programming language. + * Author: Markku Rossi with help of Emacs' `font-lock.el'. + */ + +objc_keyword_re = +/* Keywords. Basicly C + some extras, *but* not goto and case. + (build-re '(break continue default do else for if return sizeof + switch while self super _cmd id Class SEL IMP BOOL YES NO nil Nil)) + */ + /\b(BOOL|Class|IMP|N(O|il)|SEL|YES|_cmd|break|continue|d(efault|o)|else\ +|for|i(d|f)|nil|return|s(elf|izeof|uper|witch)|while)\b/; + +objc_type_re = +/* Types. + (build-re '(auto extern register static typedef struct union enum + signed unsigned short long int char float double void volatile + const id oneway in out inout bycopy byref)) + */ + /\b(auto|by(copy|ref)|c(har|onst)|double|e(num|xtern)|float\ +|i(d|n(|out|t))|long|o(neway|ut)|register|s(hort|igned|t(atic|ruct))\ +|typedef|un(ion|signed)|vo(id|latile))\b/; + + +state objc_method_line +{ + /* Argument declarations after the method. + $1 $2 $3 $4 $5 $6 $7 */ + /([ \t]*)([A-Za-z_][A-Za-z_0-9]*)?(:[ \t]*)(\(([^)\n]+)\))?([ \t]*)([A-Za-z_][A-Za-z_0-9]*)/ { + language_print ($1); + + if (length ($2) > 0) + { + function_name_face (true); + language_print ($2); + function_name_face (false); + } + + language_print ($3); + + if (length ($4) > 0) + { + language_print ("("); + type_face (true); + language_print ($5); + type_face (false); + language_print (")"); + } + + language_print ($6); + + variable_name_face (true); + language_print ($7); + variable_name_face (false); + } + + /\n/ { + language_print ($0); + return; + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state objc_method_continuation_line +{ + /* Method names and arguments on lines following the function declaration. + $1 $2 $3 $4 $5 $6 $7 */ + /^([ \t]*)([A-Za-z_][A-Za-z_0-9]*)?(:[ \t]*)(\(([^)\n]+)\))?([ \t]*)\ +([A-Za-z_][A-Za-z_0-9]*)/ { + language_print ($1); + + if (length ($2) > 0) + { + function_name_face (true); + language_print ($2); + function_name_face (false); + } + + language_print ($3); + + if (length ($4) > 0) + { + language_print ("("); + type_face (true); + language_print ($5); + type_face (false); + language_print (")"); + } + + language_print ($6); + + variable_name_face (true); + language_print ($7); + variable_name_face (false); + + /* Highlight all remaining arguments on this line. */ + call (objc_method_line); + } + + /* + * If the previous one didn't match, we'r done with this method + * declaration. + */ + /()/ { + return; + } +} + +state objc_compiler_directive_line +{ + /([ \t:<(,]*)([A-Za-z_][A-Za-z_0-9]*)/ { + language_print ($1); + + function_name_face (true); + language_print ($2); + function_name_face (false); + } + + /* + * If the previous one didn't match, we'r done with this directive. + * Yes, that should match an empty string. + */ + /()/ { + return; + } +} + +state objc +{ + BEGIN { + if (need_version (1, 5, 1)) + objc_function_name_re + = /^([A-Za-z][a-zA-Z0-9_\* ]+)([ \*])([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/; + else + objc_function_name_re = 0; + + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Pre-processor lines. */ + /^#/ { + language_print ($0); + call (c_ppline); + } + + /* Compiler directives. */ + /(@)([A-Za-z][A-Za-z0-9]*)\>/ { + /* Leading garbage. */ + language_print ($1); + + /* The directive. */ + keyword_face (true); + language_print ($2); + keyword_face (false); + + /* And all the remaining stuff on this line. */ + call (objc_compiler_directive_line); + } + + /* Character constants. */ + /'.'|'\\\\.'/ { + string_face (true); + language_print ($0); + string_face (false); + } + + /* Keywords. */ + objc_keyword_re { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* Types. */ + objc_type_re { + type_face (true); + language_print ($0); + type_face (false); + } + + /* Method names. First, on the same line as the function declaration. + $1 $2 $3 $4 $5 $6 $7 */ + /(^[+-][ \t]*)(PRIVATE)?([ \t]*)(\(([^)\n]+)\))?([ \t]*)([A-Za-z_]\ +[A-Za-z_0-9]*)/ { + language_print ($1); + + if (length ($2) > 0) + { + type_face (true); + language_print ($2); + type_face (false); + } + + language_print ($3); + + if (length ($4) > 0) + { + language_print ("("); + type_face (true); + language_print ($5); + type_face (false); + language_print (")"); + } + + language_print ($6); + + function_name_face (true); + language_print ($7); + function_name_face (false); + + /* Highlight arguments from the same line. */ + call (objc_method_line); + + /* + * Method names and arguments on lines following the function declaration. + */ + call (objc_method_continuation_line); + } + + /* + * Labels and case tags. These must remain as a sole statement on a line, + * otherwise we detect selectors. Emacs accepts also bare numbers. + */ + /^([ \t]*)([a-zA-Z0-9_]+)(:[ \t]*)$/ { + language_print ($1); + if (strcmp ($2, "default") == 0) + { + /* `default' is a keyword. */ + keyword_face (true); + language_print ($2); + keyword_face (false); + } + else + { + reference_face (true); + language_print ($2); + reference_face (false); + } + + language_print ($3); + } + + /* Goto, case and the target. */ + /\<(goto|case)\>([ \t]+)(-?[A-Za-z_][A-Za-z_0-9]*)?/ { + keyword_face (true); + language_print ($1); + keyword_face (false); + + language_print ($2); + + if (length ($3) > 0) + { + reference_face (true); + language_print ($3); + reference_face (false); + } + } + + /* + * Function definitions, but only if you code with the one and only + * usable indentation style (GNU). + */ + /^([a-zA-Z_][a-zA-Z_0-9]*)([ \t]*\()/ { + function_name_face (true); + language_print ($1); + function_name_face (false); + + language_print ($2); + } + + /* Function definitions and prototypes for other (loser) coding styles. */ + objc_function_name_re { + garbage = $1; + middle_garbage = $2; + function_name = $3; + tail_garbage = $4; + + highlight_types (garbage, objc_type_re); + + language_print (middle_garbage); + + function_name_face (true); + language_print (function_name); + function_name_face (false); + + language_print (tail_garbage); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: pascal + * Description: Pascal programming language + * Author: Michael Van Canneyt + */ + +state pascal_comment +{ + /(\}|\*\))/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state pascal_string +{ + /[\']/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state pascal +{ + BEGIN { + header (); + } + END { + trailer (); + } + /* comments */ + /(\{|\(\*)/ { + comment_face (true); + language_print ($0); + call (pascal_comment); + comment_face (false); + } + /* strings */ + /[\']/ { + string_face (true); + language_print ($0); + call (pascal_string); + string_face (false); + } + /* Keywords. + (build-re '(and asm array begin case const constructor destructor div + do downto else end file for function goto if implementation in inline + interface label mod nil not object of or packed procedure program record + repeat set shlr string then to type unit until uses var while with xor) + t) + */ + /\b([aA]([nN][dD]|[rR][rR][aA][yY]|[sS][mM])|[bB][eE][gG][iI][nN]\ +|[cC]([aA][sS][eE]|[oO][nN][sS][tT](|[rR][uU][cC][tT][oO][rR]))\ +|[dD]([eE][sS][tT][rR][uU][cC][tT][oO][rR]|[iI][vV]|[oO](|[wW][nN][tT][oO]))\ +|[eE]([lL][sS][eE]|[nN][dD])\ +|[fF]([iI][lL][eE]|[oO][rR]|[uU][nN][cC][tT][iI][oO][nN])\ +|[gG][oO][tT][oO]\ +|[iI]([fF]|[mM][pP][lL][eE][mM][eE][nN][tT][aA][tT][iI][oO][nN]\ +|[nN](|[lL][iI][nN][eE]|[tT][eE][rR][fF][aA][cC][eE]))\ +|[lL][aA][bB][eE][lL]|[mM][oO][dD]|[nN]([iI][lL]|[oO][tT])\ +|[oO]([bB][jJ][eE][cC][tT]|[fF]|[rR])\ +|[pP]([aA][cC][kK][eE][dD]\ +|[rR][oO]([cC][eE][dD][uU][rR][eE]|[gG][rR][aA][mM]))\ +|[rR][eE]([cC][oO][rR][dD]|[pP][eE][aA][tT])\ +|[sS]([eE][tT]|[hH][lL][rR]|[tT][rR][iI][nN][gG])\ +|[tT]([hH][eE][nN]|[oO]|[yY][pP][eE])\ +|[uU]([nN]([iI][tT]|[tT][iI][lL])|[sS][eE][sS])|[vV][aA][rR]\ +|[wW]([hH][iI][lL][eE]|[iI][tT][hH])|[xX][oO][rR])\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } +} + + +/** + * Name: perl + * Description: Perl programming language. + * + * Author: Jim Villani, Logistics Management Institute (jvillani@lmi.org) + */ + +state perl_comment +{ + /\*\\\// { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state perl_dquot_string +{ + /\\\\./ { + language_print ($0); + } + /\"/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state perl_quot_string +{ + /\\\\./ { + language_print ($0); + } + /[\']/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state perl_bquot_string +{ + /\\\\./ { + language_print ($0); + } + /`/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state perl +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /#.*$/ { + comment_face (true); + language_print ($0); + comment_face (false); + } + + /* Ignore escaped quote marks */ + /\\\"/ { + language_print ($0); + } + /\\\'/ { + language_print ($0); + } + /\\\`/ { + language_print ($0); + } + + /* stuff after a -> is a method, + * don't bold just because it looks like a keyword + */ + /->\w+/ { + language_print ($0); + } + + /* stuff between a - and a => is a named parameter, + * don't bold just because it looks like a keyword + */ + /-\w+=>/ { + language_print ($0); + } + + /* In cgi files, JavaScript might be imbedded, so we need to look out + * for the JavaScript comments, because they might contain something + * we don't like, like a contraction (don't, won't, etc.) + * We won't put them in comment face, because they are not perl + * comments. + */ + /\/\// { + language_print ($0); + call (eat_one_line); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (perl_dquot_string); + string_face (false); + } + /[\']/ { + string_face (true); + language_print ($0); + call (perl_quot_string); + string_face (false); + } + + /* Backquoted command string */ + /`/ { + string_face (true); + language_print ($0); + call (perl_bquot_string); + string_face (false); + } + + /* Variables */ + /[$%@&]+\w+/ { + keyword_face (false); + language_print ($0); + } + + /* Keywords. From perl distribution's toke.c + abs accept alarm and atan2 bind binmode bless caller chdir chmod + chomp chop chown chr chroot close closedir cmp connect continue cos + crypt dbmclose dbmopen defined delete die do dump each else elsif + endgrent endhostent endnetent endprotoent endpwent endservent eof + eq eval exec exists exit exp fcntl fileno flock for foreach fork + format formline ge getc getgrent getgrgid getgrnam gethostbyaddr + gethostbyname gethostent getlogin getnetbyaddr getnetbyname + getnetent getpeername getpgrp getppid getpriority getprotobyname + getprotobynumber getprotoent getpwent getpwnam getpwuid getservbyname + getservbyport getservent getsockname getsockopt glob gmtime goto + grep gt hex if index int ioctl join keys kill last lc lcfirst le + length link listen local localtime log lstat lt m map mkdir msgctl + msgget msgrcv msgsnd my ne new next no not oct open opendir or ord + pack package pipe pop pos print printf prototype push q qq quotemeta + qw qx rand read readdir readline readlink readpipe recv redo ref + rename require reset return reverse rewinddir rindex rmdir s scalar + seek seekdir select semctl semget semop send setgrent sethostent + setnetent setpgrp setpriority setprotoent setpwent setservent + setsockopt shift shmctl shmget shmread shmwrite shutdown sin sleep + socket socketpair sort splice split sprintf sqrt srand stat study + sub substr symlink syscall sysopen sysread sysseek system syswrite + tell telldir tie tied time times tr truncate uc ucfirst umask undef + unless unlink unpack unshift untie until use utime values vec wait + waitpid wantarray warn while write x xor y + */ + /\b(a(bs|ccept|larm|nd|tan2)|b(in(d|mode)|less)|c(aller|h(dir|mod\ +|o(mp|p|wn)|r(|oot))|lose(|dir)|mp|o(n(nect|tinue)|s)|rypt)\ +|d(bm(close|open)|e(fined|lete)|ie|o|ump)|e(ach|ls(e|if)|nd(gr|host|net|proto\ +|pw|serv)ent|of|q|val|x(ec|i(sts|t)|p))|f(cntl|ileno|lock|or(|each|k\ +|m(at|line)))|g(e(|t(c|gr(ent|gid|nam)|host(by(addr|name)|ent)|login\ +|net(by(addr|name)|ent)|p(eername|grp|pid|riority|roto(by(addr|name|number)\ +|ent)|w(ent|nam|uid))|s(erv(by(name|port)|ent)|ock(name|opt))))|lob|mtime\ +|oto|rep|t)|hex|i(f|n(t|dex)|octl)|join|k(eys|ill)|l(ast|c(|first)|e(|ngth)\ +|i(nk|sten)|o(cal(|time)|g)|stat|t)|m|m(ap|kdir|sg(ctl|get|rcv|snd)|y)\ +|n(e(|w|xt)|o(|t))|o(ct|pen(|dir)|r(|d))|p(ack(|age)|ipe|o(p|s)|r(int(|f)\ +|ototype)|ush)|q(|q|uotemeta|w|x)|r(and|e(a(d(|dir|lin(e|k)|pipe))|cv\ +|do|f|name|quire|set|turn|verse|winddir)|index|mdir)|s(|calar|e(e(k|kdir)\ +|lect|m(ctl|get|op)|nd|t((gr|host|net)ent|p(grp|r(iority|otoent)|went)\ +|s(ervent|ockopt)))|h(ift|m(ctl|get|read|write)|utdown)|in|leep|o(cke(t|tpair)\ +|rt)|p(li(ce|t)|rintf)|qrt|rand|t(at|udy)|u(b|bstr)|y(mlink|s(call|open|read\ +|s(eek|tem)|write)))|t(ell(|dir)|i(e|ed|m(e|es))|r(|uncate))|u(c(|first)\ +|mask|n(def|l(ess|ink)|pack|shift|ti(e|l))|se|time)|v(alues|ec)|w(a(i(t(|pid))\ +|ntarray|rn)|hile|rite)|x(|or)|y)\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +/** + * Name: php + * Description: PHP programming language. + * + * Author: Daniel Frederiksen, cyberdoc@cyberdoc.dk + * Extenden functions definition including all PHP functions. + * + * Based on the initial file by + * Ian Berry, iberry@raxnet.net. + * http://home.raxnet.net/article_viewcvs_php.php + + */ + +state php_comment +{ + /\*\\\// { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state php_dquot_string +{ + /\\\\./ { + language_print ($0); + } + /\"/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state php_quot_string +{ + /\\\\./ { + language_print ($0); + } + /[\']/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state php_bquot_string +{ + /\\\\./ { + language_print ($0); + } + /`/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state php +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (php_comment); + comment_face (false); + } + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* Ignore escaped quote marks */ + /\\\"/ { + language_print ($0); + } + /\\\'/ { + language_print ($0); + } + /\\\`/ { + language_print ($0); + } + + /* stuff after a -> is a method, + * don't bold just because it looks like a keyword + */ + /->\w+/ { + language_print ($0); + } + + /* stuff between a - and a => is a named parameter, + * don't bold just because it looks like a keyword + */ + /-\w+=>/ { + language_print ($0); + } + + /* Ignore embedded comments */ + /\/\// { + language_print ($0); + call (eat_one_line); + } + + /* Control flow */ + /(<\?|\?>)/ { + reference_face (true); + language_print ($0); + reference_face (false); + } + + /* Code control (){} */ + /[\{\}\(\)\[\]]/ { + reference_face (true); + language_print ($0); + reference_face (false); + } + + /* Numerics & Logics */ + /[\\-+*\/%!`]/ { + function_name_face (true); + language_print ($0); + function_name_face (false); + } + + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (php_dquot_string); + string_face (false); + } + + /[\']/ { + string_face (true); + language_print ($0); + call (php_quot_string); + string_face (false); + } + + /* Backquoted command string */ + /`/ { + string_face (true); + language_print ($0); + call (php_bquot_string); + string_face (false); + } + + /* Variables */ + /(\$+[a-zA-Z0-9_-]*)/ { + variable_name_face (true); + language_print ($1); + variable_name_face (false); + } + + /* Functions (All PHP function 2004-09-19) */ + /\b(a(cosh?|ddc?slashes|ggregat(e(_(methods(_by_(list|regexp))?|properties(_by_(list|regexp))?|info))?|ion_info)|pache_(get(_(modules|version)|env)|re(quest|sponse)_headers|(child_termina|no)te|lookup_uri|setenv)|r(ray(_(c(h(ange_key_case|unk)|o(mbine|unt_values))|diff(_(u(assoc|key)|assoc|key))?|f(il(l|ter)|lip)|intersect(_(u(assoc|key)|assoc|key))?|key(_exist)?s|m(erge(_recursive)?|ap|ultisort)|p(ad|op|ush)|r(e(duc|vers)e|and)|s(earch|hift|p?lice|um)|u(diff(_u?assoc)?|intersect(_u?assoc)?|n(ique|shift))|walk(_recursive)?|values)|iterator_((curren|nex)t|key|(rewin|vali)d|seek)|object_(co(nstruc|un)t|offset(exists|(g|(un)?s)et)|append|getiterator))?|sort)|s(inh?|pell_(check(_raw)?|new|suggest)|sert(_options)?|cii2ebcdic|ort)|tan[2h]?|bs)|b(ase(64_(de|en)code|_convert|name)|c(m(od|ul)|pow(mod)?|s(cale|qrt|ub)|add|comp|div)|in(d(_textdomain_codeset|ec|textdomain)|2hex)|z(c(lose|ompress)|err(no|(o|st)r)|decompress|flush|open|read|write))|c(a(ching(iterator_((has)?next|(rewin|vali)d|tostring)|recursiveiterator_(get|has)children)|l(_(days_in_month|(from|to)_jd|info)|l_user_(func(_array)?|method(_array)?)))|cvs_(a(dd|uth)|co(mmand|unt)|d(elet|on)e|re(port|turn|verse)|s(ale|tatus)|init|lookup|new|textvalue|void)|h(eckd(ate|nsrr)|o(p|wn)|r(oot)?|dir|grp|mod|unk_split)|l(ass(kit_method_(re(defin|mov|nam)e|add|copy)|_exists)|ose(dir|log)|earstatcache)|o(m(_(get(_active_object)?|i(nvoke|senum)|load(_typelib)?|pr(op([gs]e|pu)t|int_typeinfo)|addref|create_guid|event_sink|message_pump|release|set)|pact)?|n(nection_(aborted|status|timeout)|vert_(uu(de|en)code|cyr_string)|stant)|sh?|unt(_chars)?|py)|pdf_(a(dd_(annotation|outline)|rc)|c(l(ose(path(_(fill_)?stroke)?)?|ip)|ircle|ontinue_text|urveto)|fi(ll(_stroke)?|nalize(_page)?)|o(pen|utput_buffer)|p(age_init|lace_inline_image)|r(e(ct|store)|otate(_text)?|(lin|mov)eto)|s(ave(_to_file)?|et(_(c(har_spacing|reator|urrent_page)|font(_(directories|map_file))?|t(ext_(r(endering|ise)|matrix|pos)|itle)|action_url|(horiz_scal|lead|word_spac)ing|(keyword|viewer_preference)s|page_animation|subject)|gray(_(fill|stroke))?|line(cap|join|width)|rgbcolor(_(fill|stroke))?|dash|(fla|miterlimi)t)|how(_xy)?|tr(ingwidth|oke)|cale)|t(ext|ranslate)|(begin|end)_text|global_set_document_limits|import_jpeg|(lin|mov)eto|newpath)|r(ack_(c(heck|losedict)|getlastmessage|opendict)|c32|eate_function|ypt)|type_(al(num|pha)|p(rin|unc)t|cntrl|x?digit|graph|(low|upp)er|space)|ur(l_(c(los|opy_handl)e|e(rr(no|or)|xec)|multi_(in(fo_read|it)|((add|remove)_handl|clos)e|exec|(getconten|selec)t)|getinfo|(ini|setop)t|version)|rent)|y(bercash_(base64_(de|en)code|(de|en)cr)|rus_(c(lose|onnect)|authenticate|(un)?bind|query))|eil)|d(b(a(_(f(etch|irstkey)|op(en|timize)|(clos|delet|replac)e|(exist|handler)s|(inser|key_spli|lis)t|nextkey|popen|sync)|se_(c(los|reat)e|get_(record(_with_names)?|header_info)|num(fiel|recor)ds|(add|(delet|replac)e)_record|open|pack))|m(f(etch|irstkey)|(clos|delet|replac)e|exists|insert|nextkey|open)|plus_(a(dd|ql)|c((hdi|ur)r|lose)|err(code|no)|f(i(nd|rst)|ree((all|r)locks|lock)|lush)|get(lock|unique)|l(ast|ockrel)|r(c(r(t(exact|like)|eate)|hperm)|es(olve|torepos)|keys|open|query|rename|secindex|unlink|zap)|s(etindex(bynumber)?|avepos|ql)|t(cl|remove)|u(n(do(prepare)?|lockrel|select)|pdate)|x(un)?lockrel|info|next|open|prev)|x_(c(o(mpare|nnect)|lose)|e(rror|scape_string)|fetch_row|query|sort)|list)|cn?gettext|e(bug(_(print_)?backtrace|ger_o(ff|n))|c(bin|hex|oct)|fine(_syslog_variables|d)?|(aggrega|le)te|g2rad)|i(o_(s(eek|tat)|t(csetattr|runcate)|(clos|writ)e|fcntl|open|read)|r(ectoryiterator_(c(onstruc|urren)t|file(([acm]tim|inod|siz|typ)e|group|owner|perms)|get(path(name)?|children|filename)|is(d(ir|ot)|(((execu|wri)t|read)ab|fi)le|link)|key|next|(rewin|vali)d)|name)?|sk(_(free|total)_space|freespace)|e)|n(s_(get_(mx|record)|check_record)|gettext)|o(m(_(dom(characterdata_(append|(delet|replac)e|insert|substring)data|document_(create(attribute(ns)?|c(datasection|omment)|e(lement(ns)?|ntityreference)|documentfragment|processinginstruction|textnode)|getelement(sbytagname(ns)?|byid)|load(html(file)?|xml)?|relaxngvalidate(source)?|s(ave(html(file)?|xml)?|chemavalidate(source)?)|((importno|xinclu)d|normaliz|validat)e)|element_(get(attribute(n(ode(ns)?|s))?|elementsbytagname(ns)?)|hasattribute(ns)?|removeattribute(n(ode|s))?|setattribute(n(ode(ns)?|s))?)|implementation_(createdocument(type)?|hasfeature)|n(amednodemap_(getnameditem(ns)?|item)|ode(_(has(attribut|childnod)es|i(ss(amenode|upported)|nsertbefore)|lookup(namespaceuri|prefix)|re(mov|plac)echild|appendchild|(clonenod|normaliz)e)|list_item))|text_(iswhitespaceinelementconten|splittex)t|xpath_(query|registernamespace)|attr_isid)|import_simplexml)|attribute_((nam|valu)e|specified)|document(_(create_(c(data_section|omment)|e(lement(_ns)?|ntity_reference)|(attribut|text_nod)e|processing_instruction)|d(oc(type|ument_element)|ump_(file|mem))|get_element(_by_id|s_by_tagname)|add_root|html_dump_mem|xinclude)|type_(n(ame|otations)|entities|internal_subset|(public|system)_id))|element_(get_(attribute(_node)?|elements_by_tagname)|((has|remove|set)_attribut|tagnam)e)|node_(a(ppend_(child|sibling)|dd_namespace|ttributes)|c(hild_nodes|lone_node)|has_(attribut|child_nod)es|i(nsert_befor|s_blank_nod)e|n(ode_(nam|typ|valu)e|ext_sibling)|p(re(fix|vious_sibling)|arent_node)|re(place_(child|node)|move_child)|set_(name(space)?|content)|(dump|unlink)_node|(fir|la)st_child|(get_cont|owner_docum)ent)|processinginstruction_(data|target)|x(ml_(open_(file|mem)|x(slt_stylesheet(_(doc|file))?|mltree)|new_doc|version)|sltstylesheet_(result_dump_(file|mem)|process)))|tnet(_load)?|ubleval)|ate|gettext|l)|e(a(ster_da(te|ys)|ch)|r(eg(i(_replace)?|_replace)?|ror_(lo|reportin)g)|scapeshell(arg|cmd)|x(i(f_(t(agname|humbnail)|imagetype|read_data)|t)|p(lode|m1)?|t(ension_loaded|ract)|ec)|bcdic2ascii|cho|mpty|nd|val|zmlm_hash)|f(am_(c(ancel_monitor|lose)|monitor_(collection|directory|file)|next_event|open|pending|(resume|suspend)_monitor)|bsql_(a(ffected_rows|utocommit)|c(lo(b_siz|s)e|o(mmi|nnec)t|reate_([bc]lo|d)b|hange_user)|d(ata(base(_password)?|_seek)|b_(query|status)|rop_db)|err(no|or)|f(etch_(a(rray|ssoc)|field|lengths|object|row)|ield_(t(abl|yp)e|flags|len|name|seek)|ree_result)|list_(db|field|table)s|n(um_(field|row)s|ext_result)|p(assword|connect)|r(e(ad_[bc]lob|sult)|ollback)|s(e(t_(lob_mode|password|transaction)|lect_db)|t(art|op)_db)|(blob_siz|(host|table|user)nam)e|get_autostart_info|insert_id|query|warnings)|df_(add_(doc_javascript|template)|c(los|reat)e|e(rr(no|or)|num_values)|get_(a(p|ttachment)|f(ile|lags)|v(alue|ersion)|encoding|opt|status)|open(_string)?|s(ave(_string)?|et_(f(ile|lags)|o(n_import_javascri)?pt|s(tatus|ubmit_form_action)|v(alue|ersion)|ap|encoding|javascript_action|target_frame))|header|next_field_name|remove_item)|get(c(sv)?|ss?)|il(e(_(exis|(ge|pu)t_conten)ts|p(ro(_(field(count|(nam|typ)e|width)|r(etrieve|owcount)))?|erms)|([acm]tim|inod|siz|typ)e|group|owner)?|teriterator_((curren|nex)t|getinneriterator|key|(rewin|vali)d))|l(o(atval|ck|or)|ush)|p(assthru|rintf|uts)|r(e(a|nchtoj)d|ibidi_log2vis)|s(canf|eek|ockopen|tat)|t(p_(c(h(dir|mod)|dup|lose|onnect)|f(ge|pu)t|get(_option)?|m(dtm|kdir)|n(b_(f(ge|pu)t|continue|(ge|pu)t)|list)|p(asv|ut|wd)|r(aw(list)?|ename|mdir)|s(i[tz]e|et_option|sl_connect|ystype)|(allo|exe)c|delete|login|quit)|ell|ok|runcate)|unc(_(get_args?|num_args)|tion_exists)|(clos|writ)e|eof|(flus|nmatc)h|mod|open)|g(et(_(c(lass(_(method|var)s)?|(fg_va|urrent_use)r)|de(clared_(class|interfac)es|fined_(constant|function|var)s)|h(eaders|tml_translation_table)|include(_path|d_files)|m(agic_quotes_(gpc|runtime)|eta_tags)|re(quired_files|source_type)|browser|(extension_func|loaded_extension|object_var|parent_clas)s)|hostby(namel?|addr)|m(y([gpu]id|inode)|xrr)|protobyn(ame|umber)|r(andmax|usage)|servby(name|port)|t(ext|imeofday|ype)|allheaders|(cw|lastmo)d|(dat|imagesiz)e|env|opt)|m(p_(a(bs|[dn]d)|c(lrbit|mp|om)|div(_(qr?|r)|exact)?|gcd(ext)?|in((i|ver)t|tval)|m(od|ul)|p(o(wm?|pcount)|(erfect_squar|rob_prim)e)|s(can[01]|qrt(rem)?|etbit|ign|trval|ub)|(fac|hamdis)t|jacobi|legendre|neg|x?or|random)|(dat|(mk|strf)tim)e)|z(c(lose|ompress)|e(ncode|of)|get(ss?|c)|p(assthru|uts)|re(a|win)d|(((de|in)fla|wri)t|fil)e|open|seek|tell|uncompress)|d_info|lob|regoriantojd)|h(e(ader(s_(lis|sen)t)?|brevc?|xdec)|ighlight_(file|string)|t(ml(_entity_decode|(entitie|specialchar)s)|tp_build_query)|w(_(c(h(ildren(obj)?|angeobject)|onnect(ion_info)?|lose|p)|d(oc(byanchor(obj)?|ument_(s(etcontent|ize)|attributes|bodytag|content))|eleteobject|ummy)|e(rror(msg)?|dittext)|get(an(chors(obj)?|dlock)|child(coll(obj)?|doccoll(obj)?)|object(byquery(coll(obj)?|obj)?)?|parents(obj)?|re(mote(children)?|llink)|srcbydestobj|text|username)|i(n(s(ert(anchors|(documen|objec)t)|coll|doc)|collections|fo)|dentify)|m(apid|odifyobject|v)|o(bjrec2array|utput_document)|p(connec|ipedocumen)t|s(etlinkroo|ta)t|array2objrec|((free|new)_documen|roo)t|unlock|who)|api_(attribute(_(values?|key|langdepvalue))?|c(h(eck(in|out)|ildren)|o(ntent(_(mimetype|read))?|py))|d(st(ofsrc)?anchors|[bc]stat)|error_(count|reason)|f(ind|tstat)|h(gcsp|wstat)|i(n(sert(anchor|collection|document)?|fo)|dentify)|l(in|oc)k|object(_(a(ssign|ttreditable)|(coun|inser)t|new|(remov|titl|valu)e)|byanchor)?|re(ason_(description|type)|(mov|plac)e)|s(rc(anchors|sofdst)|etcommitedversion)|u(ser(list)?|nlock)|move|new_content|parents))|ypot)|i(base_(a(dd_user|ffected_rows)|b(lob_(c(ancel|(los|reat)e)|i(mport|nfo)|add|echo|get|open)|ackup)|c(o(mmit(_ret)?|nnect)|lose)|d(b_info|elete_user|rop_db)|e(rr(code|msg)|xecute)|f(etch_(assoc|object|row)|ree_(event_handler|query|result)|ield_info)|m(aintain_db|odify_user)|n(um_(field|param)s|ame_result)|p(aram_info|connect|repare)|r(ollback(_ret)?|estore)|se(rv(ice_(at|de)tach|er_info)|t_event_handler)|t(imefmt|rans)|gen_id|query|wait_event)|conv(_(mime_(decode(_headers)?|encode)|s(tr(len|r?pos)|et_encoding|ubstr)|get_encoding))?|d(3_(get_(genre_(id|list|name)|tag|version)|(remove|set)_tag)|ate)|fx(_(b(lobinfile_mode|yteasvarchar)|c(o(nnect|py_blob)|reate_(blob|char)|lose)|error(msg)?|f(ield(properti|typ)es|ree_(blob|char|result)|etch_row)|get(_(blob|char)|sqlca)|nu(m_(field|row)s|llformat)|p(connect|repare)|update_(blob|char)|affected_rows|do|htmltbl_result|query|textasvarchar)|us_(c(los|reat)e_slob|((fre|writ)e|open|read|seek|tell)_slob))|m(a(ge(_type_to_(extension|mime_type)|a(lphablending|ntialias|rc)|c(har(up)?|o(lor(a(llocate(alpha)?|t)|closest(alpha|hwb)?|exact(alpha)?|resolve(alpha)?|s(et|forindex|total)|deallocate|match|transparent)|py(merge(gray)?|res(ampl|iz)ed)?)|reate(from(g(d(2(part)?)?|if)|x[bp]m|(jpe|(p|stri)n)g|wbmp)|truecolor)?)|d(ashedline|estroy)|f(il(l(ed(arc|(ellips|rectangl)e|polygon)|toborder)?|ter)|ont(height|width)|t(bbox|text))|g(d2?|ammacorrect|if)|i(nterlace|struecolor)|l((ayereffec|oadfon)t|ine)|p(s(e(ncode|xtend)font|bbox|((copy|free|load|slant)fon|tex)t)|alettecopy|ng|olygon)|r(ectangl|otat)e|s(et(t(hickness|ile)|brush|pixel|style)|tring(up)?|avealpha|[xy])|t(tf(bbox|text)|ruecolortopalette|ypes)|2?wbmp|ellipse|jpeg|xbm)|p_(a(lerts|ppend)|b(ody(struct)?|ase64|inary)|c(l(earflag_full|ose)|heck|reatemailbox)|delete(mailbox)?|e(rrors|xpunge)|fetch(_overview|body|header|structure)|get(_quota(root)?|acl|mailboxes|subscribed)|header(info|s)?|l(ist(s(can|ubscribed)|mailbox)?|ast_error|sub)|m(ail(_(co(mpose|py)|move)|boxmsginfo)?|ime_header_decode|sgno)|num_(msg|recent)|r(e(namemailbox|open)|fc822_(parse_(adrlist|headers)|write_address))|s(e(t(_quota|(ac|flag_ful)l)|arch)|canmailbox|ort|tatus|ubscribe)|t(hread|imeout)|u(n(delet|subscrib)e|tf(7_(de|en)code|8)|id)|(8bi|qprin)t|open|ping))|p(lode|ort_request_variables))|n(clude(_once)?|et_(ntop|pton)|gres_(c(o(mmi|nnec)t|lose)|f(etch_(array|object|row)|ield_(n(am|ullabl)e|length|precision|(scal|typ)e))|num_(field|row)s|(autocommi|pconnec)t|query|rollback)|i_(get(_all)?|alter|restore|set)|_array|tval)|p(tc(embed|parse)|2long)|rcg_(i(gnore_(add|del)|(nvit|s_conn_aliv)e)|l(ist|(ookup_format_message|user)s)|n(ick(name_(un)?escape)?|ames|otice)|p(ar|connec)t|set_(current|(fil|on_di)e)|who(is)?|((channel_m|html_enc)od|get_usernam)e|disconnect|(eval_ecmascript_param|register_format_message)s|(fetch_error_)?msg|join|kick|oper|topic)|s(_(a(rray)?|d(ir|ouble)|f(i(l|nit)e|loat)|in(t(eger)?|finite)|l(ink|ong)|n(u(ll|meric)|an)|re(a(dable|l)|source)|s(calar|oap_fault|tring|ubclass_of)|write?able|bool|((call|execut)ab|uploaded_fi)le|object)|set)|gnore_user_abort)|j(ava_last_exception_(clear|get)|d(to(j(ewish|ulian)|french|gregorian|unix)|dayofweek|monthname)|(ewish|ulian)tojd|oin|peg2wbmp)|k(ey|r?sort)|l(dap_(c(o(mpare|nnect|unt_entries)|lose)|d(elete|n2ufn)|e(rr((2st|o)r|no)|xplode_dn)|f(irst_((attribut|referenc)e|entry)|ree_result)|get_(values(_len)?|(attribut|entri)es|(d|optio)n)|mod(_(add|del|replace)|ify)|next_((attribut|referenc)e|entry)|parse_re(ference|sult)|re(ad|name)|s(e(t_(option|rebind_proc)|arch)|asl_bind|ort|tart_tls)|8859_to_t61|(ad|(un)?bin)d|list|t61_to_8859)|i(mititerator_(getposition|next|(rewin|vali)d|seek)|nk(info)?|st)|o(cal(econv|time)|g(1[0p])?|ng2ip)|zf_((de)?compress|optimized_for)|cg_value|evenshtein|stat|trim)|m(a(i(l(parse_(msg_(extract_part(_file)?|get_(part(_data)?|structure)|parse(_file)?|(creat|fre)e)|determine_best_xfer_encoding|rfc822_parse_addresses|stream_encode|uudecode_all))?|n)|x)|b_(convert_(case|encoding|kana|variables)|de(code_(mimeheader|numericentity)|tect_(encoding|order))|e(ncode_(mimeheader|numericentity)|reg(_(search(_(get(po|reg)s|init|((set)?po|reg)s))?|match|replace)|i(_replace)?)?)|http_(in|out)put|l(anguage|ist_encodings)|p(arse_str|referred_mime_name)|regex_(encoding|set_options)|s(tr(to(low|upp)er|cut|(im)?width|len|r?pos)|ubst(r(_count)?|itute_character)|end_mail|plit)|get_info|internal_encoding|output_handler)|c(al_(c(lose|reate_calendar)|d(a(te_(compare|valid)|y(_of_(week|year)|s_in_month))|elete_(calendar|event))|e(vent_(set_(c(ategory|lass)|recur_(monthly_[mw]day|(dai|week|year)ly|none)|alarm|description|end|start|title)|add_attribute|init)|xpunge)|fetch_(current_stream_)?event|list_(alarm|event)s|re(name_calendar|open)|s(nooze|tore_event)|append_event|(is_leap|week_of)_year|next_recurrence|p?open|time_valid)|rypt_(c(bc|fb|reate_iv)|e(nc(_(get_(((algorithm|mode)s_nam|(block|iv|key)_siz)e|supported_key_sizes)|is_block_(algorithm(_mode)?|mode)|self_test)|rypt)|cb)|ge(neric(_((de)?init|end))?|t_((block|iv|key)_siz|cipher_nam)e)|list_(algorithm|mode)s|module_(get_(algo_(block|key)_size|supported_key_sizes)|is_block_(algorithm(_mode)?|mode)|close|open|self_test)|decrypt|ofb)|ve_(adduser(arg)?|c(h(eckstatus|(k|ng)pwd)|o(nnect(ionerror)?|mpleteauthorizations))|d(e(l(ete(response|trans|usersetup)|user)|stroy(conn|engine))|isableuser)|e(dit|nable)user|g(et(c(ell(bynum)?|ommadelimited)|user(arg|param)|header)|[fu]t|l)|i(nit(conn|engine|usersetup)|scommadelimited)|list(stat|user)s|m(axconntimeout|onitor)|num(column|row)s|p(reauth(completion)?|arsecommadelimited|ing)|re(turn(code|status)?|sponseparam)|s(et(ssl(_files)?|t(imeout|le)|blocking|dropfile|ip)|ale)|t(ext_(c(ode|v)|avs)|rans(action(a(uth|vs)|i(d|tem)|batch|cv|(ssen|tex)t)|inqueue|new|param|send))|u(b|wait)|v(erify(connection|sslcert)|oid)|bt|(forc|overrid)e|qc))|d(5(_file)?|ecrypt_generic)|e(m(cache_(c(lose|onnect)|de(bug|crement|lete)|get(stats|version)?|add|flush|(incremen|pconnec|se)t|replace)|ory_get_usage)|t(aphone|hod_exists))|hash(_(get_(block_siz|hash_nam)e|count|keygen_s2k))?|i(n(g_(set(cubicthreshold|scale)|useswfversion))?|(crotim|me_content_typ)e)|k(dir|time)|o(ney_format|ve_uploaded_file)|s(ession_(c(o(nnec|un)t|reate)|d(estroy|isconnect)|get(_(array|data))?|l(ist(var)?|ock)|set(_(array|data))?|un(iq|lock)|find|inc|plugin|randstr|timeout)|g_(re(ceiv|move_queu)e|s(e(nd|t_queue)|tat_queue)|get_queue)|ql(_(c(reate_?db|lose|onnect)|d(b(_query|name)|ata_seek|rop_db)|f(etch_(array|field|object|row)|ield(_(t(abl|yp)e|flags|len|name|seek)|t(abl|yp)e|flags|len|name)|ree_result)|list_(db|field|table)s|num(_(field|row)s|(field|row)s)|re(gcase|sult)|affected_rows|error|pconnect|query|select_db|tablename))?|sql_(c(lose|onnect)|f(etch_(a(rray|ssoc)|batch|field|object|row)|ield_(length|(nam|typ)e|seek)|ree_(resul|statemen)t)|g(et_last_message|uid_string)|min_(error|message)_severity|n(um_(field|row)s|ext_result)|r(esult|ows_affected)|bind|data_seek|execute|(ini|pconnec)t|query|select_db))|t_(getrandmax|s?rand)|uscat_(g(et|ive)|setup(_net)?|close)|ysql(_(c(l(ient_encoding|ose)|hange_user|onnect|reate_db)|d(b_(name|query)|ata_seek|rop_db)|e(rr(no|or)|scape_string)|f(etch_(a(rray|ssoc)|field|lengths|object|row)|ield_(t(abl|yp)e|flags|len|name|seek)|ree_result)|get_((clien|hos)t|proto|server)_info|in(fo|sert_id)|list_(db|field|(process|tabl)e)s|num_(field|row)s|p(connect|ing)|re(al_escape_string|sult)|s(elect_db|tat)|t(ablename|hread_id)|affected_rows|(unbuffered_)?query)|i_(a(ffected_rows|utocommit)|bind_(param|result)|c(ha(nge_user|racter_set_name)|l(ient_encoding|ose)|o(nnect(_err(no|or))?|mmit))|d(isable_r(eads_from_master|pl_parse)|ata_seek|ebug|ump_debug_info)|e(nable_r(eads_from_master|pl_parse)|rr(no|or)|mbedded_connect|scape_string|xecute)|f(etch(_(a(rray|ssoc)|field(_direct|s)?|lengths|object|row))?|ield_(count|seek|tell)|ree_result)|get_(client_(info|version)|server_(info|version)|(host|proto)_info|metadata)|in(fo|it|sert_id)|m((aster|ulti)_query|ore_results)|n(um_(field|row)s|ext_result)|p(aram_count|ing|repare)|r(e(al_(connect|escape_string|query)|port)|pl_(p(arse_enabled|robe)|query_type)|ollback)|s(e(nd_(long_data|query)|rver_(end|init)|lect_db|t_opt)|t(mt_(bind_(param|result)|e(rr(no|or)|xecute)|f(etch|ree_result)|p(aram_count|repare)|res(et|ult_metadata)|s(end_long_data|qlstate|tore_result)|(affected|num)_rows|close|data_seek|init)|(a|ore_resul)t)|qlstate|sl_set)|thread_(id|safe)|kill|options|query|(use_resul|warning_coun)t)))|n(at(case)?sort|curses_(a(dd(ch(n?str)?|n?str)|ttr(o(ff|n)|set)|ssume_default_colors)|b(kgd(set)?|o(rder|ttom_panel)|audrate|eep)|c(l(rto(bot|eol)|ear)|olor_(conten|se)t|an_change_color|break|urs_set)|d(e(f(_(prog|shell)_mode|ine_key)|l(_panel|ay_output|ch|(etel|wi)n))|oupdate)|e(cho(char)?|rase(char)?|nd)|f(l(ash|ushinp)|ilter)|get(m(axyx|ouse)|ch|yx)|h(a(s_(i[cl]|colors|key)|lfdelay)|ide_panel|line)|i(n(it(_(colo|pai)r)?|s(ch|(del|ert)ln|s?tr)|ch)|sendwin)|k(ey(ok|pad)|illchar)|m(o(use(_trafo|interval|mask)|ve(_panel)?)|v(add(ch(n?str)?|n?str)|(cu|waddst)r|(del|get|in)ch|[hv]line)|eta)|n(ew(_panel|pad|win)|o(cbreak|echo|nl|qiflush|raw)|apms|l)|p(a(nel_(above|(bel|wind)ow)|ir_content)|(nout)?refresh|utp)|r(e(set(_(prog|shell)_mode|ty)|fresh|place_panel)|aw)|s(cr(_(dump|(ini|se)t|restore)|l)|lk_(attr(o(ff|n)|set)?|c(lea|olo)r|re(fresh|store)|(ini|se)t|(noutrefres|touc)h)|ta(nd(end|out)|rt_color)|avetty|how_panel)|t(erm(attrs|name)|imeout|op_panel|ypeahead)|u(nget(ch|mouse)|se_(e(nv|xtended_names)|default_colors)|pdate_panels)|v(idattr|line)|w(a(dd(ch|str)|ttr(o(ff|n)|set))|c(lear|olor_set)|mo(use_trafo|ve)|stand(end|out)|border|(eras|[hv]lin)e|(getc|(nout)?refres)h)|longname|qiflush)|l(2br|_langinfo)|otes_(c(reate_(db|note)|opy_db)|mark_(un)?read|body|drop_db|(find_no|nav_crea)te|header_info|list_msgs|search|unread|version)|sapi_(re(quest|sponse)_headers|virtual)|((gett)?ex|umber_forma)t)|o(b_(end_(clean|flush)|g(et_(c(lean|ontents)|le(ngth|vel)|flush|status)|zhandler)|i(conv_handler|mplicit_flush)|clean|flush|list_handlers|start|tidyhandler)|c(i(_(c(o(llection_(a(ppend|ssign)|element_(assign|get)|max|size|trim)|(mmi|nnec)t)|ancel|lose)|e(rror|xecute)|f(etch(_(a(ll|rray|ssoc)|object|row))?|ield_(s(cal|iz)e|type(_raw)?|is_null|name|precision)|ree_(collection|descriptor|statement))|lob_(c(lose|opy)|e(of|rase|xport)|i(mport|s_equal)|re(a|win)d|s((av|iz)e|eek)|t(ell|runcate)|write(_temporary)?|(appen|loa)d|flush)|n(ew_(c(o(llection|nnect)|ursor)|descriptor)|um_(field|row)s)|p(a(rs|ssword_chang)e|connect)|r(esult|ollback)|s(e(rver_version|t_prefetch)|tatement_type)|(bind|define)_by_name|internal_debug)|c(o(l(l(a(ssign(elem)?|ppend)|(getele|tri)m|max|size)|umn(s(cal|iz)e|type(raw)?|isnull|name|precision))|mmit)|ancel|loselob)|e(rror|xecute)|f(etch(into|statement)?|ree(c(ollection|ursor)|desc|statement))|lo(go(ff|n)|adlob)|n(ew(c(ollection|ursor)|descriptor)|logon|umcols)|p(arse|logon)|r(o(llback|wcount)|esult)|s(avelob(file)?|e(t(bufferinglob|prefetch)|rverversion)|tatementtype)|write(lobtofile|temporarylob)|(bind|define)byname|getbufferinglob|internaldebug)|tdec)|dbc_(c(lose(_all)?|o(lumn(privilege)?s|(mmi|nnec)t)|ursor)|d(ata_source|o)|e(rror(msg)?|xec(ute)?)|f(etch_(array|into|object|row)|ield_(n(ame|um)|(le|precisio)n|(scal|typ)e)|oreignkeys|ree_result)|n(um_(field|row)s|ext_result)|p(r(ocedure(column)?s|epare|imarykeys)|connect)|r(esult(_all)?|ollback)|s(etoption|(pecialcolumn|tatistic)s)|table(privilege)?s|autocommit|binmode|gettypeinfo|longreadlen)|pen(ssl_(csr_(export(_to_file)?|new|sign)|get_p(rivate|ublic)key|p(k(cs7_((de|en)crypt|sign|verify)|ey_(export(_to_file)?|get_p(rivate|ublic)|new))|rivate_(de|en)crypt|ublic_(de|en)crypt)|s(eal|ign)|x509_(check(_private_key|purpose)|export(_to_file)?|(fre|pars)e|read)|error_string|(free_ke|verif)y|open)|dir|log)|r(a_(c(o(lumn(nam|siz|typ)e|mmit(o(ff|n))?)|lose)|e(rror(code)?|xec)|fetch(_into)?|logo(ff|n)|num(col|row)s|p(arse|logon)|bind|do|(getcolum|ope)n|rollback)|d)|utput_(add_rewrite_var|reset_rewrite_vars)|v(rimos_(c(o(mmi|nnec)t|lose|ursor)|exec(ute)?|f(etch_(into|row)|ield_(n(ame|um)|len|type)|ree_result)|num_(field|row)s|r(esult(_all)?|ollback)|longreadlen|prepare)|erload))|p(a(r(entiterator_((get|has)children|next|rewind)|se(_(ini_file|str|url)|kit_(compile_(file|string)|func_arginfo)))|ck|ssthru|thinfo)|c(ntl_(s(etpriority|ignal)|w(ait(pid)?|if(s(ignal|topp)ed|exited)|exitstatus|(stop|term)sig)|alarm|exec|fork|getpriority)|lose)|df_(a(dd_(l(aunch|ocal)link|annotation|(bookmar|(pdf|web)lin)k|(not|outlin)e|thumbnail)|rcn?|ttach_file)|begin_(pa(ge|ttern)|template)|c(l(ose(_(pdi(_page)?|image)|path(_(fill_)?stroke)?)?|ip)|on(ca|tinue_tex)t|ircle|urveto)|end(_(pa(ge|ttern)|template)|path)|fi(ll(_stroke)?|ndfont)|get_(font((nam|siz)e)?|image_(height|width)|m(aj|in)orversion|p(di_(parameter|value)|arameter)|buffer|value)|m(akespotcolor|oveto)|open(_(image(_file)?|p(di(_page)?|ng)|ccitt|(fil|memory_imag)e|(gi|tif)f|jpeg))?|place_(im|pdi_p)age|r(e(ct|store)|otate)|s(et(_(border_(color|dash|style)|info(_((auth|creat)or|keywords|subject|title))?|text_(r(endering|ise)|matrix|pos)|((char|word)_spac|horiz_scal|lead)ing|duration|font|parameter|value)|f(la|on)t|gray(_(fill|stroke))?|line(cap|join|width)|m(atrix|iterlimit)|rgbcolor(_(fill|stroke))?|color|(poly)?dash)|how(_(boxed|xy))?|tr(ingwidth|oke)|(av|cal)e|kew)|(dele|transla)te|initgraphics|lineto|new)|f(pro_(process(_raw)?|cleanup|init|version)|sockopen)|g_(c(l(ient_encoding|ose)|o(n(nect(ion_(busy|reset|status))?|vert)|py_(from|to))|ancel_query)|d(bnam|elet)e|e(scape_(bytea|string)|nd_copy)|f(etch_(a(ll|rray|ssoc)|r(esult|ow)|object)|ield_(n(ame|um)|is_null|prtlen|(siz|typ)e)|ree_result)|get_(notify|pid|result)|l(ast_(error|notice|oid)|o_(c(los|reat)e|read(_all)?|(ex|im)port|open|(see|unlin)k|tell|write))|num_(field|row)s|p(arameter_status|(connec|or)t|ing|ut_line)|result_(s(eek|tatus)|error)|se(lect|nd_query|t_client_encoding)|t(race|ty)|u(n(escape_bytea|trace)|pdate)|(affected_row|option)s|(hos|inser)t|meta_data|query|version)|hp(_(s(api_nam|trip_whitespac)e|check_syntax|ini_scanned_files|logo_guid|uname)|credits|info|version)|o(s(ix_(get(e[gu]id|g(r(gid|nam|oups)|id)|p(g(id|rp)|w(nam|uid)|p?id)|_last_error|(cw|[su]i)d|login|rlimit)|s(et(e[gu]id|(p?g|[su])id)|trerror)|t(imes|tyname)|ctermid|isatty|kill|mkfifo|uname))?|pen|w)|r(e(g_(match(_all)?|replace(_callback)?|grep|quote|split)|v)|int(er_(c(reate_(brush|dc|font|pen)|lose)|d(elete_(brush|dc|font|pen)|raw_(r(ectangle|oundrect)|bmp|chord|(elips|lin|pi)e|text))|end_(doc|page)|l(is|ogical_fontheigh)t|s(e(lect_(brush|font|pen)|t_option)|tart_(doc|page))|abort|(get_optio|ope)n|write)|_r|f)?|oc_((clos|nic|terminat)e|get_status|open))|spell_(add_to_(personal|session)|c(onfig_(d(ata|ict)_dir|r(epl|untogether)|(creat|ignor|mod)e|(persona|save_rep)l)|heck|lear_session)|new(_(config|personal))?|s((ave_wordli|ugge)s|tore_replacemen)t)|i|ng2wbmp|utenv)|q(dom_(error|tree)|uote(d_printable_decode|meta))|r(a(n(d|ge)|wurl(de|en)code|d2deg)|e(a(d(lin(e(_(c(allback_(handler_(install|remove)|read_char)|lear_history|ompletion_function)|((ad|rea)d|list|write)_history|info))?|k)|_exif_data|dir|(gz)?file)|lpath)|c(ode(_(file|string))?|ursive(directoryiterator_((get|has)children|key|next|rewind)|iteratoriterator_(get(depth|subiterator)|(curren|nex)t|key|(rewin|vali)d)))|gister_(shutdown|tick)_function|quire(_once)?|s(tore_(e(rror|xception)_handler|include_path)|et)|wind(dir)?|name|turn)|mdir|ound|sort|trim)|s(e(m_(re(leas|mov)e|acquire|get)|s(am_(co(mmi|nnec)t|di(agnostic|sconnect)|e(rrormsg|xecimm)|f(etch_(r(esult|ow)|array)|ield_(array|name)|ree_result)|se(ek_row|ttransaction)|(affected_row|num_field)s|query|rollback)|sion_(c(ache_(expire|limiter)|ommit)|de(code|stroy)|i(s_registere)?d|reg(enerate_id|ister)|s(et_(cookie_params|save_handler)|ave_path|tart)|un(register|set)|(encod|(module_)?nam|write_clos)e|get_cookie_params))|t(_(e(rror|xception)_handler|file_buffer|include_path|magic_quotes_runtime|time_limit)|((raw)?cooki|local|typ)e)|rialize)|h(a1(_file)?|m(_(remove(_var)?|(at|de)tach|(ge|pu)t_var)|op_((clos|(dele|wri)t|siz)e|open|read))|ell_exec|(ow_sourc|uffl)e)|i(m(plexml(_(element_(a(sxml|ttributes)|children|xpath)|load_(file|string)|import_dom)|iterator_((curren|nex)t|(get|has)children|key|(rewin|vali)d))|ilar_text)|nh?|zeof)|nmp(_(get_(quick_print|valueretrieval)|set_((enum|oid_numeric|quick)_print|valueretrieval)|read_mib)|get(next)?|walk(oid)?|realwalk|set)|o(ap(client_(get(lastre(quest|sponse)|(function|type)s)|call|soapclient)|server_(s(et(class|persistence)|oapserver)|addfunction|getfunctions|handle)|fault_soapfault|(header_soapheade|var_soapva)r|param_soapparam)|cket_(c(l(ear_error|ose)|reate(_(listen|pair))?|onnect)|get(_(option|status)|(peer|sock)name)|l(ast_error|isten)|re(cv(from)?|ad)|s(e(nd(to)?|t_(block(ing)?|nonblock|option|timeout)|lect)|hutdown|trerror)|accept|bind|write)|rt|undex)|p(liti?|rintf)|q(l(ite_(c(reate_(aggregate|function)|hanges|lose|olumn|urrent)|e((rror|scape)_string|xec)|f(etch_(a(ll|rray)|s(ingle|tring)|column_types|object)|actory|ield_name)|has_(more|prev)|l(ast_(error|insert_rowid)|ib(encoding|version))|n(um_(field|row)s|ext)|p(open|rev)|s(eek|ingle_query)|u(df_(de|en)code_binary|nbuffered_query)|(array_)?query|busy_timeout|open|rewind)|_regcase)|rt)|t(r(_(r(ep(eat|lace)|ot13)|s(huffle|plit)|ireplace|pad|word_count)|c((asec)?mp|hr|oll|spn)|eam_(co(ntext_(get_(default|options)|set_(option|params)|create)|py_to_stream)|filter_((ap|pre)pend|register)|get_(((conten|transpor)t|(filt|wrapp)er)s|line|meta_data)|s(e(t_(blocking|timeout|write_buffer)|lect)|ocket_(se(ndto|rver)|(accep|clien)t|enable_crypto|get_name|recvfrom))|(register_wrapp|wrapper_regist)er)|i(p(_tag|c?slashe|o)s|str)|n(atc(asec)?mp|c(asec)?mp)|p(brk|os)|r(chr|ev|i?pos)|s(pn|tr)|t(o(k|(low|upp)er|time)|r)|ftime|len|val)|at)|ubstr(_(co(mpare|unt)|replace))?|wf(_(a(ction(g(oto(frame|label)|eturl)|p(lay|revframe)|s(ettarget|top)|(next|waitfor)frame|togglequality)|dd(buttonrecord|color))|define(bitmap|(fon|rec|tex)t|line|poly)|end(s(hape|ymbol)|(butt|doacti)on)|font(s(ize|lant)|tracking)|get(f(ontinfo|rame)|bitmapinfo)|l(abelframe|ookat)|m(odifyobject|ulcolor)|o(rtho2?|ncondition|penfile)|p(o(larview|pmatrix|sround)|erspective|laceobject|ushmatrix)|r(emoveobject|otate)|s(etf(ont|rame)|h(ape(curveto3?|fill(bitmap(clip|tile)|off|solid)|line(solid|to)|arc|moveto)|owframe)|tart(s(hape|ymbol)|(butt|doacti)on)|cale)|t(extwidth|ranslate)|closefile|nextid|viewport)|b(itmap(.get(height|width))?|utton(.(add(action|shape)|set((actio|dow)n|hit|over|up))|_keypress)?)|displayitem(.(m(ove(to)?|ultcolor)|r(otate(to)?|emove)|s(cale(to)?|et(depth|name|ratio)|kew(x(to)?|y(to)?))|addcolor))?|f(ill(.(s(kew[xy]to|caleto)|(mov|rotat)eto))?|ont(.getwidth)?)|gradient(.addentry)?|mo(rph(.getshape[12])?|vie(.(s(et(background|dimension|frames|rate)|ave|treammp3)|add|(nextfram|remov)e|output))?)|s(hape(.(draw(curve(to)?|line(to)?)|movepen(to)?|set(l(eftfill|ine)|rightfill)|addfill))?|prite(.(add|(nextfram|remov)e|setframes))?)|text(.(set(color|(fon|heigh)t|spacing)|addstring|getwidth|moveto)|field(.(a(ddstring|lign)|set(l(eftmargin|inespacing)|(bound|margin)s|color|(fon|heigh)t|(indentatio|rightmargi)n|name)))?)?|action)|y(base_(c(lose|onnect)|d(ata_seek|eadlock_retry_count)|f(etch_(a(rray|ssoc)|field|object|row)|ield_seek|ree_result)|min_(client|(erro|serve)r|message)_severity|num_(field|row)s|se(lect_db|t_message_handler)|affected_rows|get_last_message|(pconnec|resul)t|(unbuffered_)?query)|s(log|tem)|mlink)|candir|leep|rand|scanf)|t(anh?|e(mpnam|xtdomain)|i(dy_(c(on(fig_coun|struc)t|lean_repair)|get(_(h(tml(_ver)?|ead)|r(elease|oot)|body|config|error_buffer|output|status)|opt)|is_x(ht)?ml|node_(get_(attr|nodes)|has(children|siblings)|is(x(ht)?ml|(as|ph)p|(commen|tex)t|html|jste)|attributes|children|next|prev|tidy_node)|parse_(file|string)|re(pair_(file|string)|set_config)|s(et(_encoding|opt)|ave_config)|(access|error|warning)_count|diagnose|load_config)|me(_nanosleep)?)|o(ken_(get_all|name)|uch)|ri(gger_error|m)|cpwrap_check|mpfile)|u(c(first|words)|dm_(a(lloc_agent(_array)?|dd_search_limit|pi_version)|c(at_(list|path)|heck_(charset|stored)|l(ear_search_limits|ose_stored)|rc32)|err(no|or)|f(ree_(agent|ispell_data|res)|ind)|get_(res_(field|param)|doc_count)|hash32|load_ispell_data|open_stored|set_agent_param)|n(i(qi|xtoj)d|se(rialize|t)|(lin|pac)k|register_tick_function)|rl(de|en)code|s(er_error|leep|ort)|tf8_(de|en)code|[ak]sort|mask)|v(ar(_(dump|export)|iant(_(a(bs|[dn]d)|c(as?t|mp)|d(ate_(from|to)_timestamp|iv)|i(div|mp|nt)|m(od|ul)|n(eg|ot)|s(et(_type)?|ub)|eqv|fix|get_type|x?or|pow|round))?)|p(opmail_(a(dd_(alias_domain(_ex)?|domain(_ex)?|user)|lias_(del(_domain)?|get(_all)?|add)|uth_user)|del_(domain(_ex)?|user)|error|passwd|set_user_quota)|rintf)|ersion_compare|[fs]printf|irtual)|w(32api_(in(it_dtype|voke_function)|deftype|register_function|set_call_method)|ddx_(packet_(end|start)|serialize_va(lue|rs)|add_vars|deserialize)|ordwrap)|x(attr_(s(et|upported)|(ge|lis)t|remove)|diff_(file_(diff(_binary)?|patch(_binary)?|merge3)|string_(diff(_binary)?|patch(_binary)?|merge3))|ml(_(get_(current_(byte_index|(column|line)_number)|error_code)|parse(r_(create(_ns)?|free|[gs]et_option)|_into_struct)?|set_(e(lement|nd_namespace_decl|xternal_entity_ref)_handler|(character_data|default|(notation|start_namespace|unparsed_entity)_decl|processing_instruction)_handler|object)|error_string)|rpc_(decode(_request)?|encode(_request)?|se(rver_(c(all_method|reate)|register_(introspection_callback|method)|add_introspection_data|destroy)|t_type)|get_type|is_fault|parse_method_descriptions))|p(ath_(eval(_expression)?|new_context)|tr_(eval|new_context))|sl(_xsltprocessor_(re(gister_php_functions|move_parameter)|transform_to_(doc|uri|xml)|[gs]et_parameter|(has_exslt_suppor|import_styleshee)t)|t_(backend_(info|name|version)|err(no|or)|set(_(e(ncoding|rror_handler)|s(ax_handlers?|cheme_handlers?)|base|log|object)|opt)|(creat|fre)e|getopt|process)))|y(az_(c(cl_(conf|parse)|lose|onnect)|e(rr(no|or)|(lemen|s_resul)t)|r(ange|ecord)|s(c(an(_result)?|hema)|e(arch|t_option)|ort|yntax)|addinfo|database|get_option|hits|itemorder|(presen|wai)t)|p_(err(_string|no)|ma(ster|tch)|all|(ca|firs|nex)t|get_default_domain|order))|z(end_(logo_guid|version)|ip_(entry_(c(ompress(edsize|ionmethod)|lose)|(filesiz|nam)e|open|read)|close|open|read)|lib_get_coding_type))\b/ { + + function_name_face (true); + language_print ($0); + function_name_face (false); + } + + /\b(include|if|elseif|include_once|require|require_once|while|for|function| + return|case|default|global|switch|else|break|return|as|foreach|var|const|class|__construct|__deconstruct)\b/ { + + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: postscript + * Description: PostScript programming language. + * + * Author: Dave Hylands (DHylands@creo.com) + */ + +state ps_string +{ + /\\\\./ { + language_print ($0); + } + /[\)]/ { + language_print ($0); + return; + } + /[\(]/ { + /* Balanced ()'s in a string */ + language_print ($0); + call (ps_string); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state ps_encoded_string +{ + /[\>]/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state postscript +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /%/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /[\(]/ { + string_face (true); + language_print ($0); + call (ps_string); + string_face (false); + } + + /[\<]/ { + string_face (true); + language_print ($0); + call (ps_encoded_string); + string_face (false); + } + + /* Keywords. + + I built the keyword list using the following PostScript program + + /str 128 string def + /outFile \(ps.txt)(w)file def + /proc + { + pop //str cvs outFile exch writestring outFile (\n) writestring + } bind def + + systemdict /proc load forall + statusdict /proc load forall + errordict /proc load forall + + I then ran: + + sort ps.txt | uniq | fmt > ps.key + + I then went through the list and removed << >> [ ] and obvious Harlequin + extensions. Many of the keywords remaining are not documented in the Red + Book but are implemented in some Adobe implementations (especially the + ones from statusdict). I decided to leave them in. + + And since I don't have emacs (gasp), I wrote a program which takes the + ps.key file and generates the regular expression. This was faster than + trying to install emacs and figure out how it works. + + Also note that PostScript doesn't require whitespace in front of keywords. + In particular, text can follow immediately after any of the following + characters: + + > { } ) [ ] / + + and can be followed immediately by the following: + + < { } ( [ ] / + + in addition to white space. + + Contents of ps.key: + + $error .error 11x17tray 12x24tray 15x24tray = == =print =scratch =string + FontDirectory GlobalFontDirectory ISOLatin1Encoding + Run SharedFontDirectory SpecialRun StandardEncoding + VMerror a2tray a3tray a4tray a5tray abs add aload + anchorsearch and appletalktype arc arcn arct arcto array ashow astore + atan authors awidthshow b5tray begin bind bitshift blackoverprint blink + broadsheettray buildtime bytesavailable cachestatus ceiling cexec + charpath checkpassword checkscreen clear cleardictstack clearinterrupt + cleartomark clip clippath closefile closepath closescc colorimage concat + concatmatrix configurationerror copy copypage cos count countdictstack + countexecstack counttomark cshow currentblackgeneration + currentcacheparams currentcmykcolor currentcolor currentcolorrendering + currentcolorrenderingintent currentcolorscreen currentcolorspace + currentcolortransfer currentdash currentdevparams currentdict + currentdlhooks currentfile currentflat currentfont currentglobal + currentgray currentgstate currenthalftone currenthalftonephase + currenthsbcolor currentinterceptcolorspace currentlinecap + currentlinejoin currentlinewidth currentmatrix currentmiterlimit + currentobjectformat currentoverprint currentpacking currentpagedevice + currentpoint currentrelativeneutrals currentreproductioncriteria + currentrgbcolor currentscreen currentseparationcolornames + currentseparationorder currentshared currentstrokeadjust + currentsystemparams currenttransfer currenttrapintent + currentundercolorremoval currentuserparams curveto cvi cvlit cvn cvr + cvrs cvs cvx daytime def defaultblackoverprint + defaulthandleerror defaultmatrix defaultmirrorprint defaultpagemargin + defaultpageparams defaultprocesscolors defaulttimeouts definefont + defineresource defineuserobject deletefile devdismount devforall + devformat deviceinfo devmount devstatus dict dictfull dictstack + dictstackoverflow dictstackunderflow disableinterrupt diskonline + diskstatus div dlclearcaches dostartpage dosysstart dtransform dup echo + eerom eescratch eexec enableinterrupt end endofjob eoclip eofill eq + erasepage errorbeep errordict exch exec execdict execform execstack + execstackoverflow execuserobject executeonly executive exit exp exposure + false file filekind filelinenumber filename filenameforall fileposition + fill filter findcharstrings findcolorrenderingintent findencoding + findfont findpgfont findresource flattenpath floor flush flushcache + flushfile for forall gcheck ge genericpaper get getinterval getknown + getsccconfig gettopfile gettoprealfile globaldict glyphshow grestore + grestoreall gsave gstate gt handleerror hardwareiomode + identmatrix idiv idlefonts idtransform if ifelse + image imagemask index ineofill infill initclip initgraphics initialized + initializedisk initmatrix instroke internaldict interrupt + interruptenabled inueofill inufill inustroke invalidaccess invalidexit + invalidfileaccess invalidfont invalidrestore invertmatrix ioerror + ismanualfeed itransform jobname jobsource jobstate jobstring jobtimeout + known kshow languagelevel lastmode le ledgertray legaltray length + lettertray limitcheck lineto listfilesinestack ln load + loadcurrentpagedevice loadsetpagedevice log loop lt makefont makepattern + manualfeedtimeout margins mark matchtemplate matrix maxlength + medialength mediasize mediawidth mirrorprint mod moveto mul ne neg + negativeprint newpath noaccess nocurrentpoint not null nulldevice + openscc or packedarray pagecount pagemargin pageparams pagestackorder + pagetype pathbbox pathforall pop print printererror printermessage + printername printerstatus printerupset printobject processcolors product + prompt pstack put putinterval quit ramsize rand rangecheck rcheck + rcurveto read readhexstring readline readonly readstring realtime + rectclip rectfill rectstroke renamefile repeat resetfile resetprinter + resolution resourceforall resourcestatus restore reversepath revision + rlineto rmoveto roll rootfont rotate round rrand run save scale + scalefont sccbatch sccfiles sccinteractive scheck screenforall search + selectfont sendctrld sendpcmd sendprinterstate serialnumber serverdict + setaccuratescreens setbbox setblackgeneration setblackoverprint setblink + setcachedevice setcachedevice2 setcachelimit setcacheparams setcharwidth + setcmykcolor setcolor setcolorrendering setcolorrenderingintent + setcolorscreen setcolorspace setcolortransfer setdash + setdefaultblackoverprint setdefaultmirrorprint setdefaultpagemargin + setdefaultpageparams setdefaultprocesscolors setdefaulttimeouts + setdevparams setdlhooks setdostartpage setdosysstart seteescratch + setexposure setfileposition setflat setfont setglobal setgray setgstate + sethalftone sethalftonephase sethardwareiomode sethsbcolor setidlefonts + setinterceptcolorspace setjobtimeout setlinecap setlinejoin setlinewidth + setmargins setmatrix setmirrorprint setmiterlimit setnegativeprint + setobjectformat setoverprint setpacking setpage setpagedevice + setpagemargin setpageparams setpageseen setpagestackorder setpagetype + setpassword setpattern setprintername setprocesscolors + setrelativeneutrals setreproductioncriteria setresolution setrgbcolor + setsccbatch setsccconfig setsccinteractive setscreen setshared + setsoftwareiomode setstderr setstdio setstrokeadjust setsystemparams + settransfer settrapintent setucacheparams setundercolorremoval + setuserdiskpercent setuserparams setvmthreshold shareddict show showpage + sin softwareiomode sqrt srand stack stackoverflow stackunderflow start + startjob startpage status statuscommand statusdict stop stopped store + string stringwidth stroke strokepath sub superstop superstopped + switchsetting syntaxerror system systemdict tabloidtray timeout token + transform translate true truncate type typecheck uappend ucache + ucachestatus ueofill ufill undef undefined undefinedfilename + undefinedresource undefinedresult undefinefont undefineresource + undefineuserobject unmatchedmark unregistered upath userdict + userdiskpercent usertime ustroke ustrokepath validatefont version + vmreclaim vmstatus waittimeout wcheck where widthshow write + writehexstring writeobject writestring xcheck xor xshow xyshow yshow + */ + /(\b|[\>\{\}\)\[\]\/])\ +(\$error|\.error|1(1x17tray|2x24tray|5x24tray)|=(|=|print|s(cratch|tring))\ +|FontDirectory|GlobalFontDirectory|ISOLatin1Encoding|Run|S\ +(haredFontDirectory|pecialRun|tandardEncoding)|VMerror|a(2tray|3tray\ +|4tray|5tray|bs|dd|load|n(chorsearch|d)|ppletalktype|r(c(|n|t(|o))|ray)|s\ +(how|tore)|tan|uthors|widthshow)|b(5tray|egin|i(nd|tshift)|l\ +(ackoverprint|ink)|roadsheettray|uildtime|ytesavailable)|c(achestatus|e\ +(iling|xec)|h(arpath|eck(password|screen))|l(ear(|dictstack|interrupt\ +|tomark)|ip(|path)|ose(file|path|scc))|o(lorimage|n(cat(|matrix)\ +|figurationerror)|py(|page)|s|unt(|dictstack|execstack|tomark))|show|ur\ +(rent(blackgeneration|c(acheparams|mykcolor|olor(|rendering(|intent)|s\ +(creen|pace)|transfer))|d(ash|evparams|ict|lhooks)|f(ile|lat|ont)|g(lobal\ +|ray|state)|h(alftone(|phase)|sbcolor)|interceptcolorspace|line(cap|join\ +|width)|m(atrix|iterlimit)|o(bjectformat|verprint)|p(a(cking|gedevice)\ +|oint)|r(e(lativeneutrals|productioncriteria)|gbcolor)|s(creen|eparation\ +(colornames|order)|hared|trokeadjust|ystemparams)|tra(nsfer|pintent)|u\ +(ndercolorremoval|serparams))|veto)|v(i|lit|n|r(|s)|s|x))|d(aytime|e(f(\ +|ault(blackoverprint|handleerror|m(atrix|irrorprint)|p(age(margin\ +|params)|rocesscolors)|timeouts)|ine(font|resource|userobject))|letefile|v\ +(dismount|for(all|mat)|iceinfo|mount|status))|i(ct(|full|stack(|overflow\ +|underflow))|s(ableinterrupt|k(online|status))|v)|lclearcaches|os(tartpage\ +|ysstart)|transform|up)|e(cho|e(rom|scratch|xec)|n(ableinterrupt|d(\ +|ofjob))|o(clip|fill)|q|r(asepage|ror(beep|dict))|x(ch|ec(|dict|form|stack\ +(|overflow)|u(serobject|t(eonly|ive)))|it|p(|osure)))|f(alse|i(l(e(|kind\ +|linenumber|name(|forall)|position)|l|ter)|nd(c(harstrings\ +|olorrenderingintent)|encoding|font|pgfont|resource))|l(attenpath|oor\ +|ush(|cache|file))|or(|all))|g(check|e(|nericpaper|t(|interval|known\ +|sccconfig|top(file|realfile)))|l(obaldict|yphshow)|restore(|all)|s(ave\ +|tate)|t)|ha(ndleerror|rdwareiomode)|i(d(entmatrix|iv|lefonts|transform)\ +|f(|else)|mage(|mask)|n(dex|eofill|fill|it(clip|graphics|ialized(|isk)\ +|matrix)|stroke|ter(naldict|rupt(|enabled))|u(eofill|fill|stroke)|v(alid\ +(access|exit|f(ileaccess|ont)|restore)|ertmatrix))|oerror|smanualfeed\ +|transform)|job(name|s(ource|t(ate|ring))|timeout)|k(nown|show)|l(a\ +(nguagelevel|stmode)|e(|dgertray|galtray|ngth|ttertray)|i(mitcheck|neto\ +|stfilesinestack)|n|o(ad(|currentpagedevice|setpagedevice)|g|op)|t)|m(a\ +(ke(font|pattern)|nualfeedtimeout|r(gins|k)|t(chtemplate|rix)|xlength)\ +|edia(length|size|width)|irrorprint|o(d|veto)|ul)|n(e(|g(|ativeprint)\ +|wpath)|o(access|currentpoint|t)|ull(|device))|o(penscc|r)|p(a(ckedarray\ +|ge(count|margin|params|stackorder|type)|th(bbox|forall))|op|r(int(|er\ +(error|message|name|status|upset)|object)|o(cesscolors|duct|mpt))|stack\ +|ut(|interval))|quit|r(a(msize|n(d|gecheck))|c(heck|urveto)|e(a(d(\ +|hexstring|line|only|string)|ltime)|ct(clip|fill|stroke)|namefile|peat|s\ +(et(file|printer)|o(lution|urce(forall|status))|tore)|v(ersepath|ision))\ +|lineto|moveto|o(ll|otfont|tate|und)|rand|un)|s(ave|c(ale(|font)|c(batch\ +|files|interactive)|heck|reenforall)|e(arch|lectfont|nd(ctrld|p(cmd\ +|rinterstate))|r(ialnumber|verdict)|t(accuratescreens|b(box|l(ack\ +(generation|overprint)|ink))|c(ache(device(|2)|limit|params)|harwidth\ +|mykcolor|olor(|rendering(|intent)|s(creen|pace)|transfer))|d(ash|e(fault\ +(blackoverprint|mirrorprint|p(age(margin|params)|rocesscolors)|timeouts)\ +|vparams)|lhooks|os(tartpage|ysstart))|e(escratch|xposure)|f(ileposition\ +|lat|ont)|g(lobal|ray|state)|h(a(lftone(|phase)|rdwareiomode)|sbcolor)|i\ +(dlefonts|nterceptcolorspace)|jobtimeout|line(cap|join|width)|m(a(rgins\ +|trix)|i(rrorprint|terlimit))|negativeprint|o(bjectformat|verprint)|p(a\ +(cking|ge(|device|margin|params|s(een|tackorder)|type)|ssword|ttern)|r\ +(intername|ocesscolors))|r(e(lativeneutrals|productioncriteria|solution)\ +|gbcolor)|s(c(c(batch|config|interactive)|reen)|hared|oftwareiomode|t(d\ +(err|io)|rokeadjust)|ystemparams)|tra(nsfer|pintent)|u(cacheparams\ +|ndercolorremoval|ser(diskpercent|params))|vmthreshold))|h(areddict|ow(\ +|page))|in|oftwareiomode|qrt|rand|t(a(ck(|overflow|underflow)|rt(|job\ +|page)|tus(|command|dict))|o(p(|ped)|re)|r(ing(|width)|oke(|path)))|u(b\ +|perstop(|ped))|witchsetting|y(ntaxerror|stem(|dict)))|t(abloidtray|imeout\ +|oken|r(ans(form|late)|u(e|ncate))|ype(|check))|u(append|cache(|status)\ +|eofill|fill|n(def(|ine(d(|filename|res(ource|ult))|font|resource\ +|userobject))|matchedmark|registered)|path|s(er(di(ct|skpercent)|time)\ +|troke(|path)))|v(alidatefont|ersion|m(reclaim|status))|w(aittimeout|check\ +|here|idthshow|rite(|hexstring|object|string))|x(check|or|show|yshow)\ +|yshow)\ +(\b|[\<\{\}\(\[\]\/])/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: python + * Description: Python programming language. + * Author: Andy Eskilsson + */ + +state python_string +{ + /\\\\./ { + language_print ($0); + } + python_string_end { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state python +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /#/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + /* Python strings */ + /(\"\"\"|[\'][\'][\'])/ { + python_string_end = regexp($0); + string_face (true); + language_print ($0); + call (python_string); + string_face (false); + } + + /(\"|[\'])/ { + python_string_end = regexp( $0 ); + string_face (true); + language_print ($0); + call (python_string); + string_face (false); + } + + + /* Function */ + /([ \t]*)(def)([ \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); + } + + /* Keywords */ +/\\b(a(nd|ssert)|break|c(lass|ontinue)|de(f|l)\\ +|e(l(if|se(|:))|x(cept(|:)|ec))|f(inally:|or|rom)|global\\ +|i(f|mport|n|s)|lambda|not|or|p(ass|rint)|r(aise|eturn)|try:|while)\\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); +} + + LANGUAGE_SPECIALS { + language_print ($0); + } + +} + + +/** + * Name: scheme + * Description: Scheme programming language. + * Author: Markku Rossi + */ + +state scheme +{ + BEGIN { + header (); + if (need_version (1, 5, 2)) + { + /* + * Modify regexp character syntax so that we can distinguish all + * scheme symbols. + */ + extras = list ('!', '$', '%', '&', '*', '/', ':', '<', + '=', '>', '?', '~', '^', '.', '+', '-'); + for (i = 0; i < length (extras); i = i + 1) + regexp_syntax (extras[i], 'w'); + } + } + END { + trailer (); + } + + /* Comments. */ + /;/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Definitions. */ + /(\([ \t]*)(define)([ \t]+\(?)([!\$%&\*\/:<=>\?~_^a-zA-Z][!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ { + /* Starting garbage. */ + language_print ($1); + + /* Keyword `define'. */ + keyword_face (true); + language_print ($2); + keyword_face (false); + + /* Middle garbage. */ + language_print ($3); + + /* Function name. */ + function_name_face (true); + language_print ($4); + function_name_face (false); + } + + /* ':'-names, Emacs highlights these, so do we. */ + /([ \t])(:[!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ { + language_print ($1); + reference_face (true); + language_print ($2); + reference_face (false); + } + + /* Keywords. + "=>" + "set!" + + (build-re '(else define unquote unquote-splicing quote lambda + if begin cond and or case let let* letrec do delay quasiquote)) + */ + /=>|\bset!|\b(and|begin|c(ase|ond)|d(e(fine|lay)|o)|else|if\ +|l(ambda|et(|\*|rec))|or|qu(asiquote|ote)|unquote(|-splicing))\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: sh + * Description: Bourne shell programming language. + * Author: Juergen Kahrs + */ + +state sh +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /#/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Excutable script. */ + /^#!/ { + reference_face (true); + language_print ($0); + call (eat_one_line); + reference_face (false); + } + + /* Keywords. */ + /\b(CDPATH|HOME|IFS|MAIL((CHECK)?|(PATH)?)|P(ATH|S(1|2))|SH(ACCT|ELL)|\ +break|c(ase|d|ontinue)|do(ne)?|e(cho|lse|sac|val|x(ec|it|port))|f(i|or)|\ +getopts|hash|i[fn]|limit|newgrp|pwd|re(ad(only)?|turn)|s(et|hift)|\ +t(est|hen|imes|rap|ype)|u(limit|mask|n(limit|set))|w(ait|hile))\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: sql + * Description: Sybase 11 SQL. + * Author: Chris Jack + */ + +state sql_comment +{ + /\\\/\*/ { + language_print ($0); + call (sql_comment); + } + /\*\\\// { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state sql_string +{ + /\\\\./ { + language_print ($0); + } + /[\']/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state sql +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (sql_comment); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Character constants. */ + /[\']/ { + string_face (true); + language_print ($0); + call (sql_string); + string_face (false); + } + + /* Keywords. + */ + /\b(\ +[Aa][Bb][Ss]|\ +[Aa][Cc][Oo][Ss]|\ +[Aa][Dd][Dd]|\ +[Aa][Ll][Ll]|\ +[Aa][Ll][Ll][Oo][Ww]_[Dd][Uu][Pp]_[Rr][Oo][Ww]|\ +[Aa][Ll][Tt][Ee][Rr]|\ +[Aa][Nn][Dd]|\ +[Aa][Nn][Ss][Ii][Nn][Uu][Ll][Ll]|\ +[Aa][Nn][Ss][Ii]_[Pp][Ee][Rr][Mm][Ii][Ss][Ss][Ii][Oo][Nn][Ss]|\ +[Aa][Nn][Yy]|\ +[Aa][Rr][Ii][Tt][Hh]_[Oo][Vv][Ee][Rr][Ff][Ll][Oo][Ww]|\ +[Aa][Rr][Ii][Tt][Hh][Aa][Bb][Oo][Rr][Tt]|\ +[Aa][Rr][Ii][Tt][Hh][Ii][Gg][Nn][Oo][Rr][Ee]|\ +[Aa][Ss]|\ +[Aa][Ss][Cc]|\ +[Aa][Ss][Cc][Ii][Ii]|\ +[Aa][Ss][Ii][Nn]|\ +[Aa][Tt]|\ +[Aa][Tt][Aa][Nn]|\ +[Aa][Tt][Nn]2|\ +[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn]|\ +[Aa][Uu][Tt][Oo]|\ +[Aa][Vv][Gg]|\ +[Bb][Ee][Gg][Ii][Nn]|\ +[Bb][Ee][Tt][Ww][Ee][Ee][Nn]|\ +[Bb][Ii][Nn][Aa][Rr][Yy]|\ +[Bb][Rr][Ee][Aa][Kk]|\ +[Bb][Rr][Oo][Ww][Ss][Ee]|\ +[Bb][Uu][Ll][Kk]|\ +[Bb][Uu][Ll][Kk][Cc][Oo][Pp][Yy]|\ +[Bb][Yy]|\ +[Cc][Aa][Ss][Cc][Aa][Dd][Ee]|\ +[Cc][Ee][Ii][Ll][Ii][Nn][Gg]|\ +[Cc][Hh][Aa][Ii][Nn][Ee][Dd]|\ +[Cc][Hh][Aa][Rr]|\ +[Cc][Hh][Aa][Rr]_[Cc][Oo][Nn][Vv][Ee][Rr][Tt]|\ +[Cc][Hh][Aa][Rr]_[Ll][Ee][Nn][Gg][Tt][Hh]|\ +[Cc][Hh][Aa][Rr][Aa][Cc][Tt][Ee][Rr]|\ +[Cc][Hh][Aa][Rr][Ii][Nn][Dd][Ee][Xx]|\ +[Cc][Hh][Ee][Cc][Kk]|\ +[Cc][Hh][Ee][Cc][Kk][Pp][Oo][Ii][Nn][Tt]|\ +[Cc][Ll][Oo][Ss][Ee]|\ +[Cc][Ll][Uu][Ss][Tt][Ee][Rr][Ee][Dd]|\ +[Cc][Oo][Ll]_[Ll][Ee][Nn][Gg][Tt][Hh]|\ +[Cc][Oo][Ll]_[Nn][Aa][Mm][Ee]|\ +[Cc][Oo][Mm][Mm][Ii][Tt]|\ +[Cc][Oo][Mm][Pp][Uu][Tt][Ee]|\ +[Cc][Oo][Nn][Ff][Ii][Rr][Mm]|\ +[Cc][Oo][Nn][Ss][Tt][Rr][Aa][Ii][Nn][Tt]|\ +[Cc][Oo][Nn][Tt][Ii][Nn][Uu][Ee]|\ +[Cc][Oo][Nn][Tt][Rr][Oo][Ll][Rr][Oo][Ww]|\ +[Cc][Oo][Nn][Vv][Ee][Rr][Tt]|\ +[Cc][Oo][Ss]|\ +[Cc][Oo][Tt]|\ +[Cc][Oo][Uu][Nn][Tt]|\ +[Cc][Rr][Ee][Aa][Tt][Ee]|\ +[Cc][Uu][Rr][Rr][Ee][Nn][Tt]|\ +[Cc][Uu][Rr][Ss][Oo][Rr]|\ +[Cc][Uu][Rr][Uu][Nn][Rr][Ee][Ss][Ee][Rr][Vv][Ee][Dd][Pp][Gg][Ss]|\ +[Dd][Aa][Tt][Aa]_[Pp][Gg][Ss]|\ +[Dd][Aa][Tt][Aa][Bb][Aa][Ss][Ee]|\ +[Dd][Aa][Tt][Aa][Ll][Ee][Nn][Gg][Tt][Hh]|\ +[Dd][Aa][Tt][Ee][Aa][Dd][Dd]|\ +[Dd][Aa][Tt][Ee][Dd][Ii][Ff][Ff]|\ +[Dd][Aa][Tt][Ee][Ff][Ii][Rr][Ss][Tt]|\ +[Dd][Aa][Tt][Ee][Ff][Oo][Rr][Mm][Aa][Tt]|\ +[Dd][Aa][Tt][Ee][Nn][Aa][Mm][Ee]|\ +[Dd][Aa][Tt][Ee][Pp][Aa][Rr][Tt]|\ +[Dd][Aa][Tt][Ee][Tt][Ii][Mm][Ee]|\ +[Dd][Bb]_[Ii][Dd]|\ +[Dd][Bb]_[Nn][Aa][Mm][Ee]|\ +[Dd][Bb][Cc][Cc]|\ +[Dd][Ee][Aa][Ll][Ll][Oo][Cc][Aa][Tt][Ee]|\ +[Dd][Ee][Cc][Ii][Mm][Aa][Ll]|\ +[Dd][Ee][Cc][Ll][Aa][Rr][Ee]|\ +[Dd][Ee][Ff][Aa][Uu][Ll][Tt]|\ +[Dd][Ee][Ff][Ii][Nn][Ee]|\ +[Dd][Ee][Gg][Rr][Ee][Ee][Ss]|\ +[Dd][Ee][Ll][Ee][Tt][Ee]|\ +[Dd][Ee][Ss][Cc]|\ +[Dd][Ii][Ff][Ff][Ee][Rr][Ee][Nn][Cc][Ee]|\ +[Dd][Ii][Ss][Kk]|\ +[Dd][Ii][Ss][Tt][Ii][Nn][Cc][Tt]|\ +[Dd][Oo][Uu][Bb][Ll][Ee]|\ +[Dd][Rr][Oo][Pp]|\ +[Dd][Uu][Mm][Mm][Yy]|\ +[Dd][Uu][Mm][Pp]|\ +[Ee][Ll][Ss][Ee]|\ +[Ee][Nn][Dd]|\ +[Ee][Nn][Dd][Tt][Rr][Aa][Nn]|\ +[Ee][Rr][Rr][Ll][Vv][Ll]|\ +[Ee][Rr][Rr][Oo][Rr]|\ +[Ee][Rr][Rr][Oo][Rr][Dd][Aa][Tt][Aa]|\ +[Ee][Rr][Rr][Oo][Rr][Ee][Xx][Ii][Tt]|\ +[Ee][Ss][Cc][Aa][Pp][Ee]|\ +[Ee][Xx][Cc][Ee][Pp][Tt]|\ +[Ee][Xx][Ee][Cc][Uu][Tt][Ee]|\ +[Ee][Xx][Ii][Ss][Tt][Ss]|\ +[Ee][Xx][Ii][Tt]|\ +[Ee][Xx][Pp]|\ +[Ff][Ee][Tt][Cc][Hh]|\ +[Ff][Ii][Ll][Ll][Ff][Aa][Cc][Tt][Oo][Rr]|\ +[Ff][Ii][Pp][Ss][Ff][Ll][Aa][Gg][Gg][Ee][Rr]|\ +[Ff][Ll][Oo][Aa][Tt]|\ +[Ff][Ll][Oo][Oo][Rr]|\ +[Ff][Ll][Uu][Ss][Hh][Mm][Ee][Ss][Ss][Aa][Gg][Ee]|\ +[Ff][Oo][Rr]|\ +[Ff][Oo][Rr][Ee][Ii][Gg][Nn]|\ +[Ff][Rr][Oo][Mm]|\ +[Gg][Ee][Tt][Dd][Aa][Tt][Ee]|\ +[Gg][Oo][Tt][Oo]|\ +[Gg][Rr][Aa][Nn][Tt]|\ +[Gg][Rr][Oo][Uu][Pp]|\ +[Hh][Aa][Vv][Ii][Nn][Gg]|\ +[Hh][Ee][Xx][Tt][Oo][Ii][Nn][Tt]|\ +[Hh][Oo][Ll][Dd][Ll][Oo][Cc][Kk]|\ +[Hh][Oo][Ss][Tt]_[Nn][Aa][Mm][Ee]|\ +[Ii][Dd][Ee][Nn][Tt][Ii][Tt][Yy]|\ +[Ii][Dd][Ee][Nn][Tt][Ii][Tt][Yy]_[Ii][Nn][Ss][Ee][Rr][Tt]|\ +[Ii][Ff]|\ +[Ii][Gg][Nn][Oo][Rr][Ee]_[Dd][Uu][Pp]_[Kk][Ee][Yy]|\ +[Ii][Gg][Nn][Oo][Rr][Ee]_[Dd][Uu][Pp]_[Rr][Oo][Ww]|\ +[Ii][Mm][Aa][Gg][Ee]|\ +[Ii][Nn]|\ +[Ii][Nn][Dd][Ee][Xx]|\ +[Ii][Nn][Dd][Ee][Xx]_[Cc][Oo][Ll]|\ +[Ii][Nn][Ss][Ee][Rr][Tt]|\ +[Ii][Nn][Tt]|\ +[Ii][Nn][Tt][Ee][Gg][Ee][Rr]|\ +[Ii][Nn][Tt][Ee][Rr][Ss][Ee][Cc][Tt]|\ +[Ii][Nn][Tt][Oo]|\ +[Ii][Nn][Tt][Tt][Oo][Hh][Ee][Xx]|\ +[Ii][Oo]|\ +[Ii][Ss]|\ +[Ii][Ss][Nn][Uu][Ll][Ll]|\ +[Ii][Ss][Oo][Ll][Aa][Tt][Ii][Oo][Nn]|\ +[Kk][Ee][Yy]|\ +[Kk][Ii][Ll][Ll]|\ +[Ll][Aa][Nn][Gg][Uu][Aa][Gg][Ee]|\ +[Ll][Cc][Tt]_[Aa][Dd][Mm][Ii][Nn]|\ +[Ll][Ee][Vv][Ee][Ll]|\ +[Ll][Ii][Kk][Ee]|\ +[Ll][Ii][Nn][Ee][Nn][Oo]|\ +[Ll][Oo][Aa][Dd]|\ +[Ll][Oo][Gg]|\ +[Ll][Oo][Gg]10|\ +[Ll][Oo][Ww][Ee][Rr]|\ +[Ll][Rr][Uu]|\ +[Ll][Tt][Rr][Ii][Mm]|\ +[Mm][Aa][Xx]|\ +[Mm][Ii][Nn]|\ +[Mm][Ii][Rr][Rr][Oo][Rr]|\ +[Mm][Ii][Rr][Rr][Oo][Rr][Ee][Xx][Ii][Tt]|\ +[Mm][Oo][Nn][Ee][Yy]|\ +[Mm][Rr][Uu]|\ +[Nn][Aa][Tt][Ii][Oo][Nn][Aa][Ll]|\ +[Nn][Cc][Hh][Aa][Rr]|\ +[Nn][Oo]_[Ee][Rr][Rr][Oo][Rr]|\ +[Nn][Oo][Cc][Oo][Uu][Nn][Tt]|\ +[Nn][Oo][Ee][Xx][Ee][Cc]|\ +[Nn][Oo][Hh][Oo][Ll][Dd][Ll][Oo][Cc][Kk]|\ +[Nn][Oo][Nn][Cc][Ll][Uu][Ss][Tt][Ee][Rr][Ee][Dd]|\ +[Nn][Oo][Tt]|\ +[Nn][Uu][Ll][Ll]|\ +[Nn][Uu][Mm][Ee][Rr][Ii][Cc]|\ +[Nn][Uu][Mm][Ee][Rr][Ii][Cc]_[Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ii][Oo][Nn]|\ +[Nn][Vv][Aa][Rr][Cc][Hh][Aa][Rr]|\ +[Oo][Bb][Jj][Ee][Cc][Tt]_[Ii][Dd]|\ +[Oo][Bb][Jj][Ee][Cc][Tt]_[Nn][Aa][Mm][Ee]|\ +[Oo][Ff]|\ +[Oo][Ff][Ff]|\ +[Oo][Ff][Ff][Ss][Ee][Tt][Ss]|\ +[Oo][Nn]|\ +[Oo][Nn][Cc][Ee]|\ +[Oo][Nn][Ll][Yy]|\ +[Oo][Pp][Ee][Nn]|\ +[Oo][Pp][Tt][Ii][Oo][Nn]|\ +[Oo][Rr]|\ +[Oo][Rr][Dd][Ee][Rr]|\ +[Oo][Vv][Ee][Rr]|\ +[Pp][Aa][Rr][Aa][Mm]|\ +[Pp][Aa][Rr][Ss][Ee][Oo][Nn][Ll][Yy]|\ +[Pp][Aa][Tt][Ii][Nn][Dd][Ee][Xx]|\ +[Pp][Ee][Rr][Mm][Aa][Nn][Ee][Nn][Tt]|\ +[Pp][Ii]|\ +[Pp][Ll][Aa][Nn]|\ +[Pp][Oo][Ww][Ee][Rr]|\ +[Pp][Rr][Ee][Cc][Ii][Ss][Ii][Oo][Nn]|\ +[Pp][Rr][Ee][Ff][Ee][Tt][Cc][Hh]|\ +[Pp][Rr][Ee][Pp][Aa][Rr][Ee]|\ +[Pp][Rr][Ii][Mm][Aa][Rr][Yy]|\ +[Pp][Rr][Ii][Nn][Tt]|\ +[Pp][Rr][Ii][Vv][Ii][Ll][Ee][Gg][Ee][Ss]|\ +[Pp][Rr][Oo][Cc]|\ +[Pp][Rr][Oo][Cc][Ii][Dd]|\ +[Pp][Rr][Oo][Cc]_[Rr][Oo][Ll][Ee]|\ +[Pp][Rr][Oo][Cc][Ee][Dd][Uu][Rr][Ee]|\ +[Pp][Rr][Oo][Cc][Ee][Ss][Ss][Ee][Xx][Ii][Tt]|\ +[Pp][Uu][Bb][Ll][Ii][Cc]|\ +[Qq][Uu][Oo][Tt][Ee][Dd]_[Ii][Dd][Ee][Nn][Tt][Ii][Ff][Ii][Ee][Rr]|\ +[Rr][Aa][Dd][Ii][Aa][Nn][Ss]|\ +[Rr][Aa][Ii][Ss][Ee][Rr][Rr][Oo][Rr]|\ +[Rr][Aa][Nn][Dd]|\ +[Rr][Ee][Aa][Dd]|\ +[Rr][Ee][Aa][Dd][Tt][Ee][Xx][Tt]|\ +[Rr][Ee][Aa][Ll]|\ +[Rr][Ee][Cc][Oo][Nn][Ff][Ii][Gg][Uu][Rr][Ee]|\ +[Rr][Ee][Ff][Ee][Rr][Ee][Nn][Cc][Ee][Ss]|\ +[Rr][Ee][Pp][Ll][Aa][Cc][Ee]|\ +[Rr][Ee][Pp][Ll][Ii][Cc][Aa][Tt][Ee]|\ +[Rr][Ee][Ss][Ee][Rr][Vv][Ee][Dd]_[Pp][Gg][Ss]|\ +[Rr][Ee][Ss][Tt][Rr][Ee][Ee]|\ +[Rr][Ee][Tt][Uu][Rr][Nn]|\ +[Rr][Ee][Vv][Ee][Rr][Ss][Ee]|\ +[Rr][Ee][Vv][Oo][Kk][Ee]|\ +[Rr][Ii][Gg][Hh][Tt]|\ +[Rr][Oo][Ll][Ee]|\ +[Rr][Oo][Ll][Ll][Bb][Aa][Cc][Kk]|\ +[Rr][Oo][Uu][Nn][Dd]|\ +[Rr][Oo][Ww][Cc][Nn][Tt]|\ +[Rr][Oo][Ww][Cc][Oo][Uu][Nn][Tt]|\ +[Rr][Oo][Ww][Ss]|\ +[Rr][Tt][Rr][Ii][Mm]|\ +[Rr][Uu][Ll][Ee]|\ +[Ss][Aa][Vv][Ee]|\ +[Ss][Cc][Hh][Ee][Mm][Aa]|\ +[Ss][Ee][Ll][Ee][Cc][Tt]|\ +[Ss][Ee][Ll][Ff]_[Rr][Ee][Cc][Uu][Rr][Ss][Ii][Oo][Nn]|\ +[Ss][Ee][Tt]|\ +[Ss][Ee][Tt][Uu][Ss][Ee][Rr]|\ +[Ss][Hh][Aa][Rr][Ee][Dd]|\ +[Ss][Hh][Oo][Ww]_[Rr][Oo][Ll][Ee]|\ +[Ss][Hh][Oo][Ww][Pp][Ll][Aa][Nn]|\ +[Ss][Hh][Uu][Tt][Dd][Oo][Ww][Nn]|\ +[Ss][Ii][Gg][Nn]|\ +[Ss][Ii][Nn]|\ +[Ss][Mm][Aa][Ll][Ll][Dd][Aa][Tt][Ee][Tt][Ii][Mm][Ee]|\ +[Ss][Mm][Aa][Ll][Ll][Ii][Nn][Tt]|\ +[Ss][Mm][Aa][Ll][Ll][Mm][Oo][Nn][Ee][Yy]|\ +[Ss][Oo][Uu][Nn][Dd][Ee][Xx]|\ +[Ss][Pp][Aa][Cc][Ee]|\ +[Ss][Qq][Rr][Tt]|\ +[Ss][Tt][Aa][Tt][Ee][Mm][Ee][Nn][Tt]|\ +[Ss][Tt][Aa][Tt][Ii][Ss][Tt][Ii][Cc][Ss]|\ +[Ss][Tt][Rr]|\ +[Ss][Tt][Rr][Ii][Nn][Gg]_[Rr][Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ii][Oo][Nn]|\ +[Ss][Tt][Rr][Ii][Pp][Ee]|\ +[Ss][Tt][Uu][Ff][Ff]|\ +[Ss][Uu][Bb][Qq][Uu][Ee][Rr][Yy][Cc][Aa][Cc][Hh][Ee]|\ +[Ss][Uu][Bb][Ss][Tt][Rr][Ii][Nn][Gg]|\ +[Ss][Uu][Mm]|\ +[Ss][Uu][Ss][Ee][Rr]_[Ii][Dd]|\ +[Ss][Uu][Ss][Ee][Rr]_[Nn][Aa][Mm][Ee]|\ +[Ss][Yy][Bb]_[Ii][Dd][Ee][Nn][Tt][Ii][Tt][Yy]|\ +[Tt][Aa][Bb][Ll][Ee]|\ +[Tt][Aa][Nn]|\ +[Tt][Ee][Mm][Pp][Oo][Rr][Aa][Rr][Yy]|\ +[Tt][Ee][Rr][Mm][Ii][Nn][Aa][Tt][Ee]|\ +[Tt][Ee][Xx][Tt]|\ +[Tt][Ee][Xx][Tt][Ss][Ii][Zz][Ee]|\ +[Tt][Ii][Mm][Ee]|\ +[Tt][Ii][Nn][Yy][Ii][Nn][Tt]|\ +[Tt][Oo]|\ +[Tt][Rr][Aa][Nn][Ss][Aa][Cc][Tt][Ii][Oo][Nn]|\ +[Tt][Rr][Ii][Gg][Gg][Ee][Rr]|\ +[Tt][Rr][Uu][Nn][Cc][Aa][Tt][Ee]|\ +[Tt][Ss][Ee][Qq][Uu][Aa][Ll]|\ +[Uu][Nn][Ii][Oo][Nn]|\ +[Uu][Nn][Ii][Qq][Uu][Ee]|\ +[Uu][Pp][Dd][Aa][Tt][Ee]|\ +[Uu][Pp][Pp][Ee][Rr]|\ +[Uu][Ss][Ee]|\ +[Uu][Ss][Ee][Dd]_[Pp][Gg][Ss]|\ +[Uu][Ss][Ee][Rr]|\ +[Uu][Ss][Ee][Rr]_[Ii][Dd]|\ +[Uu][Ss][Ee][Rr]_[Nn][Aa][Mm][Ee]|\ +[Uu][Ss][Ee][Rr]_[Oo][Pp][Tt][Ii][Oo][Nn]|\ +[Uu][Ss][Ii][Nn][Gg]|\ +[Vv][Aa][Ll][Ii][Dd]_[Nn][Aa][Mm][Ee]|\ +[Vv][Aa][Ll][Ii][Dd]_[Uu][Ss][Ee][Rr]|\ +[Vv][Aa][Ll][Uu][Ee][Ss]|\ +[Vv][Aa][Rr][Bb][Ii][Nn][Aa][Rr][Yy]|\ +[Vv][Aa][Rr][Cc][Hh][Aa][Rr]|\ +[Vv][Aa][Rr][Yy][Ii][Nn][Gg]|\ +[Vv][Ii][Ee][Ww]|\ +[Ww][Aa][Ii][Tt][Ff][Oo][Rr]|\ +[Ww][Hh][Ee][Rr][Ee]|\ +[Ww][Hh][Ii][Ll][Ee]|\ +[Ww][Ii][Tt][Hh]|\ +[Ww][Oo][Rr][Kk]|\ +[Ww][Rr][Ii][Tt][Ee][Tt][Ee][Xx][Tt]\ +)\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + + +/** + * Name: states + * Description: States program's definition files. + * Author: Markku Rossi + */ + +state states_regexp +{ + /\\\\./ { + language_print ($0); + } + /\// { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state states +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Regular expressions. */ + /\\\// { + string_face (true); + language_print ($0); + call (states_regexp); + string_face (false); + } + + /* Subroutine definitions. */ + /\b(sub)([ \t]+)([$a-zA-Z_][$a-zA-Z_0-9]*)([ \t]*\()/ { + keyword_face (true); + language_print ($1); + keyword_face (false); + + language_print ($2); + + function_name_face (true); + language_print ($3); + function_name_face (false); + + language_print ($4); + } + + /* Keywords. + (build-re '(BEGIN END div else for if local namerules return start + startrules state sub while)) + */ + /\b(BEGIN|END|div|else|for|if|local|namerules|return\ +|s(ta(rt(|rules)|te)|ub)|while)\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + /* Build-ins: + (build-re '(call check_namerules check_startrules concat getenv int + length list panic prereq print regmatch regsub regsuball sprintf + strcmp string strncmp substring)) + */ + /\b(c(all|heck_(namerules|startrules)|oncat)|getenv|int|l(ength|ist)\ +|p(anic|r(ereq|int))|reg(match|sub(|all))\ +|s(printf|tr(cmp|ing|ncmp)|ubstring))([ \t]*\()/ { + builtin_face (true); + language_print ($1); + builtin_face (false); + language_print (substring ($0, length ($1), length ($0))); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: synopsys + * Description: Synopsys dc shell scripting language + * + * Author: Brian Silveira (brian@nortel.ca) + * Hartley Horwitz (hars@nortel.ca) + */ +state synopsys +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* + * Synopsys allows globing...so pick out constructs like + * /foo/bar/* and just print them out. i.e. don't treat the + * ending like a comment! + */ + /[A-z0-9_-]\/\*/{ + language_print($0); + } + + + /* Comments. + * Synopsys DC-shell uses C-style comments + */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* I use make-regexp in emacs which uses a list of strings to + generate a regular expression. + (setq synopsys-keywords-enscript + '("alias" "all_connected" "analyze" "balance_buffer" + "balance_registers" "break" "cd" "change_link" "change_names" + "characterize" "check_design" "check_test" "check_timing" + "continue" "compile" "copy_design" "create_clock" "drive_of" + "echo" "elaborate" "else" "exit" "get_attribute" "get_license" + "get_unix_variable" "group" "group_path" "include" + "insert_scan" "insert_test" "link" "list_designs" + "list_instances" "list_libs" "load_of" "quit" "read" + "read_lib" "read_timing" "remove_attribute" + "remove_constraint" "remove_design" "remove_input_delay" + "remove_lib" "remove_clock" "remove_cell" "remove_license" + "remove_output_delay" "remove_unconnected_ports" + "rename_design" "reoptimize_design" "report_area" + "report_attribute" "report_cell" "report_constraint" + "report_design" "report_design_lib" "report_hierarchy" + "report_internal_loads" "report_lib" "report_multicycles" + "report_net" "report_port" "report_power" "report_reference" + "report_resources" "report_test" "report_timing" + "reset_design" "set_attribute" "set_boundary_optimization" + "set_clock_skew" "set_dont_touch" "set_dont_touch_network" + "set_dont_use" "set_drive" "set_driving_cell" "set_equal" + "set_disable_timing" "set_false_path" "set_flatten" + "set_implementation" "set_fix_hold" "set_input_delay" + "set_load" "set_logic_one" "set_logic_zero" "set_max_area" + "set_max_capacitance" "set_max_fanout" "set_max_transition" + "set_multicycle_path" "set_operating_conditions" + "set_output_delay" "set_scan_style" "set_signal_type" + "set_structure" "set_test_methodology" "set_unconnected" + "set_wire_load" "unalias" "sh" "ungroup" "uniquify" + "update_lib" "which" "write" "write_constraints" + "write_script" "write_timing" "if" "foreach" "find" "while" + "-all" "-all_violators" "-allowed" "-attributes" "-base_name" + "-boundary_optimization" "-cell" "-cell_name" "-clock" + "-context" "-connections" "-constraints" "-delay" "-design" + "-design_name" "-depth" "-drive" "-except" "-f" "-fall_delay" + "-flat" "-format" "-from" "-hierarchy" "-hier" "-hold" + "-incremental_mapping" "-ideal" "-ignored" "-in_place" + "-logic" "-library" "-map_effort" "-mode" "-max_paths" + "-max_scan_chain_length" "-no_disable" "-methodology" "-name" + "-net" "-new_name" "-none" "-nosplit" "-nworst" "-output" + "-path" "-parameters" "-period" "-pin_load" "-propagated" + "-reference" "-rise_delay" "-rules" "-skew" "-setup" + "-through" "-to" "-type" "-uncertainty" "-plus_uncertainty" + "-minus_uncertainty" "-update" "-verify" "-verbose" + "-waveform" "-wire_load" "-work" "-weight" "-worst" + "actel_qbar_opto" "actel_seq_opto" "auto_link_disable" + "auto_link_options" "auto_wire_load_selection" + "bc_enable_chaining" "bc_enable_multi_cycle" + "bc_enable_speculative_execution" "bc_fsm_coding_style" + "bc_time_all_sequential_op_bindings" "bus_extraction_style" + "bus_inference_style" "bus_naming_style" + "change_names_dont_change_bus_members" + "change_names_update_inst_tree" "command_log_file" "company" + "compatibility_version" + "compile_assume_fully_decoded_three_state_busses" + "compile_create_mux_op_hierarchy" + "compile_default_critical_range" + "compile_disable_area_opt_during_inplace_opt" + "compile_disable_hierarchical_inverter_opt" + "compile_dont_touch_annotated_cell_during_inplace_opt" + "compile_fix_multiple_port_nets" + "compile_ignore_area_during_inplace_opt" + "compile_ignore_footprint_during_inplace_opt" + "compile_implementation_selection" + "compile_inplace_changed_list_file_name" + "compile_instance_name_prefix" "compile_instance_name_suffix" + "compile_mux_no_boundary_optimization" + "compile_negative_logic_methodology" + "compile_no_new_cells_at_top_level" + "compile_ok_to_buffer_during_inplace_opt" + "compile_preserve_subdesign_interfaces" + "compile_preserve_sync_resets" + "compile_update_annotated_delays_during_inplace_opt" + "compile_use_fast_delay_mode" "compile_use_low_timing_effort" + "context_check_status" "current_design" "current_instance" + "dc_shell_status" "default_name_rules" "design_library_file" + "designer" "duplicate_ports" "echo_include_commands" + "enable_page_mode" "exit_delete_filename_log_file" + "filename_log_file" "find_converts_name_lists" + "find_ignore_case" "hdl_keep_licenses" "hdl_naming_threshold" + "hdl_preferred_license" "hdl_variables" + "hdlin_advisor_directory" "hdlin_auto_save_templates" + "hdlin_check_no_latch" + "hdlin_dont_infer_mux_for_resource_sharing" + "hdlin_enable_advisor" "hdlin_ff_always_async_set_reset" + "hdlin_ff_always_sync_set_reset" "hdlin_files" + "hdlin_hide_resource_line_numbers" "hdlin_infer_mux" + "hdlin_keep_feedback" "hdlin_keep_inv_feedback" + "hdlin_mux_size_limit" "hdlin_reg_report_length" + "hdlin_replace_synthetic" "hdlin_report_inferred_modules" + "hdlin_resource_allocation" "hdlin_resource_implementation" + "hdlin_source_to_gates_mode" "hdlin_sync_set_reset" + "hdlin_synch_set_reset" "hdlin_translate_off_skip_text" + "link_force_case" "link_library" + "port_complement_naming_style" + "reoptimize_design_changed_list_file_name" + "sdfin_fall_cell_delay_type" "sdfin_fall_net_delay_type" + "sdfin_min_fall_cell_delay" "sdfin_min_fall_net_delay" + "sdfin_min_rise_cell_delay" "sdfin_min_rise_net_delay" + "sdfin_rise_cell_delay_type" "sdfin_rise_net_delay_type" + "sdfin_top_instance_name" + "sdfout_allow_non_positive_constraints" + "sdfout_min_fall_cell_delay" "sdfout_min_fall_net_delay" + "sdfout_min_rise_cell_delay" "sdfout_min_rise_net_delay" + "sdfout_time_scale" "sdfout_top_instance_name" + "sdfout_write_to_output" "search_path" "shell_prompt" + "suppress_errors" "synlib_dont_get_license" + "syntax_check_status" "synthetic_library" "target_library" + "uniquify_naming_style" "verbose_messages")) + */ + + /\ba(l(ias|l_connected)|nalyze|uto_(link_(disable|options)\ +|wire_load_selection))|b(alance_(buffer|registers)\ +|c_(enable_(chaining|multi_cycle|speculative_execution)\ +|fsm_coding_style|time_all_sequential_op_bindings)|reak\ +|us_(extraction_style|inference_style|naming_style))\ +|c(d|h(a(nge_(link|names(|_(dont_change_bus_members|update_inst_tree)))\ +|racterize)|eck_(design|t(est|iming)))|o(m(mand_log_file|p(a(ny\ +|tibility_version)|ile(|_(assume_fully_decoded_three_state_busses\ +|create_mux_op_hierarchy|d(efault_critical_range\ +|isable_(area_opt_during_inplace_opt|hierarchical_inverter_opt)\ +|ont_touch_annotated_cell_during_inplace_opt)|fix_multiple_port_nets\ +|i(gnore_(area_during_inplace_opt|footprint_during_inplace_opt)\ +|mplementation_selection|n(place_changed_list_file_name\ +|stance_name_(prefix|suffix)))|mux_no_boundary_optimization\ +|n(egative_logic_methodology|o_new_cells_at_top_level)\ +|ok_to_buffer_during_inplace_opt|preserve_s(ubdesign_interfaces\ +|ync_resets)|u(pdate_annotated_delays_during_inplace_opt\ +|se_(fast_delay_mode|low_timing_effort))))))|nt(ext_check_status|inue)\ +|py_design)|reate_clock|urrent_(design|instance))|d(c_shell_status\ +|e(fault_name_rules|sign(_library_file|er))|rive_of|uplicate_ports)|e(cho(\ +|_include_commands)|l(aborate|se)|nable_page_mode|xit(\ +|_delete_filename_log_file))|f(i(lename_log_file|nd(|_(converts_name_lists\ +|ignore_case)))|oreach)|g(et_(attribute|license|unix_variable)|roup(\ +|_path))|hdl(_(keep_licenses|naming_threshold|preferred_license|variables)\ +|in_(a(dvisor_directory|uto_save_templates)|check_no_latch\ +|dont_infer_mux_for_resource_sharing|enable_advisor\ +|f(f_always_(async_set_reset|sync_set_reset)|iles)\ +|hide_resource_line_numbers|infer_mux|keep_(feedback|inv_feedback)\ +|mux_size_limit|re(g_report_length|p(lace_synthetic|ort_inferred_modules)\ +|source_(allocation|implementation))|s(ource_to_gates_mode|ync(_set_reset\ +|h_set_reset))|translate_off_skip_text))|i(f|n(clude|sert_(scan|test)))\ +|l(i(nk(|_(force_case|library))|st_(designs|instances|libs))|oad_of)\ +|port_complement_naming_style|quit|re(ad(|_(lib|timing))|move_(attribute\ +|c(ell|lock|onstraint)|design|input_delay|li(b|cense)|output_delay\ +|unconnected_ports)|name_design|optimize_design(|_changed_list_file_name)\ +|port_(a(rea|ttribute)|c(ell|onstraint)|design(|_lib)|hierarchy\ +|internal_loads|lib|multicycles|net|po(rt|wer)|re(ference|sources)|t(est\ +|iming))|set_design)|s(df(in_(fall_(cell_delay_type|net_delay_type)\ +|min_(fall_(cell_delay|net_delay)|rise_(cell_delay|net_delay))\ +|rise_(cell_delay_type|net_delay_type)|top_instance_name)\ +|out_(allow_non_positive_constraints|min_(fall_(cell_delay|net_delay)\ +|rise_(cell_delay|net_delay))|t(ime_scale|op_instance_name)\ +|write_to_output))|e(arch_path|t_(attribute|boundary_optimization\ +|clock_skew|d(isable_timing|ont_(touch(|_network)|use)|riv(e|ing_cell))\ +|equal|f(alse_path|ix_hold|latten)|i(mplementation|nput_delay)|lo(ad\ +|gic_(one|zero))|m(ax_(area|capacitance|fanout|transition)|ulticycle_path)\ +|o(perating_conditions|utput_delay)|s(can_style|ignal_type|tructure)\ +|test_methodology|unconnected|wire_load))|h(|ell_prompt)|uppress_errors\ +|yn(lib_dont_get_license|t(ax_check_status|hetic_library)))|target_library\ +|u(n(alias|group|iquify(|_naming_style))|pdate_lib)|verbose_messages\ +|w(hi(ch|le)|rite(|_(constraints|script|timing)))\b/{ + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } + +} + + +/** + * Name: tcl + * Description: Tcl programming language. + * Author: Markku Rossi + */ + +state tcl_comment +{ + /[^\\\\]\n/ { + language_print ($0); + return; + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + +state tcl_proc_arglist +{ + /* List of arguments. */ + /{/ { + language_print ($0); + variable_name_face (true); + str = match_balanced_block (/{/, /}/); + variable_name_face (false); + language_print (str); + return; + } + /* Only one argument. */ + /[A-Za-z0-9]+/ { + variable_name_face (true); + language_print ($0); + variable_name_face (false); + return; + } + /* No idea what this is??? */ + /[.\n]/ { + language_print ($0); + return; + } +} + +state tcl +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /#/ { + comment_face (true); + language_print ($0); + call (tcl_comment); + comment_face (false); + } + /#\n/ { + comment_face (true); + language_print ($0); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Procedure definitions. */ + /\b(proc)([ \t]+)([A-Za-z_0-9]+)([ \t]+)/ { + /* Keyword `proc'. */ + keyword_face (true); + language_print ($1); + keyword_face (false); + + /* Middle garbage. */ + language_print ($2); + + /* Function name. */ + function_name_face (true); + language_print ($3); + function_name_face (false); + + /* Second middle garbage. */ + language_print ($4); + + /* Function argument list. */ + call (tcl_proc_arglist); + } + + /* Simple variable reference. */ + /(\$)([A-Za-z_0-9]+)/ { + language_print ($1); + variable_name_face (true); + language_print ($2); + variable_name_face (false); + } + + /* {}-enclosed variable reference. */ + /\${/ { + language_print ($0); + variable_name_face (true); + str = match_balanced_block (/{/, /}/); + variable_name_face (false); + language_print (str); + } + + /* Keywords. + (build-re '( + ;; Tcl: + Http Tcl after append array bgerror break case catch cd clock + concat continue eof error eval exec exit expr fblocked fconfigure file + fileevent filename flush for foreach format gets glob global history + if incr info interp join lappend library lindex linsert list llength + load lose lrange lreplace lsearch lsort open package pid pkg_mkIndex + proc puts pwd read regexp regsub rename return scan seek set socket + source split string subst switch tclvars tell time trace unknown unset + update uplevel upvar vwait while + + ;; Tk: + bell bind bindtags bitmap button canvas checkbutton clipboard destroy + entry event focus font frame grab grid image label listbox lower menu + menubutton message option options pack photo place radiobutton raise + scale scrollbar selection send text tk tk_bindForTraversal tk_bisque + tk_chooseColor tk_dialog tk_focusFollowsMouse tk_focusNext + tk_focusPrev tk_getOpenFile tk_getSaveFile tk_menuBar tk_messageBox + tk_optionMenu tk_popup tk_setPalette tkerror tkvars tkwait toplevel + winfo wm + )) + */ + /\b(Http|Tcl|a(fter|ppend|rray)\ +|b(ell|gerror|i(nd(|tags)|tmap)|reak|utton)\ +|c(a(nvas|se|tch)|d|heckbutton|l(ipboard|ock)|on(cat|tinue))|destroy\ +|e(ntry|of|rror|v(al|ent)|x(ec|it|pr))\ +|f(blocked|configure|ile(|event|name)|lush|o(cus|nt|r(|each|mat))|rame)\ +|g(ets|lob(|al)|r(ab|id))|history|i(f|mage|n(cr|fo|terp))|join\ +|l(a(bel|ppend)|i(brary|n(dex|sert)|st(|box))|length|o(ad|se|wer)\ +|r(ange|eplace)|s(earch|ort))\ +|me(nu(|button)|ssage)|op(en|tion(|s))\ +|p(ack(|age)|hoto|id|kg_mkIndex|lace|roc|uts|wd)\ +|r(a(diobutton|ise)|e(ad|g(exp|sub)|name|turn))\ +|s(c(a(le|n)|rollbar)|e(ek|lection|nd|t)|o(cket|urce)|plit|tring|ubst\ +|witch)\ +|t(clvars|e(ll|xt)|ime\ +|k(\ +|_(bi(ndForTraversal|sque)|chooseColor|dialog\ +|focus(FollowsMouse|Next|Prev)|get(OpenFile|SaveFile)\ +|me(nuBar|ssageBox)|optionMenu|popup|setPalette)\ +|error|vars|wait)\ +|oplevel|race)\ +|u(n(known|set)|p(date|level|var))|vwait|w(hile|info|m))\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: verilog + * Description: Verilog hardware description language + * Author: Edward Arthur + */ +state verilog +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Verilog takes C++ style comments */ + + /* Comments. */ + /\/\*/ { + comment_face (true); + language_print ($0); + call (c_comment); + comment_face (false); + } + /\/\// { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Macro expansions start with '`' and continue one word. */ + /`([a-zA-Z_0-9]+)/ { + reference_face (true); + language_print ($0); + reference_face (false); + } + + /* Keywords. + (build-re '(always and assign begin buf bufif0 bufif1 case casex + casez cmos deassign default defparam disable edge else end endcase + endmodule endfunction endprimitive endspecify endtable endtask event + for force forever fork function highz0 highz1 if initial inout input + integer join large macromodule medium module nand negedge nmos nor + not notif0 notif1 or output parameter pmos posedge primitive pull0 + pull1 pullup pulldown rcmos reg release repeat rnmos rpmos rtran + rtranif0 rtranif1 scalared small specify specparam strength strong0 + strong1 supply0 supply1 table task time tran tranif0 tranif1 tri tri0 + tri1 triand trior trireg vectored wait wand weak0 weak1 while wire wor + xnor xor + $bitstoreal $countdrivers $display $fclose $fdisplay $fmonitor + $fopen $fstrobe $fwrite $finish $getpattern $history $incsave $input + $itor $key $list $log $monitor $monitoroff $monitoron $nokey $nolog + $printtimescale $readmemb $readmemh $realtime $realtobits $reset + $reset_count $reset_value $restart $rtoi $save $scale $scope + $showscopes $showvariables $showvars $sreadmemb $sreadmemh $stime + $stop $strobe $time $timeformat $write $vcdpluson $vcdplusoff + $vcdplustraceon $vcdplustraceoff $dumpvars + ;; prefix G stands for grave ` + Gaccelerate Gautoexpand_vectornets Gcelldefine Gdefault_nettype Gdefine + Gelse Gendcelldefine Gendif Gendprotect Gendprotected + Gexpand_vectornets Gifdef Ginclude Gnoaccelerate + Gnoexpand_vectornets Gnoremove_gatenames Gnoremove_netnames + Gnounconnected_drive Gprotect Gprotected Gremove_gatenames + Gremove_netnames Gresetall Gtimescale Gunconnected_drive + Guselib + )) + */ + /\$(bitstoreal|countdrivers|d(isplay|umpvars)\ +|f(close|display|inish|monitor|open|strobe|write)|getpattern|history\ +|i(n(csave|put)|tor)|key|l(ist|og)|monitor(|o(ff|n))|no(key|log)\ +|printtimescale\ +|r(e(a(dmem(b|h)|lt(ime|obits))|s(et(|_(count|value))|tart))|toi)\ +|s(ave|c(ale|ope)|how(scopes|var(iables|s))|readmem(b|h)|t(ime|op|robe))\ +|time(|format)|vcdplus(o(ff|n)|traceo(ff|n))|write)\b\ +|`(a(ccelerate|utoexpand_vectornets)|celldefine|def(ault_nettype|ine)\ +|e(lse|nd(celldefine|if|protect(|ed))|xpand_vectornets)|i(fdef|nclude)\ +|no(accelerate|expand_vectornets|remove_(gatenames|netnames)\ +|unconnected_drive)\ +|protect(|ed)|re(move_(gatenames|netnames)|setall)|timescale\ +|u(nconnected_drive|selib))\b\ +|\b(a(lways|nd|ssign)|b(egin|uf(|if(0|1)))|c(ase(|x|z)|mos)\ +|d(e(assign|f(ault|param))|isable)\ +|e(dge|lse|nd(|case|function|module|primitive|specify|ta(ble|sk))|vent)\ +|f(or(|ce|ever|k)|unction)|highz(0|1)|i(f|n(itial|out|put|teger))|join\ +|large|m(acromodule|edium|odule)|n(and|egedge|mos|o(r|t(|if(0|1))))\ +|o(r|utput)|p(arameter|mos|osedge|rimitive|ull(0|1|down|up))\ +|r(cmos|e(g|lease|peat)|nmos|pmos|tran(|if(0|1)))\ +|s(calared|mall|pec(ify|param)|tr(ength|ong(0|1))|upply(0|1))\ +|t(a(ble|sk)|ime|r(an(|if(0|1))|i(|0|1|and|or|reg)))|vectored\ +|w(a(it|nd)|eak(0|1)|hile|ire|or)|x(nor|or))\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/** + * Name: vhdl + * Description: VHSIC Hardware Description Language (VHDL) + * Highlights keywords, comments and special vhdl + * constructs. Please send comments or suggestions. + * + * Author: Brian Silveira (brian@nortel.ca) + * + */ +state vhdl +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /--/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\"/ { + string_face (true); + language_print ($0); + call (c_string); + string_face (false); + } + + /* Keywords. + (build-re '(abs access after alias all and architecture array + assert attribute begin begin block body body buffer bus case + component configuration configuration constant disconnect downto + else elsif end entity exit file for function function generate + generic guarded if in inout is label library linkage loop map + mod nand new next nor not null of on open or others out package + port procedure process range record register rem report return + reverse select severity signal subtype then to transport type + units until use variable wait when while with with xor) + t) + */ + /\b([aA]([bB][sS]|[cC][cC][eE][sS][sS]|[fF][tT][eE][rR]\ +|[lL]([iI][aA][sS]|[lL])|[nN][dD]\ +|[rR]([cC][hH][iI][tT][eE][cC][tT][uU][rR][eE]|[rR][aA][yY])\ +|[sS][sS][eE][rR][tT]|[tT][tT][rR][iI][bB][uU][tT][eE])\ +|[bB]([eE][gG][iI][nN]()|[lL][oO][cC][kK]|[oO][dD][yY]()\ +|[uU]([fF][fF][eE][rR]|[sS]))\ +|[cC]([aA][sS][eE]\ +|[oO]([mM][pP][oO][nN][eE][nN][tT]\ +|[nN]([fF][iI][gG][uU][rR][aA][tT][iI][oO][nN]()|[sS][tT][aA][nN][tT])))\ +|[dD]([iI][sS][cC][oO][nN][nN][eE][cC][tT]|[oO][wW][nN][tT][oO])\ +|[eE]([lL][sS]([eE]|[iI][fF])|[nN]([dD]|[tT][iI][tT][yY])|[xX][iI][tT])\ +|[fF]([iI][lL][eE]|[oO][rR]|[uU][nN][cC][tT][iI][oO][nN]())\ +|[gG]([eE][nN][eE][rR]([aA][tT][eE]|[iI][cC])|[uU][aA][rR][dD][eE][dD])\ +|[iI]([fF]|[nN](|[oO][uU][tT])|[sS])\ +|[lL]([aA][bB][eE][lL]|[iI]([bB][rR][aA][rR][yY]|[nN][kK][aA][gG][eE])\ +|[oO][oO][pP])\ +|[mM]([aA][pP]|[oO][dD])\ +|[nN]([aA][nN][dD]|[eE]([wW]|[xX][tT])|[oO]([rR]|[tT])|[uU][lL][lL])\ +|[oO]([fF]|[nN]|[pP][eE][nN]|[rR]|[tT][hH][eE][rR][sS]|[uU][tT])\ +|[pP]([aA][cC][kK][aA][gG][eE]|[oO][rR][tT]\ +|[rR][oO][cC][eE]([dD][uU][rR][eE]|[sS][sS]))\ +|[rR]([aA][nN][gG][eE]\ +|[eE]([cC][oO][rR][dD]|[gG][iI][sS][tT][eE][rR]|[mM]|[pP][oO][rR][tT]\ +|[tT][uU][rR][nN]|[vV][eE][rR][sS][eE]))\ +|[sS]([eE]([lL][eE][cC][tT]|[vV][eE][rR][iI][tT][yY])|[iI][gG][nN][aA][lL]\ +|[uU][bB][tT][yY][pP][eE])\ +|[tT]([hH][eE][nN]|[oO]|[rR][aA][nN][sS][pP][oO][rR][tT]|[yY][pP][eE])\ +|[uU]([nN]([iI][tT][sS]|[tT][iI][lL])|[sS][eE])\ +|[vV][aA][rR][iI][aA][bB][lL][eE]\ +|[wW]([aA][iI][tT]|[hH]([eE][nN]|[iI][lL][eE])|[iI][tT][hH]())\ +|[xX][oO][rR])\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } + + + /<=|=>/ + { + reference_face (true); + language_print ($0); + reference_face(false); + } +} + + +/** + * Name: vba + * Description: Visual Basic (for Applications) + * Author: Kevin Grover + */ + +/* To Do + * - ?Get parser to work for X.X.X.X and not hilight separate Xs + * - ?recognize type declaration characters ($,%,@, etc.. on variables) + * - ?Look for line numbers/labels (for Goto's) /^\s*[0-9A-Za-z]+:/ + */ + +state vba +{ + BEGIN { + header (); + } + END { + trailer (); + } + + /* Comments. */ + /[\']|^\s*Rem/ { + comment_face (true); + language_print ($0); + call (eat_one_line); + comment_face (false); + } + + /* String constants. */ + /\".*\"/ { + string_face (true); + language_print ($0); + string_face (false); + } + + /* Keywords. From: + Excel for Windows 95 Power Programming with VGA + 2nd Ed, John Walkenbach, pg 160 + + (build-re '( + Abs And Any As Boolean ByRef ByVal Call Case CBool CCur CDate + CDbl CDecl CInt Circle CLng Close Const CSng CStr CurDirrase + Currency CVar CVDate CVErr Date Debug Declare + + DefBool DefCur DefDate DefDbl DefInt DefLng DefObj DefSng DefStr + DefVar Dim Dir Do Double Each Else ElsIf Empty End EndIf Eqv Erase + Error Exit False Fix For Format FreeFile + + Function Get Global GoSub GoTo If Imp In Input InputB Instr InstrB Int + Integer Is LBound Len LenB Let Like Line Load Local Lock Long Loop + LSet Me Mid + + MidB Mod Name New Next Not Nothing Null Object On Open Option Optional + Or Point Preserve Print Private Property PSet Public Put ReDim Rem + Resume Return RSet Scale Seek + + Select Set Sgn Shared Single Spc Static Stop StrComp String Sub Tab + Then TO True Type TypeOf UBound Unload Unlock Until Variant Wend While + Width With Write Xor)) + */ + /\b(A(bs|n(d|y)|s)|B(oolean|y(Ref|Val))\ +|C(Bool|Cur|D(ate|bl|ecl)|Int|Lng|S(ng|tr)|V(Date|Err|ar)|a(ll|se)|ircle\ +|lose|onst|ur(Dirrase|rency))\ +|D(ate|e(bug|clare|f(Bool|Cur|D(ate|bl)|Int|Lng|Obj|S(ng|tr)|Var))\ +|i(m|r)|o(|uble))\ +|E(ach|ls(If|e)|mpty|nd(|If)|qv|r(ase|ror)|xit)\ +|F(alse|ix|or(|mat)|reeFile|unction)|G(et|lobal|o(Sub|To))\ +|I(f|mp|n(|put(|B)|str(|B)|t(|eger))|s)\ +|L(Bound|Set|e(n(|B)|t)|i(ke|ne)|o(ad|c(al|k)|ng|op))|M(e|id(|B)|od)\ +|N(ame|e(w|xt)|ot(|hing)|ull)|O(bject|n|p(en|tion(|al))|r)\ +|P(Set|oint|r(eserve|i(nt|vate)|operty)|u(blic|t))\ +|R(Set|e(Dim|m|sume|turn))\ +|S(cale|e(ek|lect|t)|gn|hared|ingle|pc|t(atic|op|r(Comp|ing))|ub)\ +|T(O|ab|hen|rue|ype(|Of))|U(Bound|n(lo(ad|ck)|til))|Variant\ +|W(end|hile|i(dth|th)|rite)|Xor)\b/ { + keyword_face (true); + language_print ($0); + keyword_face (false); + } + + LANGUAGE_SPECIALS { + language_print ($0); + } +} + + +/* +Local variables: +mode: c +End: +*/