#NEWLINE# def _rule_container( self ) : #NEWLINE# #INDENT# " Parses the production rule::\n                container : NAME '{' (option | block)* '}' EOF\n\n            Returns tuple (type_name, options_list, blocks_list).\n            " #NEWLINE# type_name = self . _get_token ( self . RE_NAME ) #NEWLINE# self . _expect_token ( '{' ) #NEWLINE# options = [ ] #NEWLINE# blocks = [ ] #NEWLINE# dupe_blocks = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# while ( self . _lookahead_token ( ) != '}' ) : #NEWLINE# #INDENT# if ( self . _lookahead_token ( count = 2 ) == '{' ) : #NEWLINE# #INDENT# block = self . _rule_block ( ) #NEWLINE# name = block [ 0 ] #NEWLINE# if ( name in dupe_blocks . _block_map ) : #NEWLINE# #INDENT# dupe_blocks [ name ] = block #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _block_map [ name ] = len ( blocks ) #NEWLINE# blocks . append ( block ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# options . append ( self . _rule_option ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# if dupe_blocks : #NEWLINE# #INDENT# for ( name , block ) in dupe_blocks . iteritems ( ) : #NEWLINE# #INDENT# block_idx = self . _block_map [ name ] #NEWLINE# blocks [ block_idx ] = block #NEWLINE# #UNINDENT# #UNINDENT# self . _expect_token ( '}' ) #NEWLINE# self . _expect_empty ( ) #NEWLINE# return [ type_name , options , blocks ]