Ignore:
Timestamp:
02/22/06 19:18:34 (8 years ago)
Author:
xi
Message:

Working on Constructor.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/pyyaml3000/lib/yaml/composer.py

    r53 r55  
    8282    def compose_mapping_node(self): 
    8383        start_event = self.parser.get() 
    84         value = [] 
     84        value = {} 
    8585        while not self.parser.check(CollectionEndEvent): 
     86            key_event = self.parser.peek() 
    8687            item_key = self.compose_node() 
    8788            item_value = self.compose_node() 
    88             value.append((item_key, item_value)) 
     89            if item_key in value: 
     90                raise ComposerError("while composing a mapping", start_event.start_marker, 
     91                        "found duplicate key", key_event.start_marker) 
     92            value[item_key] = item_value 
    8993        end_event = self.parser.get() 
    9094        return MappingNode(start_event.tag, value, 
Note: See TracChangeset for help on using the changeset viewer.