Changeset 1454
- Timestamp:
- 06/06/08 12:10:29 (7 months ago)
- Files:
-
- sandbox/astormont/RegParser.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/astormont/RegParser.py
r1453 r1454 8 8 class RegParser( ConfigParser ): 9 9 10 header= "REGEDIT 4"10 HEADER = "REGEDIT 4" 11 11 12 # Fixed regex for .regs. Handles quotes better than the default class, too. 13 OPTCRE = re.compile( r'"?(?P<option>[^:=\s][^="]*)"?\s*(?P<vi>[:=])\s*"?(?P<value> .*)"?$' )12 # Fixed regex for .regs. Handles quotes better than the default class, too. 13 OPTCRE = re.compile( r'"?(?P<option>[^:=\s][^="]*)"?\s*(?P<vi>[:=])\s*"?(?P<value>[^"]*)' ) 14 14 15 15 # Disable case-insensitivty … … 49 49 # skip first line (contains file header like: REGEDIT 4, or WINE REGISTRY 2) 50 50 if lineno == 1 and not line.startswith(";") and not line.startswith("["): 51 self. header= line51 self.HEADER = line 52 52 continue 53 53 # comment or blank line? … … 79 79 # no section header in the file? 80 80 elif cursect is None: 81 continue81 raise MissingSectionHeaderError(fpname, lineno, line) 82 82 # an option line? 83 83 else: … … 92 92 optval = optval[:pos] 93 93 optval = optval.strip() 94 # Strip the quotes off the name & val, fix @95 #if optname == "@":96 # optname = ""97 #elif optname.startswith("\"") and optname.endswith("\""):98 # optname = optname[1:-1]99 #if optval.startswith("\"") and optval.endswith("\""):100 # optval = optval[1:-1]101 94 cursect[optname] = optval 102 95 else:
