summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorSimon Tatham <anakin@pobox.com>2004-12-08 17:58:17 +0000
committerSimon Tatham <anakin@pobox.com>2004-12-08 17:58:17 +0000
commitf05862b9fa9772942ab9cb594d8c42e6a5576b11 (patch)
tree65edeece18d6b114025a8eee8332a554e80c1bfc /misc
parent2e50c3db41b1bd9905d802012609bb0c2c2254d8 (diff)
downloadhalibut-f05862b9fa9772942ab9cb594d8c42e6a5576b11.zip
halibut-f05862b9fa9772942ab9cb594d8c42e6a5576b11.tar.gz
halibut-f05862b9fa9772942ab9cb594d8c42e6a5576b11.tar.bz2
halibut-f05862b9fa9772942ab9cb594d8c42e6a5576b11.tar.xz
Halibut highlighting mode for GNU enscript. This allows our ViewCVS
installation to syntax-highlight the numerous .but files kicking around the Subversion repository. [originally from svn r4962]
Diffstat (limited to 'misc')
-rw-r--r--misc/halibut.st99
1 files changed, 99 insertions, 0 deletions
diff --git a/misc/halibut.st b/misc/halibut.st
new file mode 100644
index 0000000..2f9fb54
--- /dev/null
+++ b/misc/halibut.st
@@ -0,0 +1,99 @@
+/* -*- c -*-
+ * Name: halibut
+ * Description: Halibut document formatter.
+ * Author: Simon Tatham <anakin@pobox.com>
+ */
+
+state halibut_paragraph extends Highlight
+{
+ /^[[:space:]]*$/ {
+ language_print($0);
+ return;
+ }
+}
+
+state halibut_nested_braces extends Highlight
+{
+ BEGIN {
+ nestlevel = 1;
+ }
+
+ /{/ {
+ language_print($0);
+ nestlevel++;
+ }
+
+ /}/ {
+ language_print($0);
+ nestlevel--;
+ if (nestlevel == 0)
+ return;
+ }
+}
+
+state halibut extends HighlightEntry
+{
+ /* one-non-letter commands */
+ /\\\\[-\\\\_{}.]/ {
+ keyword_face(true);
+ language_print($0);
+ keyword_face(false);
+ }
+
+ /* code paragraphs */
+ /^\\\\c / {
+ keyword_face(true);
+ language_print($0);
+ keyword_face(false);
+ string_face(true);
+ call(eat_one_line);
+ string_face(false);
+ }
+
+ /* emphasis in code paragraphs */
+ /^\\\\e / {
+ keyword_face(true);
+ language_print($0);
+ keyword_face(false);
+ builtin_face(true);
+ call(eat_one_line);
+ builtin_face(false);
+ }
+
+ /* \uXXXX Unicode commands */
+ /\\\\u[0-9a-fA-F][0-9a-fA-F][0-9a-fA-F][0-9a-fA-F]/ {
+ keyword_face(true);
+ language_print($0);
+ keyword_face(false);
+ }
+
+ /* multi letter commands */
+ /\\\\[0-9a-tv-zA-Z][0-9a-zA-Z]*/ {
+ keyword_face(true);
+ language_print($0);
+ keyword_face(false);
+ }
+
+ /* paragraph-type comments */
+ /\\\\#/ {
+ comment_face(true);
+ language_print($0);
+ call(halibut_paragraph);
+ comment_face(false);
+ }
+
+ /* intra-paragraph type comments */
+ /\\\\#{/ {
+ comment_face(true);
+ language_print($0);
+ call(halibut_nested_braces);
+ comment_face(false);
+ }
+
+ /* I want to have braces highlighted; they're *special* */
+ /[{}]/ {
+ keyword_face(true);
+ language_print($0);
+ keyword_face(false);
+ }
+}