]> git.donarmstrong.com Git - lilypond.git/blobdiff - lilypond-font-lock.el
release: 1.5.41
[lilypond.git] / lilypond-font-lock.el
index 166db820be7af570ac990a679fa10fc6c6b81125..4a09294c56a41af73aff863feb981ee13ed92500 100644 (file)
@@ -24,9 +24,7 @@
 ;;
 
 ;; TODO:
-;;   - should handle block comments too.
 ;;   - handle lexer modes (\header, \melodic, \lyric) etc.
-;;   - indentation
 
 (defconst LilyPond-font-lock-keywords
   (let* ((keywords '( ; need special order due to over[lapping] of words
@@ -72,7 +70,7 @@
 
 ;; in principle, have one or more uppercase letters
 "\\(\\(BarNumbering\\|Choir\\|Grand\\|HaraKiri\\|OrchestralPart\\|Piano\\|Rhythmic\\)Staff\\|\\(Cue\\|Lyrics\\)?Voice\\|\\(Orchestral\\)?Score\\|ChordNames\\|Grace\\|Lyrics\\|StaffGroup\\|Thread\\)Context" ; *Context
-"\\(script\\|dots\\|dynamic\\|slur\\|stem\\|sustain\\|tie\\|tuplet\\)\\(Both\\|Down\\|Up\\)" ; *(Both/Down/Up)
+"\\(script\\|dots\\|dynamic\\|slur\\|stem\\|sustain\\|sostenuto\\|unaCorda\\|treCorde\\|tie\\|tuplet\\)\\(Both\\|Down\\|Up\\)" ; *(Both/Down/Up)
 "\\(slur\\|tie\\)\\(Dotted\\|Solid\\)" ; *(Dotted/Solid)
 "\\(autoBeam\\|cadenza\\|impro\\|turn\\)\\(Off\\|On\\)" ; *(On/Off)
 "\\(empty\\|fat\\)Text" ; *Text
 ;; highlight keywords
       (cons (concat "\\([_^]?\\(" kwregex "\\)\\)+\\($\\|[] \t(~{}>\\\\]\\)") '(0 font-lock-keyword-face t))
 
-      '("\\([][><}{]\\)" 0 font-lock-warning-face t)
+;; highlight bracketing constructs
+      '("\\([][}{]\\)" 0 font-lock-warning-face t)
+;; these regexps allow angle-brackets to be highlighted,
+;; but leave accented notes, e.g. a b c->, alone
+      '("[^\\]\\(<\\)" 1 font-lock-warning-face t)
+      '("[_^-]\\s-*[-^]\\s-*\\(>\\)" 1 font-lock-warning-face t)
+      '("[^\\t\\n _^-]\\s-*\\(>\\)" 1 font-lock-warning-face t)
 
       '("\\([(~)]\\|\\\\<\\|\\\\!\\|\\\\>\\)" 0 font-lock-builtin-face t)
 
   (mapcar (function
           (lambda (x) (modify-syntax-entry
                        (car x) (cdr x) LilyPond-mode-syntax-table)))
-         '(( ?\( . "()" ) ( ?\) . ")(" )   ; need matching parens for inline lisp
-           ( ?\[ . "." ) ( ?\] . "." )
-           ( ?\{ . "(}" ) ( ?\} . "){" )
-           ( ?\< . "(>" )( ?\> . ")>") 
+         '(( ?\( . "." ) ( ?\) . "." ) 
+           ( ?\[ . "." ) ( ?\] . "." )
+           ( ?\{  .  "(}2b" )
+           ( ?\}  .  "){4b" )
+           ( ?\< . "." )( ?\> . ".") 
            ( ?\$ . "." ) ( ?\% . "." ) ( ?\& . "." )
-           ( ?\* . "." ) ( ?\+ . "." ) ( ?\- . "." )
+           ( ?\* . "." ) ( ?\+ . "." )
            ( ?\/ . "." )  ( ?\= . "." )
            ( ?\| . "." ) (?\\ . "\\" )
-           ( ?\_ . "." )       
+           ( ?\- . "." ) ( ?\_ . "." ) ( ?\^ . "." )
            ( ?\' . "w")        
            ( ?\" . "\"" )
-           ( ?\% . "<")
+           ( ?\%  .  ". 1b3b" )
            ( ?\n . ">")
-
-; FIXME
-;          ( ?%  .  ". 124b" )
-;          ( ?{  .  ". 23" )
+           ( ?\r . ">")
            ))
-
-  )    
+  )