diff options
author | nyamatongwe <unknown> | 2005-10-23 00:35:39 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2005-10-23 00:35:39 +0000 |
commit | 2d90437c0d0d57e530ab5d0c6a1a3571f881be9a (patch) | |
tree | f57eecf63e24923e86cf78d507be01a5ec8c94fc /src/LexGen.py | |
parent | abd99896207afcf383ae2b93ac29e46f7efd5b74 (diff) | |
download | scintilla-mirror-2d90437c0d0d57e530ab5d0c6a1a3571f881be9a.tar.gz |
Added gathering of property names used in lexers and folders so they can be
automatically forwarded from SciTE.
Corrected sorting.
Diffstat (limited to 'src/LexGen.py')
-rw-r--r-- | src/LexGen.py | 38 |
1 files changed, 36 insertions, 2 deletions
diff --git a/src/LexGen.py b/src/LexGen.py index 4ad1bfaed..97a40b4b0 100644 --- a/src/LexGen.py +++ b/src/LexGen.py @@ -159,9 +159,38 @@ def FindModules(lexFile): l = l.replace("(", " ") modules.append(l.split()[1]) return modules + +knownIrregularProperties = [ + "fold", + "styling.within.preprocessor", + "tab.timmy.whinge.level", + "asp.default.language", + "html.tags.case.sensitive", + "ps.level", + "ps.tokenize", + "sql.backslash.escapes", + "nsis.uservars", + "nsis.ignorecase" +] + +def FindProperties(lexFile): + properties = set() + f = open(lexFile) + for l in f.readlines(): + if "GetProperty" in l: + l = l.strip() + if not l.startswith("//"): # Drop comments + propertyName = l.split("\"")[1] + if propertyName.lower() == propertyName: + # Only allow lower case property names + if propertyName in knownIrregularProperties or \ + propertyName.startswith("fold.") or \ + propertyName.startswith("lexer."): + properties.add(propertyName) + return properties def ciCompare(a,b): - return a.lower() < b.lower() + return cmp(a.lower(), b.lower()) def RegenerateAll(): root="../../" @@ -171,9 +200,14 @@ def RegenerateAll(): lexFiles = [os.path.basename(f)[:-4] for f in lexFilePaths] print lexFiles lexerModules = [] + lexerProperties = set() for lexFile in lexFilePaths: lexerModules.extend(FindModules(lexFile)) + lexerProperties.update(FindProperties(lexFile)) lexerModules.sort(ciCompare) + lexerProperties.remove("fold.comment.python") + lexerProperties = list(lexerProperties) + lexerProperties.sort(ciCompare) # Find all the SciTE properties files otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"] @@ -200,7 +234,7 @@ def RegenerateAll(): Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles) Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles) Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, lexFiles, propFiles) - Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, ids) + Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, lexerProperties, ids) Generate(root + "scite/boundscheck/vcproj.gen", root + "scite/boundscheck/SciTE.vcproj", "#", NATIVE, lexFiles) |