3 # Created 01 September 2003 by Heikki Junes.
4 # Generates lilypond-words.el for (X)Emacs and lilypond-words[.vim] for Vim.
14 # keywords not otherwise found
15 for line
in ['include','maininput','version']:
19 F
= open('lily/lily-lexer.cc', 'r')
20 for line
in F
.readlines():
21 m
= re
.search(r
"(\s*{\")(.*)(\",\s
*.*},\s
*\n)",line)
23 kw = kw + [m.group(2)]
27 F = open('scm/markup.scm', 'r')
28 for line in F.readlines():
29 m = re.search(r"^
(\s
*\
(cons\s
*)([a
-z
-]*)(-markup
)",line)
31 kw = kw + [m.group(2)]
34 # identifiers and keywords
36 'ly/chord-modifiers-init.ly',
37 'ly/dynamic-scripts-init.ly',
38 'ly/engraver-init.ly',
40 'ly/gregorian-init.ly',
41 'ly/music-functions-init.ly',
42 'ly/performer-init.ly',
43 'ly/property-init.ly',
44 'ly/scale-definitions-init.ly',
46 'ly/spanners-init.ly',
49 for line in F.readlines():
50 m = re.search(r"^
([a
-zA
-Z
]+)(\s
*=)",line)
52 kw = kw + [m.group(1)]
57 'ly/declarations-init.ly',
58 'ly/declarations-init.ly',
62 for line in F.readlines():
63 m = re.search(r"^
(\s
*)([a
-zA
-Z
]+)(\s
*=)",line)
65 kw = kw + [m.group(2)]
72 'ly/drumpitch-init.ly',
84 for line in F.readlines():
85 m = re.search(r"^
(\s
*\
()([a
-z
]+)([^l
]+ly
:make
-pitch
)",line)
87 notes = notes + ['' + m.group(2)]
94 'ly/engraver-init.ly',
95 'ly/performer-init.ly',
98 for line in F.readlines():
100 r"^
(\s
*.consists\s
+\")([a
-zA
-Z_
]+)(\")",
101 r"([\\]name\s
+[\"]?
)([a
-zA
-Z_
]+)([\"]?
)",
102 r"(\s
+)([a
-zA
-Z_
]+)(\s
*[\\]((set)|
(override
)))",
104 m = re.search(pattern,line)
106 rw = rw + ['' + m.group(2)]
111 suffix = ['skip','skip','skip'];
113 for s in sys.argv[1:]:
120 m = re.search(r"(--dir=)(\S
*)",s)
125 outs[0] = open(outdir+'/lilypond-words'+suffix[0], 'w')
127 outs[1] = open(outdir+'/lilypond-words'+suffix[1], 'w')
129 outs[2] = open(outdir+'/lilypond-words'+suffix[2], 'w')
131 # alphabetically ordered words
136 outs[2].write('syn match lilyKeyword \"[-_^]\\?\\\\\\(');
140 outs[0].write('\\\\' + line + '\n')
142 outs[1].write('\\\\' + line + '\n')
144 outs[2].write(line + '\\|')
147 outs[2].write('n\\)\\(\\A\\|\\n\\)\"me=e-1\n')
153 outs[2].write('syn match lilyReservedWord \"\\(\\A\\|\\n\\)\\(')
157 outs[0].write(line + '\n')
159 outs[1].write(line + '\n')
161 outs[2].write(line + '\\|')
164 outs[2].write('Score\\)\\(\\A\\|\\n\\)\"ms=s+1,me=e-1\n')
170 outs[2].write('syn match lilyNote \"\\<\\(\\(\\(');
174 outs[0].write(line + '\n')
176 outs[1].write(line + '\n')
178 outs[2].write(line + '\\|')
181 outs[2].write('a\\)\\([,\']\\)\\{,4}\\([?!]\\)\\?\\)\\|s\\|r\\)\\(\\(128\\|64\\|32\\|16\\|8\\|4\\|2\\|1\\|\\\\breve\\|\\\\longa\\|\\\\maxima\\)[.]\\{,8}\\)\\?\\(\\A\\|\\n\\)\"me=e-1\n')
183 # the menu in lilypond-mode.el
193 '//center - / << _ >> -',
194 '//column - / << _ >> -',
195 '//context/ Staff/ = - % { _ } -',
196 '//context/ Voice/ = - % { _ } -',
197 '//markup - { _ } -',
199 '//relative - % { _ } -',
200 '//score - { //n /? //simultaneous { //n _ //n } /! //n //paper { } //n /? //midi { } //n /! } //n -',
201 '//simultaneous - { _ } -',
202 '//sustainDown - _ //sustainUp -',
203 '//times - % { _ } -',
204 '//transpose - % { _ } -',
206 # urg. escape char '/' is replaced with '\\' which python writes as a '\'.
208 outs[1].write(string.join(string.split(line,'/'),'\\') + '\n')