/* * States definitions file for GNU Enscript. * Copyright (c) 1997-1999 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.1.1.1 2003/03/05 07:25:52 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. * * - Using enscript.el to build regular expressions: * * M-x load-file RET enscript.el RET * * Move in the buffer to the point where the (build-re '()) ends, * that is, after the last closing parenthesis ')'. Then, type: * * C-x C-e * * Magic should happen. * * 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", 95, 158, 160); 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", 34, 139, 34); 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); print (""); } else { if (color) color_off (); print (""); } } 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, /[^\n]/, "$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 ansi_faces () { sub language_color (name) { return sprintf("%s", name); } LANGUAGE_SPECIALS = /./; sub language_print (str) { print (str); } sub header () { } sub trailer () { print ("\033[0m"); } sub color_on (name) { print ("\033[", name, "m"); } sub color_off () { print ("\033[0m"); } 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) { if (color) color_on (comment_face_color); } else { if (color) color_off (); } } sub function_name_face (on) { if (on) { if (color) color_on (function_name_face_color); } else { if (color) color_off (); } } sub variable_name_face (on) { if (on) { if (color) color_on (variable_name_face_color); } else { if (color) color_off (); } } sub keyword_face (on) { if (on) { if (color) color_on (keyword_face_color); } else { if (color) color_off (); } } sub reference_face (on) { if (on) { if (color) color_on (reference_face_color); } else { if (color) color_off (); } } 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 ("{\\b "); } else { if (color) color_off (); print ("}"); } } sub type_face (on) { if (on) { if (color) color_on (type_face_color); } else { if (color) color_off (); } } } /* End ansi */ 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 if (strcmp (language, "ansi") == 0) ansi_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, "tty") == 0) { color = 1; bold_color = language_color ("1"); italic_color = language_color ("4"); bold_italic_color = language_color ("7"); comment_face_color = language_color ("34"); function_name_face_color = language_color ("39"); variable_name_face_color = language_color ("39"); keyword_face_color = language_color ("33"); reference_face_color = language_color ("35"); string_face_color = language_color ("31"); builtin_face_color = language_color ("35"); type_face_color = language_color ("32"); } 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 ("firebrick"); function_name_face_color = language_color ("blue"); variable_name_face_color = language_color ("dark goldenrod"); keyword_face_color = language_color ("purple"); reference_face_color = language_color ("cadet blue"); string_face_color = language_color ("rosy brown"); 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 = bold_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$/ matlab; /\.(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; /\.(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; /\.(cshrc|login|logout|history|csh)$/ csh; /\.tcshrc$/ tcsh; /\.(zshenv|zprofile|zshrc|zlogin|zlogout)$/ zsh; /\.(bash_profile|bashrc|inputrc)$/ bash; /\.m4$/ m4; /\.il$/ skill; /\.wrl$/ vrml; /\.tex$/ tex; /^.*$/ 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; /^\04?%!/ postscript; /^From:/ mail; /^#![ \t]*(\/usr)?\/bin\/[ngmt]?awk/ awk; /^#![ \t]*(\/usr)?\/bin\/sh/ sh; /^#![ \t]*(\/usr)?\/bin\/csh/ csh; /^#![ \t]*(\/usr)?(\/local)?\/bin\/tcsh/ tcsh; /^#![ \t]*(\/usr)?(\/local)?\/bin\/zsh/ zsh; /^#![ \t]*(\/usr)?(\/local)?\/bin\/bash/ bash; /^#![ \t]*(\/usr)?(\/ccs)?\/bin\/m4/ m4; /^#VRML/ vrml; } /* * 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: bash * Description: Bourne-Again shell programming language. * Author: Jean-Marc Calvez */ state bash { 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: (build-re '(! case do done elif else esac fi for function if in select then until while { } time)) */ /\b(!|case|do(|ne)|e(l(if|se)|sac)|f(i|or|unction)|i(f|n)|select\ |t(hen|ime)|until|while|{|})\b/ { keyword_face (true); language_print ($0); keyword_face (false); } /* shell built-in commands (build-re '(: source alias bg bind break builtin cd command continue declare typeset dirs disown echo enable eval exec exit export fc fg getopts hash help history jobs kill let local logout popd pushd pwd read readonly return set shift shopt suspend test times trap type ulimit umask unalias unset wait)) */ /\b(:|alias|b(g|ind|reak|uiltin)|c(d|o(mmand|ntinue))\ |d(eclare|i(rs|sown))|e(cho|nable|val|x(ec|it|port))|f(c|g)|getopts\ |h(ash|elp|istory)|jobs|kill|l(et|o(cal|gout))|p(opd|ushd|wd)\ |re(ad(|only)|turn)|s(et|h(ift|opt)|ource|uspend)\ |t(est|imes|rap|ype(|set))|u(limit|mask|n(alias|set))|wait)\b/ { builtin_face (true); language_print ($0); builtin_face (false); } /* shell variables (built-in) (build-re '(PPID PWD OLDPWD REPLY UID EUID BASH BASH_VERSION BASH_VERSINFO SHLVL RANDOM SECONDS LINENO HISTCMD DIRSTACK PIPESTATUS OPTARG OPTIND HOSTNAME HOSTTYPE OSTYPE MACHTYPE SHELLOPTS IFS PATH HOME CDPATH ENV MAIL MAILCHECK MAILPATH PS1 PS2 PS3 PS4 TIMEFORMAT HISTSIZE HISTFILE HISTFILESIZE OPTERR LANG LC_ALL LC_COLLATE LC_MESSAGES PROMPT_COMMAND IGNOREEOF TMOUT FCEDIT FIGNORE GLOBIGNORE INPUTRC HISTCONTROL HISTIGNORE histchars HOSTFILE auto_resume)) */ /\b(BASH(|_VERSI(NFO|ON))|CDPATH|DIRSTACK|E(NV|UID)|F(CEDIT|IGNORE)\ |GLOBIGNORE\ |H(IST(C(MD|ONTROL)|FILE(|SIZE)|IGNORE|SIZE)|O(ME|ST(FILE|NAME|TYPE)))\ |I(FS|GNOREEOF|NPUTRC)|L(ANG|C_(ALL|COLLATE|MESSAGES)|INENO)\ |MA(CHTYPE|IL(|CHECK|PATH))|O(LDPWD|PT(ARG|ERR|IND)|STYPE)\ |P(ATH|IPESTATUS|PID|ROMPT_COMMAND|S(1|2|3|4)|WD)|R(ANDOM|EPLY)\ |S(ECONDS|H(ELLOPTS|LVL))|T(IMEFORMAT|MOUT)|UID|auto_resume|histchars)\b/ { variable_name_face (true); language_print ($0); variable_name_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. Emacs accepts also bare numbers. */ /^([ \t]*)([a-zA-Z0-9_]+)(:)/ { language_print ($1); reference_face (true); language_print ($2); reference_face (false); language_print ($3); } /* Goto, case and the target. */ /\<(goto|case)\>([ \t]+)(-?[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. Emacs accepts also bare numbers. */ /^([ \t]*)([a-zA-Z0-9_]+)(:)/ { language_print ($1); if (strcmp ($2, "public") == 0 || strcmp ($2, "private") == 0 || strcmp ($2, "protected") == 0) { /* These use the `type' face. */ type_face (true); language_print ($2); type_face (false); } else { reference_face (true); language_print ($2); reference_face (false); } language_print ($3); } /* Goto and its target. */ /\<(goto|case)\>([ \t]+)(-?[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: csh * Description: C-Shell script language * Author: Jean-Marc Calvez */ state csh { BEGIN { header (); } END { trailer (); } /* Comments. From sh description */ /#/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } /* String constants. From sh */ /\"/ { string_face (true); language_print ($0); call (c_string); string_face (false); } /* Excutable script. From sh */ /^#!/ { reference_face (true); language_print ($0); call (eat_one_line); reference_face (false); } /* Keywords. : (build-re '(: alias bg break breaksw case cd chdir continue default dirs echo eval exec exit fg foreach end glob goto hashstat history if then else endif jobs kill limit login logout nice nohup notify onintr popd pushd rehash repeat set setenv shift source stop suspend switch case endsw time umask unalias unhash unlimit unset wait while % @)) */ /\b(%|:|@|alias|b(g|reak(|sw))|c(ase()|d|hdir|ontinue)|d(efault|irs)\ |e(cho|lse|nd(|if|sw)|val|x(ec|it))|f(g|oreach)|g(lob|oto)\ |h(ashstat|istory)|if|jobs|kill|l(imit|og(in|out))|n(ice|o(hup|tify))\ |onintr|p(opd|ushd)|re(hash|peat)\ |s(et(|env)|hift|ource|top|uspend|witch)|t(hen|ime)\ |u(mask|n(alias|hash|limit|set))|w(ait|hile))\b/ { keyword_face (true); language_print ($0); keyword_face (false); } /* Predefined variables: (build-re '(argv cdpath cwd echo fignore filec hardpaths histchars history home ignoreeof mail nobeep noclobber noglob nonomatch notify path prompt savehist shell status verbose)) */ /\b(argv|c(dpath|wd)|echo|fi(gnore|lec)|h(ardpaths|ist(chars|ory)|ome)\ |ignoreeof|mail|no(beep|clobber|glob|nomatch|tify)|p(ath|rompt)\ |s(avehist|hell|tatus)|verbose)\b/ { builtin_face (true); language_print ($0); builtin_face (false); } 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); } /* Strings in the io statement */ /[\']/ { string_face (true); language_print ($0); call (fortran_string); string_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; from_vrml = 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. */ /\"/ { if (from_vrml) { reference_face (true); language_print ($0); reference_face (false); return; } 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: ksh * Description: Korn shell programming language. * Author: Jean-Marc Calvez */ state ksh { BEGIN { header (); } END { trailer (); } /(\${*#[a-zA-Z0-9_]*})/ { language_print ($0); } /* 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: (build-re '(: alias bg break continue cd command eval exec exit export fc fg getopts hash jobs kill let login newgrp print pwd read readonly return set shift stop suspend test times trap type typeset ulimit umask unalias unset wait whence for in do done select case esac if then elif else fi while until function time)) */ /\b(:|alias|b(g|reak)|c(ase|d|o(mmand|ntinue))|do(|ne)\ |e(l(if|se)|sac|val|x(ec|it|port))|f(c|g|i|or|unction)|getopts|hash\ |i(f|n)|jobs|kill|l(et|ogin)|newgrp|p(rint|wd)|re(ad(|only)|turn)\ |s(e(lect|t)|hift|top|uspend)|t(est|hen|ime(|s)|rap|ype(|set))\ |u(limit|mask|n(alias|set|til))|w(ait|h(ence|ile)))\b/ { keyword_face (true); language_print ($0); keyword_face (false); } /* exported aliases (built-in) (build-re '(autoload false functions hash history integer nohup r true type)) */ /\b(autoload|f(alse|unctions)|h(ash|istory)|integer|nohup|r|t(rue|ype))\b/ { builtin_face (true); language_print ($0); builtin_face (false); } LANGUAGE_SPECIALS { language_print ($0); } } /** * Name: m4 * Description: macro processor * Author: Jean-Marc Calvez */ state m4 { BEGIN { header (); } END { trailer (); } /* Comments. */ /dnl|#/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } /* String constants. */ /\`/ { string_face (true); language_print ($0); call (pascal_string); string_face (false); } /* Keywords: (build-re '(changequote changecom decr define defn divert divnum dumpdef errprint eval ifdef ifelse include incr index len m4exit m4wrap maketemp popdef pushdef shift sinclude substr syscmd sysval translit traceon traceoff undefine undivert)) */ /\b(change(com|quote)|d(e(cr|f(ine|n))|iv(ert|num)|umpdef)|e(rrprint|val)\ |i(f(def|else)|n(c(lude|r)|dex))|len|m(4(exit|wrap)|aketemp)\ |p(opdef|ushdef)|s(hift|include|ubstr|ys(cmd|val))\ |tra(ceo(ff|n)|nslit)|und(efine|ivert))\b/ { keyword_face (true); language_print ($0); keyword_face (false); } LANGUAGE_SPECIALS { language_print ($0); } } /** * Name: mail * Description: Mail and news articles. * * Originally by Markku Rossi , heavily modified by Matthew * Weigel */ state mail_body { BEGIN { reference_face (false); } /^[ \t]*>/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } LANGUAGE_SPECIALS { language_print ($0); } } state mail_header { BEGIN { reference_face (true); } END { comment_face (true); } /:/ { language_print ($0); return; } LANGUAGE_SPECIALS { language_print ($0); } } state mail { BEGIN { header (); } END { trailer (); } /^[ \t]*$/ { /* Move to the mail body. */ call (mail_body); } /^/ { reference_face (true); language_print ($0); call (mail_header); comment_face (true); } 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: matlab * Description: Matlab programming language. * Author: Jack Dunn */ m_keyword_re = /\b(break|cl(ear|ose)|e(nd|lse|lseif|rror)|f(or|unction)|if|keyboard|otherwise\ |quit|return|switch|while)\b/; /* Taken fron the Matlab Function Reference, version 5.2 */ m_type_re = /\b(abs|acopy|acos|acosh|acot|acoth|acsc|acsch|addpath|airy|all|and|angle|ans|any\ |arc(cosecant|cosine|cotangent|secant|sine|tangent)|area\ |arename|asech|asin|asinh|atan(|2)|atanh|axes|axis|balance|bar(|3|3h|h)\ |base2dec|bessel(h|i|j|k|y)|beta(|inc|ln)\ |bicgstab|bin2dec|bit(and|cmp|get|max|or|set|shift|xor)|blanks\ |box|brighten|builtin|calendar|cam(dolly|light|lookat|orbit|pan|pos|proj\ |roll|target|up|va|zoom)|capture|case|cat(|ch)|caxis|cd|cdf2rdf\ |cell(|2struct|plot)|cgs|char|chol(|inc|update)|cla(|bel|ss)\ |clc|clf|clock|col(mmd|or(bar|map)|perm)|com(bs|et|et3|pa(n|ss))|computer\ |cond(|eig|est)|conj|con(tour(|3|c|f))|contrast|conv(|2)|convhull|conv\ |copy(file|obj)|corrcoef|cos|cosh|cot|coth|cov|cplxpair|cputime|cross\ |csc|csch|cum(prod|trapz)|cylinder|daspect|date|date(num|str|vec)\ |db(clear|cont|down|mex|quit|stack|status|step|stop|type|up)\ |dd(eadv|eexec|einit|epoke|ereq|eterm|eunadv)|de(al|blank|(c2(base|bin|hex))\ |conv)|default4|del2|delaunay|de(lete|t)|diag|diary|diff|dir|disp\ |dlm(read|writ)|dmperm|double|dragrect|drawnow|dsearch|echo|eig|eigs|ellipj\ |ellipke|eomday|eps|erf(|c|cx)|etime|eval|evalin|exist|exp|expint|expm|eye\ |ezplot|factor|fclose|feather|feof|ferror|feval|fft(|2|n|shift)\ |fget(l|s)|fid|figflag|figure|fileparts|fill|fill3|filter(|2)|find(|obj|str)\ |fix|flip(dim|lr|ud)|floor|flops|fmin(|s)|fopen|format|fplot|fprintf\ |frame(2im|edit)|fread|freqspace|frewind|fscanf|fseek|ftell|full|funm|fwrite\ |fzero|gallery|gamma(|inc|ln)|g(ca|cd|cf|co)|gestalt|get(|field|frame)\ |ginput|global|gmres|gplot|gradient|graymon|grid(|data)|gsvd|gtext|hadamard\ |hankel|hdf|help|hess|hex2(dec|num)|hidden|hilb|hist|hold|home|horzcat\ |hsv2rgb|i|ifft(|2|n|shift)|im2frame|imag|image|imagesc|im(finfo|read|write)\ |ind2sub|Inf|inferiorto|inline|inpolygon|input|int2str|interp(1|2|3|ft|n)\ |intersect|inv|invhilb|ipermute|is(a|cell(|str)|char|empty|equal|field\ |finite|global|handle|hold|ieee|inf|letter|logical|member|nan|numeric\ |object|ppc|prime|real|space|sparse|str|struct|student|unix|vms)\ |j|kron|last(err|warn)|lcm|ldivide|legend(|re)|length|light(|angle|ing)\ |lin2mu|line|linspace|load|log(|10|2|ical)|loglog(|m|space)|lookfor\ |lower|lscov|lu|luinc|magic|mat2str|material|max|mean|median|menu\ |mesh(|c|grid|z)|min|minus|mislocked|mkdir|ml(divide|ock)|mod|more|movie(|in)\ |mpower|mrdivide|mtimes|mu2lin|munlock|NaN|narg(chk|in|out)|nd(grid|ims)\ |newplot|nextpow2|nnls|nnz|nonzeros|norm|normest|not|now|null|num2(cell|str)\ |nzmax|ode(45|file|get|set)|ones|or|orient|orth|pack|pagedlg|pareto|pascal\ |patch|path|pause|pbaspect|pcg|pcode|pcolor|perms|permute|persistent\ |pi|pie(|,3)|pinv|plot(|3|matrix|yy)|plus|pol2cart|polar|poly(|area|der\ |eig|fit|val|valm)|pow2|power|primes|print(|dlg|frame|opt)|prod\ |profile|qmr|qr(|delete|insert)|qtwrite|quad|quad8|quiver(|3)|qz\ |rand(|n|perm)|rank|rat(|s)|rbbox|rcond|rdivide|readsnd|real(|max|min)\ |recordsound|refresh|rem|repmat|reset|reshape|residue|rgb(2hsv|plot)\ |ribbon|rmfield|rmpath|roots|rose|rot90|rotate(|3d)|round|rref(|movie)\ |rsf2csf|save|scatter(|3)|schur|script|sech|semilog(x|y)|set(|diff|feild|xor)\ |shading|shiftdim|sign|sin|sinh|size|slice|sliders|sort|sortrows|sound(|cap)\ |sp(alloc|arse|convert|diags|eak|eye|fun|h2cart|here|inmap|line\ |ones|parms|rand|randn|randsym|rintf|y)|sqrt(|m)|squeeze|sscanf|stairs\ |startup|std|stem(|3)|str(2(cell|num)|cat|cmp|cmpi|ings|just|match|ncmp\ |ncmpi|rep|tok|uct2cell,vcat)|sub(2ind|plot|s(asgn|pace|ref))|sum|superiorto\ |surf(|ace|c|l|norm)|svd(|s)|sym(mmd|rcm)|tan|tanh|tempdir|tempname\ |terminal|text|tic|times|title|toc|toeplitz|trace|transpose|trapz\ |tri(l|mesh|surf|u)|try|tsearch|type|ui(control|getfile|menu|nt8|putfile\ |resume|setcolor|setfont)|uminus|union|unique|unwrap|uplus|upper|varargout\ |vectorize|ver(|sion|tcat)|view|viewmtx|voronoi|wait(bar|for(|buttonpress))\ |warndlg|warning|waterfall|wav(read|write)|weekday|what(|snew)|which|who(|s)\ |wilkinson|wk1(read|write)|writesnd|xlabel|xlgetrange|xlim|xlsetrange|xor\ |ylabel|ylim|zeros|zlabel|zlim|zoom\ )\b/; state m_string { /\\\\./ { language_print ($0); } /[\']/ { language_print ($0); return; } LANGUAGE_SPECIALS { language_print ($0); } } state matlab { BEGIN { header (); } END { trailer (); } /* Comments. */ /%/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } /* Continuation. */ /\.\.\./ { keyword_face (true); language_print ($0); keyword_face (false); } /* Matrix start. */ /\[/ { type_face (true); language_print ($0); type_face (false); } /* Matrix end. */ /\]/ { type_face (true); language_print ($0); type_face (false); } m_type_re { type_face (true); language_print ($0); type_face (false); } m_keyword_re { keyword_face (true); language_print($0); keyword_face (false); } /* Transpose. */ /* variable' or )' */ /([a-zA-Z][a-zA-Z_0-9]*|\))([\'])/ { language_print ($1); keyword_face (true); language_print ($2); keyword_face (false); } /* ]' */ /([a-zA-Z][a-zA-Z_0-9]*|])([\'])/ { type_face (true); language_print ($1); type_face (false); keyword_face (true); language_print ($2); keyword_face (false); } /* Strings. */ /* 'any number of characters' */ /[\']/ { string_face (true); language_print ($0); call (m_string); string_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); reference_face (true); language_print ($2); reference_face (false); language_print ($3); } /* Goto, case and the target. */ /\<(goto|case)\>([ \t]+)(-?[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 embedded, 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: 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: skill * Description: Cadence Design Systems lispy language. * Author: Jean-Marc Calvez */ state skill { BEGIN { header (); } END { trailer (); } /* Line Comments (lispish). */ /;/ { comment_face (true); language_print ($0); call (eat_one_line); comment_face (false); } /* Block Comments (C-style) */ /\/\*/ { 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); } /* Definitions. */ /(\([ \t]*)(procedure|defmacro|mprocedure|nprocedure|defun)([ \t]+\(?)([!\$%&\*\/:<=>\?~_^a-zA-Z][!\$%&\*\/:<=>\?~_^a-zA-Z0-9.+\-]*)/ { /* Starting garbage. */ language_print ($1); /* Keyword. */ 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); } /* Keywords. Taken from Skill Language in the Quick Ref. + operators (build-re '(@rest @optional @key abs acos add1 alias alphalessp alphaNumCmp and append append1 apply arglist arrayp arrayref asin assoc assq atan atom band bcdp bitfield bitfield bnand bnor bnot bor boundp break breakpt buildString bxnor bxor caaar caadr caar cadr callInitProc car case caseq cdar cddr cdr changeWorkingDir clear clearExitProcs close compareTime compress concat cond cons cont continue copy copyDefstructDeep cos count createDir csh debugQuit debugStatus declare declareLambda declareNLambda defCapDepends defCapPrefixes defInitProc defmacro defprop defstruct defstructp defun defUserInitProc defvar deleteDir deleteFile difference drain dtpr dump ed edi edit edl encrypt eq equal err error errset errsetstring eval evalstring evenp exists exit exp expandMacro expt fileLength fileSeek fileTell fix fixp float floatp for forall foreach fprintf fscanf gc gcsummary gensym get get_pname get_string getAllLoadedFiles getc getchar getCurrentTime getd getDirFiles getFnWriteProtect getFunctions getInstallPath getq getqq gets getShellEnvVar getSkillPath getVarWriteProtect getVersion getWarn getWorkingDir go geqp getq getqq greaterp if ilToolBox index infile installDebugger instring isCallable isDir isExecutable isFile isFileEncrypted isFileName isLink isReadable isWritable lambda last lconc leftshift length leqp lessp let lineread linereadstring list listFunctions listp listVariables load loadContext loadi loadstring log lowerCase makeTable makeTempFileName map mapc mapcan mapcar maplist max measureTime member memq min minus minusp mod mprocedure nconc ncons needCells neq nequal newline next nil nindex nlambda nprocedure nth nthcdr nthelem null numberp numOpenFiles oddp onep or otherp outfile parseString plist plus plusp portp postdecrement postincrement pp pprint predecrement preincrement prependInstallPath print printf printFunctions printlev println printstruct printVariables procedure profile profileReset profileSummary prog prog1 prog2 progn putd putprop putpropq putpropqq quote quotient random range readTable regExitAfter regExitBefore remd remdq remExitProc remove remprop remq return reverse rexCompile rexExecute rexMagic rexMatchAssocList rexMatchList rexMatchp rexReplace rexSubstitute rightshift rindex round rplaca rplacd saveContext set setarray setContext setFnWriteProtect setof setplist setq setqbitfield steqbitfield1 setShellEnvVar setSkillPath setVarWriteProtect sh shell simplifyFilename sin skDisableMessage skIgnoreMessage skillDebugger sklint skUnignoreMessage sort sortcar sprintf sqrt srandom sstatus stacktrace status step stepout strcat strcmp stringp stringToFunction strlen strncat strncmp sub1 subst substring sxtd symbolp symeval symstrp tablep tableToList tailp tan tconc terpri times tracef tracep tracev type typep unalias unbreakpt uncount uninstallDebugger unless unprofile untrace untracep untracev upperCase warn when where whereis while writeTable xcons zerop zxtd)) */ /\b(@(key|optional|rest)\ |a(bs|cos|dd1|l(ias|pha(NumCmp|lessp))|nd|pp(end(|1)|ly)\ |r(glist|ray(p|ref))|s(in|s(oc|q))|t(an|om))\ |b(and|cdp|itfield()|n(and|o(r|t))|o(r|undp)|reak(|pt)|uildString\ |x(nor|or))\ |c(a(a(ar|dr|r)|dr|llInitProc|r|se(|q))|d(ar|dr|r)|hangeWorkingDir\ |l(ear(|ExitProcs)|ose)\ |o(mp(areTime|ress)|n(cat|d|s|t(|inue))|py(|DefstructDeep)|s|unt)\ |reateDir|sh)\ |d(e(bug(Quit|Status)|clare(|Lambda|NLambda)\ |f(Cap(Depends|Prefixes)|InitProc|UserInitProc|macro|prop|struct(|p)|un\ |var)\ |lete(Dir|File))\ |ifference|rain|tpr|ump)\ |e(d(|i(|t)|l)|ncrypt|q(|ual)|rr(|or|set(|string))|v(al(|string)|enp)\ |x(i(sts|t)|p(|andMacro|t)))\ |f(i(le(Length|Seek|Tell)|x(|p))|loat(|p)|or(|all|each)|printf|scanf)\ |g(c(|summary)\ |e(nsym|qp\ |t(|AllLoadedFiles|CurrentTime|DirFiles|F(nWriteProtect|unctions)\ |InstallPath|S(hellEnvVar|killPath)|V(arWriteProtect|ersion)\ |W(arn|orkingDir)|_(pname|string)|c(|har)|d|q(|q())|s))\ |o|reaterp)\ |i(f|lToolBox|n(dex|file|st(allDebugger|ring))\ |s(Callable|Dir|Executable|File(|Encrypted|Name)|Link|Readable|Writable))\ |l(a(mbda|st)|conc|e(ftshift|ngth|qp|ssp|t)\ |i(neread(|string)|st(|Functions|Variables|p))\ |o(ad(|Context|i|string)|g|werCase))\ |m(a(keT(able|empFileName)|p(|c(|a(n|r))|list)|x)|e(asureTime|m(ber|q))\ |in(|us(|p))|od|procedure)\ |n(con(c|s)|e(edCells|q(|ual)|wline|xt)|i(l|ndex)|lambda|procedure\ |th(|cdr|elem)|u(ll|m(OpenFiles|berp)))\ |o(ddp|nep|r|therp|utfile)\ |p(arseString|l(ist|us(|p))|o(rtp|st(decrement|increment))|p(|rint)\ |r(e(decrement|increment|pendInstallPath)\ |int(|Functions|Variables|f|l(ev|n)|struct)\ |o(cedure|file(|Reset|Summary)|g(|1|2|n)))\ |ut(d|prop(|q(|q))))\ |quot(e|ient)\ |r(an(dom|ge)\ |e(adTable|gExit(After|Before)|m(ExitProc|d(|q)|ove|prop|q)|turn|verse\ |x(Compile|Execute|Ma(gic|tch(AssocList|List|p))|Replace|Substitute))\ |i(ghtshift|ndex)|ound|plac(a|d))\ |s(aveContext\ |et(|Context|FnWriteProtect|S(hellEnvVar|killPath)|VarWriteProtect|array\ |of|plist|q(|bitfield))\ |h(|ell)|i(mplifyFilename|n)\ |k(DisableMessage|IgnoreMessage|UnignoreMessage|illDebugger|lint)\ |ort(|car)|printf|qrt|random|status\ |t(a(cktrace|tus)|e(p(|out)|qbitfield1)\ |r(c(at|mp)|ing(ToFunction|p)|len|nc(at|mp)))\ |ub(1|st(|ring))|xtd|ym(bolp|eval|strp))\ |t(a(ble(ToList|p)|ilp|n)|conc|erpri|imes|race(f|p|v)|ype(|p))\ |u(n(alias|breakpt|count|installDebugger|less|profile|trace(|p|v))\ |pperCase)\ |w(arn|h(e(n|re(|is))|ile)|riteTable)|xcons|z(erop|xtd))\b/ { keyword_face (true); language_print ($0); keyword_face (false); } /* Skill functions. Use prefix to match, they are too many to enumerate. Used bold-italic... */ /(cdf|dag|db|de|df|dl|dm|enter|fm|ge|hi|mif|tc|tfc|sch)[A-Z][^ \t]*/ { bold_italic (true); language_print ($0); bold_italic (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][N