lilypond-1.3.145
[lilypond.git] / lilypond-font-lock.el
blob04553830ba648d78c54d52a080be87ee4f0c9348
1 ;; lilypond-font-lock.el
3 ;; Copyright (C) 1992,1993,1994 Tim Peters
5 ;; Author: 1997: Han-Wen Nienhuys
6 ;; Author: 1995-1996 Barry A. Warsaw
7 ;; 1992-1994 Tim Peters
8 ;; Created: Feb 1992
9 ;; Version: 0.0
10 ;; Last Modified: 12SEP97
11 ;; Keywords: lilypond languages music notation
13 ;; This software is provided as-is, without express or implied
14 ;; warranty. Permission to use, copy, modify, distribute or sell this
15 ;; software, without fee, for any purpose and by any individual or
16 ;; organization, is hereby granted, provided that the above copyright
17 ;; notice and this paragraph appear in all copies.
19 ;; This started out as a cannabalised version of python-mode.el, by hwn
20 ;; For changes see the LilyPond ChangeLog
22 ;; TODO:
23 ;; - should handle block comments too.
24 ;; - handle lexer modes (\header, \melodic, \lyric) etc.
25 ;; - indentation
26 ;; - notenames?
27 ;; - fontlock: \melodic \melodic
29 (defconst LilyPond-font-lock-keywords
30 (let* ((keywords '(
32 "apply" "arpeggio" "autochange" "spanrequest" "commandspanrequest"
33 "simultaneous" "sequential" "accepts" "alternative" "bar" "breathe"
34 "char" "chordmodifiers" "chords" "clef" "cm" "consists" "consistsend"
35 "context" "denies" "duration" "dynamicscript" "elementdescriptions"
36 "font" "grace" "header" "in" "lyrics" "key" "mark" "musicalpitch"
37 "time" "times" "midi" "mm" "name" "notenames" "notes" "outputproperty"
38 "override" "set" "revert" "partial" "paper" "penalty" "property" "pt"
39 "relative" "remove" "repeat" "addlyrics" "partcombine" "score"
40 "script" "stylesheet" "skip" "textscript" "tempo" "translator"
41 "transpose" "type"
43 (kwregex (mapconcat (lambda (x) (concat "\\\\" x)) keywords "\\|")))
45 (list
46 (concat ".\\(" kwregex "\\)[^a-zA-Z]")
47 (concat "^\\(" kwregex "\\)[^a-zA-Z]")
48 '(".\\(\\\\[a-zA-Z][a-zA-Z]*\\)" 1 font-lock-variable-name-face)
49 '("^[\t ]*\\([a-zA-Z][_a-zA-Z]*\\) *=" 1 font-lock-variable-name-face)
51 "Additional expressions to highlight in LilyPond mode.")
53 ;; define a mode-specific abbrev table for those who use such things
54 (defvar LilyPond-mode-abbrev-table nil
55 "Abbrev table in use in `LilyPond-mode' buffers.")
57 (define-abbrev-table 'LilyPond-mode-abbrev-table nil)
59 (defvar LilyPond-mode-syntax-table nil
60 "Syntax table used in `LilyPond-mode' buffers.")
63 (if LilyPond-mode-syntax-table
65 (setq LilyPond-mode-syntax-table (make-syntax-table))
66 (mapcar (function
67 (lambda (x) (modify-syntax-entry
68 (car x) (cdr x) LilyPond-mode-syntax-table)))
69 '(( ?\( . "()" ) ( ?\) . ")(" ) ; need matching parens for inline lisp
70 ( ?\[ . "." ) ( ?\] . "." )
71 ( ?\{ . "(}" ) ( ?\} . "){" )
72 ( ?\< . "(>" )( ?\> . ")>")
73 ( ?\$ . "." ) ( ?\% . "." ) ( ?\& . "." )
74 ( ?\* . "." ) ( ?\+ . "." ) ( ?\- . "." )
75 ( ?\/ . "." ) ( ?\= . "." )
76 ( ?\| . "." ) (?\\ . "\\" )
77 ( ?\_ . "." )
78 ( ?\' . "w")
79 ( ?\" . "\"" )
80 ( ?\% . "<")
81 ( ?\n . ">")
83 ; FIXME
84 ; ( ?% . ". 124b" )
85 ; ( ?{ . ". 23" )