1;; Copyright (c) 2007,2008 Paulo Cesar Pereira de Andrade 2;; 3;; Permission is hereby granted, free of charge, to any person obtaining a 4;; copy of this software and associated documentation files (the "Software"), 5;; to deal in the Software without restriction, including without limitation 6;; the rights to use, copy, modify, merge, publish, distribute, sublicense, 7;; and/or sell copies of the Software, and to permit persons to whom the 8;; Software is furnished to do so, subject to the following conditions: 9;; 10;; The above copyright notice and this permission notice (including the next 11;; paragraph) shall be included in all copies or substantial portions of the 12;; 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18;; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19;; FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20;; DEALINGS IN THE SOFTWARE. 21;; 22;; Author: Paulo Cesar Pereira de Andrade 23;; 24 25;; Mode for editing autoconf/automake m4 files 26 27(require "syntax") 28(in-package "XEDIT") 29 30(defsynprop *prop-macro* 31 "macro" 32 :font "*courier-bold-r*-12-*" 33 :foreground "green4") 34 35(defsynprop *prop-separator* 36 "separator" 37 :font "*courier-bold-r*-12-*" 38 :foreground "Red3") 39 40(defsynprop *prop-variable* 41 "variable" 42 :font "*lucidatypewriter-medium-r*-12-*" 43 :foreground "Gold4") 44 45(defsynprop *prop-escape* 46 "escape" 47 :font "*lucidatypewriter-medium-r*-12-*" 48 :foreground "Red3") 49 50(defsyntax *auto-mode* :main nil nil nil 51 ;; dont consider dnl a macro call at top level 52 (syntoken "(#.*|\\<dnl($|\\>.*))" :property *prop-comment*) 53 54 ;; shell keywords 55 (syntoken 56 (string-concat 57 "\\<(" 58 "if|then|else|elif|else|fi|case|in|esac|do|done" 59 ")\\>") :property *prop-keyword*) 60 61 ;; toplevel no arguments macro 62 (syntoken "^[a-zA-Z0-9_]+$" :property *prop-macro*) 63 64 (syntable :string *prop-string* nil 65 ;; ignore escaped characters 66 (syntoken "\\\\.") 67 (syntoken "\"" :nospec t :switch -1) 68 (synaugment :variables)) 69 (syntable :constant *prop-constant* nil 70 (syntoken "\\\\.") 71 (syntoken "'" :nospec t :switch -1) 72 (synaugment :variables)) 73 (syntable :escape *prop-escape* nil 74 (syntoken "\\\\.") 75 (syntoken "`" :nospec t :switch -1) 76 (synaugment :variables)) 77 78 (syntable :quoted-string *prop-string* nil 79 (syntoken "\\\"" :nospec t :switch -1)) 80 81 (syntable :macro *prop-default* nil 82 (syntoken "," :property *prop-separator*) 83 (syntoken "[" :nospec t :property *prop-separator* :begin :quoted) 84 (syntable :quoted *prop-default* nil 85 ;; allow nesting 86 (syntoken "[" :nospec t :property *prop-separator* :begin :quoted) 87 (syntoken "]" :nospec t :property *prop-separator* :switch -1) 88 (synaugment :shared :comments :variables)) 89 (syntoken ")" :nospec t :property *prop-macro* :switch -1) 90 (synaugment :shared :quotes :variables :comments)) 91 92 (syntable :shared nil nil 93 (syntoken "[a-zA-Z0-9_]+\\(" :property *prop-macro* :begin :macro) 94 ;; variable assignment 95 (syntoken "[a-zA-Z0-9_-]+=" :property *prop-keyword*)) 96 97 (syntable :quotes nil nil 98 (syntoken "\"" :nospec t :begin :string :contained t) 99 (syntoken "'" :nospec t :begin :constant :contained t) 100 (syntoken "`" :nospec t :begin :escape :contained t) 101 (syntoken "\\\"" :nospec t :begin :quoted-string :contained t)) 102 103 (syntable :variables nil nil 104 (syntoken "\\$[a-zA-Z0-9_-]+" :property *prop-variable*) 105 (syntoken "\\$\\{[a-zA-Z0-9_-]+\\}" :property *prop-variable*) 106 (syntoken "\\$\\([a-zA-Z0-9_-]+\\)" :property *prop-variable*)) 107 108 (syntable :comments nil nil 109 (syntoken "(#.*|\\<dnl($|\\>.*))" :property *prop-comment*)) 110 111 (synaugment :shared :quotes :variables)) 112