diff options
author | Michi Henning <michi@zeroc.com> | 2004-12-08 06:11:21 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2004-12-08 06:11:21 +0000 |
commit | 37fa0d032659d3291c81628f9eb85fac538cb342 (patch) | |
tree | dd8acd3eecce7e1cb2df6f908c089337ae01ab02 /cpp/config/makeprops.py | |
parent | Fixed bug in parsing for --Ice.Config: previous code dereferenced an (diff) | |
download | ice-37fa0d032659d3291c81628f9eb85fac538cb342.tar.bz2 ice-37fa0d032659d3291c81628f9eb85fac538cb342.tar.xz ice-37fa0d032659d3291c81628f9eb85fac538cb342.zip |
Added regular expression matching to property checking code.
Diffstat (limited to 'cpp/config/makeprops.py')
-rw-r--r-- | cpp/config/makeprops.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/cpp/config/makeprops.py b/cpp/config/makeprops.py index a37df868537..d49683cbe93 100644 --- a/cpp/config/makeprops.py +++ b/cpp/config/makeprops.py @@ -8,7 +8,7 @@ # # ********************************************************************** -import os, sys, shutil, re, signal, time +import os, sys, shutil, re, signal, time, string progname = os.path.basename(sys.argv[0]) infile = "" @@ -188,15 +188,20 @@ def endSection(lang): file.write("\n") return +wildcard = re.compile(".*<any>.*") + def writeEntry(lang, label, entry): file = outputFiles[0][1] if lang == "cpp": - file.write(" ") + file.write(" \"" + label + '.' + string.replace(entry, "<any>", "*") + "\",\n") elif lang == "java": - file.write(" ") + pattern = string.replace(entry, ".", "\\\\.") + pattern = string.replace(pattern, "<any>", "[^\\\\s.]+") + file.write(" " + "\"^" + label + "\\\\." + pattern + "$\",\n") elif lang == "cs": - file.write(" ") - file.write("\"" + label + '.' + entry + "\",\n") + pattern = string.replace(entry, ".", "\\.") + pattern = string.replace(pattern, "<any>", "[^\\s.]+") + file.write(" " + "@\"^" + label + "\\." + pattern + "$\",\n") def processFile(lang): @@ -213,7 +218,7 @@ def processFile(lang): # # Set up regular expressions for empty and comment lines, section headings, and entry lines. # - ignore = re.compile("^\s*(?:#.*)?$") # Empty line or comment line + ignore = re.compile("^\s*(?:#.*)?$") # Empty line or comment line section = re.compile("^\s*([a-zA-z_]\w*)\s*:\s*$") # Section heading entry = re.compile("^\s*([^ \t\n\r\f\v#]+)(?:\s*#.*)?$") # Any non-whitespace character sequence, except for # @@ -235,8 +240,8 @@ def processFile(lang): labels = {} # Records the line number on which each label is defined atSectionStart = 0 # True for the line on which a label is defined - seenSection = 0 # Set to true (and the remains as true) once the first label is defined - numEntries = 0 # Number of entries within a section + seenSection = 0 # Set to true (and the remains as true) once the first label is defined + numEntries = 0 # Number of entries within a section errors = 0 # Number of syntax errors in the input file # |