From dba24ee3bc4ae133b40726b6d03404451ee60152 Mon Sep 17 00:00:00 2001 From: Heikki Junes Date: Mon, 1 Sep 2003 20:56:57 +0000 Subject: [PATCH] * buildscripts/lilypond.words.py: add file. Creates lilypond.words from source files and search patterns listed in the script. --- ChangeLog | 5 ++ buildscripts/lilypond.words.py | 128 +++++++++++++++++++++++++++++++++ 2 files changed, 133 insertions(+) create mode 100755 buildscripts/lilypond.words.py diff --git a/ChangeLog b/ChangeLog index 12003e9a76..ae1eefdae7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2003-09-01 Heikki Junes + + * buildscripts/lilypond.words.py: add file. Creates lilypond.words + from source files and search patterns listed in the script. + 2003-08-31 Heikki Junes * 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 index 0000000000..86e3ecc818 --- /dev/null +++ b/buildscripts/lilypond.words.py @@ -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() -- 2.39.5