D Programming Language support patch

Leandro Lucarella <[email protected]> Tue, 7 Apr 2009 11:38:12 -0300
Newsgroups gmane.comp.printing.a2ps.bugs
Organization Integratech S.A.
Message-ID <[email protected]>
Hi. Attached is a patch to add support for the D Programming Language[1].

Thank you.

[1] http://www.digitalmars.com/d/

-- 
Leandro Lucarella
Integratech S.A.
4571-5252
d-sheet.patch (text/x-diff, 3.1 KB)
This patch provides D Programming Language support for a2ps.

It's based on the C and C Preprocessor sheets.
--- sheets.orig.map	2009-04-07 11:12:20.936971963 -0300
+++ sheets.map	2009-04-07 11:13:13.588971807 -0300
@@ -182,6 +182,10 @@
 	/*.[ch]xx/
 	/*.pdb/
 
+# D Programming Language files
+d:	/*.d/
+	/*.di/
+
 # C# files
 csharp:	/*.cs/
 
--- /dev/null	2009-03-27 10:49:47.720010547 -0300
+++ d.ssh	2009-04-07 11:36:31.333974832 -0300
@@ -0,0 +1,84 @@
+# Style sheet for D
+# Copyright (c) 2009 Leandro Lucarella (based on the C and CPP sheets)
+#
+
+#
+# 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 3, 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.
+#
+
+style "D" is
+
+written by "Leandro Lucarella <[email protected]>"
+version is 1.6
+requires a2ps version 4.12l
+
+documentation is
+  "Should handle D Programming Language 1.0."
+end documentation
+
+alphabets are
+   "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz_#$%"
+case sensitive
+
+
+# Some types that are not part of C
+keywords in Keyword are
+
+   cast, auto, typeof, null, true, false, /[-+]?[0-9]+[0-9_]*\.?[0-9]*/,
+   void, function, delegate, bool, char, wchar, dchar,
+   uint, byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent,
+   float, double, real, ifloat, idouble, ireal, cfloat, cdouble, creal
+
+end keywords
+
+
+# Some keywords not in C
+keywords in Keyword_strong are
+
+   abstract, alias, align, asm, assert, body, break, "case", catch, class,
+   const, continue, debug, default, delete, deprecated, do, else, enum,
+   export, extern, final, finally, for, foreach, foreach_reverse, goto,
+   if, import, "in", inout, interface, invariant, "is", lazy, macro, mixin,
+   module, new, out, override, package, pragma, private, protected, public,
+   ref, return, scope, static, struct, super, switch, synchronized, template,
+   this, throw, try, typedef, typeid, union, unittest, "version", volatile,
+   while, with,
+   __FILE__, __LINE__, __DATE__, __TIME__, __TIMESTAMP__, __VENDOR__,
+   __VERSION__, "#line"
+
+end keywords
+
+# C style yet defines `//' because it is common today in plain C
+sequences are
+    "/*" Comment "*/",
+    "/+" Comment "+/",
+    "//" Comment,
+    C-string,
+    # We do not want C-string in ASM to be declared as string,
+    # since it polutes the layout.
+    (/(asm)([[:blank:]]*\\([[:blank:]]*")/
+	\1 Keyword_strong, \2 Plain)
+        Plain
+        "\"" Plain
+	exceptions are
+	  (/(\\\\.)/ \1)
+	end exceptions,
+    C-char
+end sequences
+
+end style