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/imake.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-shell* 37 "shell" 38 :font "*courier-bold-r*-12-*" 39 :foreground "Red4" 40) 41 42(defsynprop *prop-variable* 43 "variable" 44 :font "*courier-medium-r*-12-*" 45 :foreground "Red3" 46) 47 48;; The syntax-highlight definition does not try to flag errors, just show 49;; tabs in the start of lines for better visualization. 50(defsynprop *prop-tabulation* 51 "tabulation" 52 :font "*courier-medium-r*-12-*" 53 :background "Gray90" 54) 55 56(defsynprop *prop-xcomm* 57 "xcomm" 58 :font "*courier-medium-o*-12-*" 59 :foreground "SkyBlue4" 60) 61 62 63(defsyntax *imake-mode* :main nil nil nil 64 (syntoken "^\\s*XCOMM\\W?.*$" 65 :property *prop-xcomm*) 66 67 (syntoken "^\\t+" 68 :property *prop-tabulation*) 69 70 (syntoken "$(" 71 :nospec t 72 :begin :shell 73 :property *prop-shell*) 74 75 (syntoken "[][(){};$<=>&@/\\,.:~!|*?'`+-]" 76 :property *prop-shell*) 77 78 ;; Preprocessor start rule. 79 (syntoken "^\\s*#\\s*\\w+" 80 :begin :preprocessor 81 :contained t) 82 83 ;; Comment start rule. 84 (syntoken "/*" 85 :nospec t 86 :begin :comment 87 :contained t) 88 89 ;; String start rule. 90 (syntoken "\"" 91 :begin :string 92 :nospec t 93 :contained t) 94 95 ;; Quoted string start rule. 96 (syntoken "\\\"" 97 :begin :quoted-string 98 :nospec t 99 :contained t) 100 101 (syntable :shell *prop-variable* nil 102 (syntoken ")" 103 :nospec t 104 :property *prop-shell* 105 :switch -1) 106 ) 107 108 ;; Rules for comments. 109 (syntable :comment *prop-comment* nil 110 111 ;; Match nested comments as an error. 112 (syntoken "/*" 113 :nospec t 114 :property *prop-error*) 115 116 (syntoken "XXX|TODO|FIXME" 117 :property *prop-annotation*) 118 119 ;; Rule to finish a comment. 120 (syntoken "*/" 121 :nospec t 122 :switch -1) 123 ) 124 125 ;; Rules for preprocessor. 126 (syntable :preprocessor *prop-preprocessor* nil 127 128 ;; Preprocessor includes comments. 129 (syntoken "/*" 130 :nospec t 131 :begin :comment 132 :contained t) 133 134 ;; Visualization help, show tabs in the start of lines. 135 (syntoken "^\\t+" 136 :property *prop-tabulation*) 137 138 ;; Ignore lines finishing with a backslash. 139 (syntoken "\\\\$") 140 141 ;; Return to previous state if end of line found. 142 (syntoken ".?$" 143 :switch -1) 144 ) 145 146 ;; Rules for strings. 147 (syntable :string *prop-string* nil 148 149 ;; Ignore escaped characters, this includes \". 150 (syntoken "\\\\.") 151 152 ;; Ignore continuation in the next line. 153 (syntoken "\\\\$") 154 155 ;; Rule to finish a string. 156 (syntoken "\"" 157 :nospec t 158 :switch -1) 159 160 ;; Don't allow strings continuing in the next line. 161 (syntoken ".?$" 162 :begin :error) 163 ) 164 165 ;; Rules for quoted strings. 166 (syntable :quoted-string *prop-constant* nil 167 168 ;; Rule to finish the quoted string. 169 (syntoken "\\\"" 170 :nospec t 171 :switch -1) 172 173 ;; Ignore escaped characters 174 (syntoken "\\\\.") 175 176 ;; Ignore continuation in the next line. 177 (syntoken "\\\\$") 178 179 ;; Don't allow strings continuing in the next line. 180 (syntoken ".?$" 181 :begin :error) 182 ) 183 184 (syntable :error *prop-error* nil 185 (syntoken "^.*$" 186 :switch -2) 187 ) 188) 189