# Style sheet for Kylix Pascal # Copyright (c) 1988, 89, 90, 91, 92, 93 Miguel Santana # Copyright (c) 1995, 96, 97, 98 Akim Demaille, Miguel Santana # Copyright (c) 2001 Ray Lischner # $Id: kylix.ssh,v 1.2 2001/10/30 15:52:46 lisch Exp $ # # # This file is part of a2ps. # # 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. # ## 1.1 Ray Lischner # First Kylix Pascal style, based on Pascal 1.9 style Kylix is written by "Ray Lischner " version is 1.1 requires a2ps version 4.13 documentation is "Kylix and Delphi Pascal are Borland's modern OO Pascal variants." "They contain many extensions to plain Pascal and enough" "differences from other OO Pascals to warrant a separate style." "Heavy highlighting maps mathematical symbols to their typographic" "equivalents." end documentation first alphabet is "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_" second alphabet is "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_" case insensitive # Reserved keywords. keywords in Keyword_strong are and, array, as, asm, begin, "case", class, const, constructor, destructor, dispinterface, div, do, downto, else, "end", except, exports, file, finalization, finally, for, goto, if, implementation, "in", inherited, initialization, inline, interface, "is", label, mod, nil, not, object, of, or, packed, raise, record, repeat, resourcestring, set, shl, shr, string, then, threadvar, to, try, type, until, uses, var, while, with, xor end keywords # Standard types and some builtin functions that the user is unlikely # to redefine. None of the following are reserved keywords. keywords in Keyword are addr, ansichar, ansistring, assert, boolean, break, byte, bytebool, cardinal, char, chr, comp, continue, copy, currency, dec, delete, dispose, double, exclude, extended, finalize, high, inc, include, initialize, insert, int64, integer, length, longbool, longint, longword, low, move, new, olevarient, openstring, ord, pchar, pred, real, real48, setlength, setstring, shortint, shortstring, single, sizeof, slice, smallint, succ, text, textfile, typeinfo, variant, widechar, widestring, word, wordbool end keywords optional keywords are "in" \in, not \not, and \wedge, or \vee end keywords optional operators are <= \leq, >= \geq, <> \neq end operators # Directives are not keywords in all contexts, but a2ps isn't powerful # enough to detect the correct context. Instead, the following are # feeble attempts to limit the context. operators are # The following directives are typically used at the start of a # line, and might be on a line all by themselves. (/^([[:blank:]]*)(automated|contains|private|protected|public|published|required)/ \1 Plain, \2 Keyword_strong), # The ON directive is used at the start of a line, but always # followed by at least one space character. (/^([[:blank:]]*)(on)([[:blank:]]+)/ \1 Plain, \2 Keyword_strong, \3 Plain), # The following directives are used individually. Each one must be # followed by a semicolon. The Kylix Pascal syntax permits white # space after the directive and before the semicolon, but no one # writes that way. Thus, to help recognize the directive in context, # require the semicolon to be immediately adjacent to the directive. (/(abstract|assembler|cdecl|deprecated|dynamic|export|external|far|forward|library|near|nodefault|overload|override|pascal|platform|register|reintroduce|resident|safecall|stdcall|varargs|virtual)(;)/ \1 Keyword_strong, \2 Plain), # The following directives take parameters. They are especially # difficult to detect without a true parser. Although the Kylix # Pascal syntax permits other characters, convention is that these # directives are surrounded by white space. Thus, to help recognize # the directives in context, require at least one blank character # before and after the directive. Note how this is more restrictive # than an a2ps keyword. (/([[:blank:]]+)(default|dispid|external|implements|index|message|name|out|read|readonly|stored|write|writeonly)([[:blank:]]+)/ \1 Plain, \2 Keyword_strong, \3 Plain) end operators # Highlighting the name of functions, procedures, properties, units, etc. operators are (/(procedure|function)([[:blank:]]+)([^ \t(;]+)/ \1 Keyword_strong, \2 Plain, \3 Label), (/^([[:blank:]]*)(package|program|library|unit)([[:blank:]]+)([a-zA-Z_][a-zA-Z_0-9]*)([[:blank:]]*;)/ \1 Plain, \2 Keyword_strong, \3 Plain, \4 Label, \5 Plain), (/(property)([[:blank:]]+)([a-zA-Z_0-9]+)/ \1 Keyword_strong, \2 Plain, \3 Label) end operators sequences are "(*" Comment_strong "*)", { Comment }, "//" Comment, # Pascal strings are not exactly C-char, since 'Foo''bar' # represents "Foo'bar" "\'" Plain String "\'" Plain exceptions are "\'\'" end exceptions end sequences end style