Changeset 316

Show
Ignore:
Timestamp:
05/31/08 00:07:03 (4 years ago)
Author:
simon
Message:

Support for spells and notes sections.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • hodgestar/PythonCode/DmTools/l5rchars.py

    r312 r316  
    3131        sSection = None 
    3232        aSectionsLeft = ["name","clan","rank","rings","skills","adv and dis","kata"] 
     33        aOptionalSectionsLeft = ["notes","spells"] 
    3334        self.parse_error = None # (line #, line) 
    3435 
     
    3940            if oM: 
    4041                sSection = oM.group("section").lower().strip() 
    41                 assert sSection in aSectionsLeft 
    42                 aSectionsLeft.remove(sSection) 
     42                if sSection in aSectionsLeft: 
     43                    aSectionsLeft.remove(sSection) 
     44                elif sSection in aOptionalSectionsLeft: 
     45                    aOptionalSectionsLeft.remove(sSection) 
     46                else: 
     47                    raise RuntimeError("Unknown or duplicate section %s." % (sSection,)) 
    4348 
    4449                if sSection == "name": 
     
    101106                self.kata[sKata] = iXp 
    102107 
     108            elif sSection == "spells" and sLine.strip(): 
     109                pass 
     110 
     111            elif sSection == "notes" and sLine.strip(): 
     112                pass 
     113 
    103114            else: 
    104115                assert not sLine.strip()