1;;
2;; Copyright (c) 2002 by The XFree86 Project, Inc.
3;;
4;; Permission is hereby granted, free of charge, to any person obtaining a
5;; copy of this software and associated documentation files (the "Software"),
6;; to deal in the Software without restriction, including without limitation
7;; the rights to use, copy, modify, merge, publish, distribute, sublicense,
8;; and/or sell copies of the Software, and to permit persons to whom the
9;; Software is furnished to do so, subject to the following conditions:
10;;
11;; The above copyright notice and this permission notice shall be included in
12;; all copies or substantial portions of the Software.
13;;
14;; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15;; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16;; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17;; THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18;; WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19;; OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20;; SOFTWARE.
21;;
22;; Except as contained in this notice, the name of the XFree86 Project shall
23;; not be used in advertising or otherwise to promote the sale, use or other
24;; dealings in this Software without prior written authorization from the
25;; XFree86 Project.
26;;
27;; Author: Paulo César Pereira de Andrade
28;;
29;;
30;; $XFree86: xc/programs/xedit/lisp/modules/progmodes/man.lsp,v 1.2 2002/10/06 17:11:48 paulo Exp $
31;;
32
33(require "syntax")
34(in-package "XEDIT")
35
36(defsynprop *prop-man-b*
37    "b"
38    :font	"*courier-bold-r*-12-*"
39    :foreground	"gray12"
40)
41
42(defsynprop *prop-man-i*
43    "i"
44    :font	"*courier-medium-o*-12-*"
45    :foreground	"black"
46)
47
48(defsynprop *prop-man-bi*
49    "bi"
50    :font	"*courier-bold-o*-12-*"
51    :foreground	"gray20"
52)
53
54(defsynprop *prop-man-th*
55    "th"
56    :font	"-*-courier-*-*-*-*-18-*-*-*-*-*-*-1"
57    :foreground	"Red3"
58)
59
60(defsynprop *prop-man-sh*
61    "sh"
62    :font	"-*-courier-*-*-*-*-14-*-*-*-*-*-*-1"
63    :foreground	"OrangeRed3"
64)
65
66(defsynprop *prop-man-ss*
67    "ss"
68    :font	"-*-courier-*-*-*-*-12-*-*-*-*-*-*-1"
69    :foreground	"Gold4"
70)
71
72(defsynprop *prop-man-escape*
73    "escape"
74    :font	"*lucidatypewriter-medium-r*-12-*"
75    :foreground	"RoyalBlue4"
76)
77
78(defsynprop *prop-man-string*
79    "string"
80    :font	"*lucidatypewriter-bold-r*-12-*"
81    :foreground	"RoyalBlue3"
82;    :underline	t
83)
84
85(defmacro man-syntoken (pattern)
86    `(syntoken (string-concat "^\\.(" ,pattern ")(\\s+|$)")
87	:icase t
88;	:contained t
89	:property *prop-preprocessor*
90	:begin (intern (string ,pattern) 'keyword)))
91
92(defmacro man-syntable (pattern property)
93    `(syntable (intern (string ,pattern) 'keyword) ,property nil
94	(syntoken "$" :switch -1)
95	(synaugment :extras)))
96
97
98(defsyntax *man-mode* :main nil nil nil
99    (syntoken "^\\.\\\\\".*"
100	:property *prop-comment*)
101
102    (man-syntoken "b|br|nm")
103    (man-syntable "b|br|nm" *prop-man-b*)
104
105    (man-syntoken "i|ir|ri|ip")
106    (man-syntable "i|ir|ri|ip" *prop-man-i*)
107
108    (man-syntoken "th|dt")
109    (man-syntable "th|dt" *prop-man-th*)
110
111    (man-syntoken "sh")
112    (man-syntable "sh" *prop-man-sh*)
113
114    (man-syntoken "ss")
115    (man-syntable "ss" *prop-man-ss*)
116
117    (man-syntoken "bi")
118    (man-syntable "bi" *prop-man-bi*)
119
120    ;; Anything not matched...
121    (syntoken "^\\.[a-z][a-z](\\s+|$)"
122	:icase t
123	:property *prop-preprocessor*)
124
125    (syntable :extras nil nil
126	(syntoken "\\<__\\l+__\\>"
127	    :property *prop-constant*)
128	(syntoken "\\\\fB"
129	    :property *prop-preprocessor*
130	    :begin :b)
131	(syntoken "\\\\fI"
132	    :property *prop-preprocessor*
133	    :begin :i)
134	(syntoken "\\\\f\\u"
135	    :property *prop-preprocessor*)
136
137	(syntoken "\\\\\\*?."
138	    :property *prop-man-escape*)
139
140	(syntoken "\""
141	    :property *prop-man-string*)
142
143	(syntable :i *prop-man-i* nil
144	    (syntoken "$"
145		:switch :main)
146	    (syntoken "\\\\f\\u"
147		:property *prop-preprocessor*
148		:switch -1)
149	)
150	(syntable :b *prop-man-b* nil
151	    (syntoken "$"
152		:switch :main)
153	    (syntoken "\\\\f\\u"
154		:property *prop-preprocessor*
155		:switch -1)
156	)
157    )
158
159    (synaugment :extras)
160)
161