]> git.donarmstrong.com Git - lilypond.git/commitdiff
* buildscripts/lilypond.words.py: add file. Creates lilypond.words
authorhjunes <hjunes>
Mon, 1 Sep 2003 20:56:57 +0000 (20:56 +0000)
committerhjunes <hjunes>
Mon, 1 Sep 2003 20:56:57 +0000 (20:56 +0000)
        from source files and search patterns listed in the script.

ChangeLog
buildscripts/lilypond.words.py [new file with mode: 0755]

index 12003e9a76a1e02f19c151857c7c16229b3725f7..ae1eefdae740108b011594ae16107b399fd081fb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2003-09-01  Heikki Junes  <hjunes@cc.hut.fi>
+
+       * buildscripts/lilypond.words.py: add file. Creates lilypond.words
+       from source files and search patterns listed in the script.
+
 2003-08-31  Heikki Junes  <hjunes@cc.hut.fi>
 
        * lily/parser.yy, lily/my-lily-lexer.cc: spell it acciaccatura.
diff --git a/buildscripts/lilypond.words.py b/buildscripts/lilypond.words.py
new file mode 100755 (executable)
index 0000000..86e3ecc
--- /dev/null
@@ -0,0 +1,128 @@
+#!@PYTHON@
+
+# Created 01 September 2003 by Heikki Junes.
+# Makes a lilypond.words file which is used by (X)Emacs and Vim.
+
+import string
+import re
+
+outlines = []
+prekw = '\\\\'
+
+# keywords not otherwise found
+for line in ['include','maininput','version']:
+    outlines = outlines + [prekw + line]
+
+# the main keywords
+F = open('lily/my-lily-lexer.cc', 'r')
+for line in F.readlines():
+    m = re.search(r"(\s*{\")(.*)(\",\s*.*},\s*\n)",line)
+    if m:
+       outlines = outlines + [prekw + m.group(2)]
+F.close()
+
+# keywords in markup
+F = open('scm/new-markup.scm', 'r')
+for line in F.readlines():
+    m = re.search(r"^(\s*\(cons\s*)([a-z-]*)(-markup)",line)
+    if m:
+       outlines = outlines + [prekw + m.group(2)]
+F.close()
+
+# identifiers and keywords
+for name in [
+'ly/a4-init.ly',
+'ly/chord-modifiers-init.ly',
+'ly/dynamic-scripts-init.ly',
+'ly/engraver-init.ly',
+'ly/grace-init.ly',
+'ly/gregorian-init.ly',
+'ly/performer-init.ly',
+'ly/property-init.ly',
+'ly/scale-definitions-init.ly',
+'ly/script-init.ly',
+'ly/spanners-init.ly',
+]:
+    F = open(name, 'r')
+    for line in F.readlines():
+        m = re.search(r"^([a-zA-Z]+)(\s*=)",line)
+        if m:
+           outlines = outlines + [prekw + m.group(1)]
+    F.close()
+
+# more identifiers
+for name in [
+'ly/declarations-init.ly',
+'ly/paper11-init.ly',
+'ly/paper13-init.ly',
+'ly/paper16-init.ly',
+'ly/paper19-init.ly',
+'ly/paper20-init.ly',
+'ly/paper23-init.ly',
+'ly/paper26-init.ly',
+'ly/paper-as5-init.ly',
+'ly/paper-as9-init.ly',
+'ly/paper-init.ly',
+'ly/params-init.ly',
+'ly/params-as-init.ly',
+]:
+    F = open(name, 'r')
+    for line in F.readlines():
+        m = re.search(r"^(\s*)([a-zA-Z]+)(\s*=)",line)
+        if m:
+           outlines = outlines + [prekw + m.group(2)]
+    F.close()
+
+# reserved words
+for name in [
+'ly/engraver-init.ly',
+'ly/performer-init.ly',
+]:
+    F = open(name, 'r')
+    for line in F.readlines():
+       for pattern in [
+       r"^(\s*.consists\s+\")([a-zA-Z_]+)(\")",
+       r"([\\]name\s+[\"]?)([a-zA-Z_]+)([\"]?)",
+       r"(\s+)([a-zA-Z_]+)(\s*[\\]((set)|(override)))",
+       ]:
+           m = re.search(pattern,line)
+           if m:
+               outlines = outlines + ['' + m.group(2)]
+    F.close()
+
+# the output file
+out = open('lilypond.words', 'w')
+
+# the menu in lilypond-mode.el
+for line in [
+'-/( - _ -/) -',
+'-/[ - _ -/] -',
+'-///( - _ -///) -',
+'///[ - _ ///] -',
+'-///< - _ -///! -',
+'-///> - _ -///! -',
+'//center - / << _ >> -',
+'//column - / << _ >> -',
+'//context/ Staff/ = - % { _ } -',
+'//context/ Voice/ = - % { _ } -',
+'-//markup - { _ } -',
+'//notes - { _ } -',
+'//relative - % { _ } -',
+'//score - { //n /? //simultaneous { //n _ //n } /! //n //paper {  } //n /? //midi {  } //n /! } //n -',
+'//simultaneous - { _ } -',
+'//sustainDown - _ //sustainUp -',
+'//times - % { _ } -',
+'//transpose - % { _ } -',
+]:
+    # urg. escape char '/' is replaced with '\\' which python writes as a '\'.
+    out.write(string.join(string.split(line,'/'),'\\') + '\n')
+    
+# alphabetically ordered words
+outlines.sort()
+prevline = ''
+for line in outlines:
+    if line != prevline:
+        out.write(line + '\n')
+    prevline = line
+
+out.close()