left = dol + 1
while left < n and (string[left].isalnum() or string[left] in '-_'):
left += 1
- prop = string[dol + 1:left].replace('-', '_')
+ prop = string[dol + 1:left]
## If we came up empty, report an error.
if prop == '':
"invalid placeholder (empty name) in `%s'" % string
## Extend the path: we're going to do a recursive expansion.
+ prop = prop.replace('-', '_')
path.append(prop)
## Report a cycle if we found one.
continue
if line[0] == '[' and line[-1] == ']':
sect = line[1:-1]
+ if sect not in d:
+ d[sect] = Section(sect)
continue
## Parse an assignment.
raise UserError, "%s:%d: bad name `%s'" % (filename, n, name)
## Store the assignment.
- try:
- d[sect][name] = value
- except KeyError:
- s = Section(sect)
- d[sect] = s
- s[name] = value
+ d[sect][name] = value
###--------------------------------------------------------------------------
### Main program.