def composite(self, t):
if len(t) == <NUM_LIT:1>:<EOL><INDENT>return t[<NUM_LIT:0>]  <EOL><DEDENT>key_token = t[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>attribute_dicts = t[<NUM_LIT:1>]<EOL>if not isinstance(attribute_dicts, list):<EOL><INDENT>attribute_dicts = [attribute_dicts]<EOL><DEDENT>key_name = self.key_name(key_token)<EOL>composite_dict = CaseInsensitiveOrderedDict(CaseInsensitiveOrderedDict)<EOL>composite_dict["<STR_LIT>"] = key_name<EOL>if self.include_position:<EOL><INDENT>pd = self.create_position_dict(key_token, None)<EOL>composite_dict["<STR_LIT>"] = pd<EOL><DEDENT>if self.include_comments:<EOL><INDENT>comments_dict = composite_dict["<STR_LIT>"] = OrderedDict()<EOL><DEDENT>for d in attribute_dicts:<EOL><INDENT>keys = d.keys()<EOL>if "<STR_LIT>" in keys:<EOL><INDENT>k = d["<STR_LIT>"]<EOL>if k in SINGLETON_COMPOSITE_NAMES:<EOL><INDENT>composite_dict[k] = d<EOL><DEDENT>else:<EOL><INDENT>plural_key = self.plural(k)<EOL>if plural_key not in composite_dict:<EOL><INDENT>composite_dict[plural_key] = []<EOL><DEDENT>composite_dict[plural_key].append(d)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>pos = d.pop("<STR_LIT>")<EOL>d.pop("<STR_LIT>", None)  <EOL>comments = d.pop("<STR_LIT>", None)<EOL>key_name = self.get_single_key(d)<EOL>if key_name == "<STR_LIT>":<EOL><INDENT>if key_name not in composite_dict:<EOL><INDENT>composite_dict[key_name] = CaseInsensitiveOrderedDict(CaseInsensitiveOrderedDict)<EOL><DEDENT>cfg_dict = composite_dict[key_name]<EOL>cfg_dict.update(d[key_name])<EOL>if self.include_position:<EOL><INDENT>if key_name not in pd:<EOL><INDENT>pd[key_name] = OrderedDict()<EOL><DEDENT>subkey_name = self.get_single_key(d[key_name])<EOL>pd[key_name][subkey_name] = pos<EOL><DEDENT><DEDENT>elif key_name == "<STR_LIT>":<EOL><INDENT>if key_name not in composite_dict:<EOL><INDENT>composite_dict[key_name] = d[key_name]<EOL><DEDENT>else:<EOL><INDENT>existing_points = composite_dict[key_name]<EOL>def depth(L):<EOL><INDENT>return isinstance(L, (tuple, list)) and max(map(depth, L)) + <NUM_LIT:1><EOL><DEDENT>if depth(existing_points) == <NUM_LIT:2>:<EOL><INDENT>composite_dict[key_name] = [existing_points]<EOL><DEDENT>if key_name not in composite_dict:<EOL><INDENT>composite_dict[key_name] = []<EOL><DEDENT>composite_dict[key_name].append(d[key_name])<EOL><DEDENT>if self.include_position:<EOL><INDENT>if key_name not in pd:<EOL><INDENT>pd[key_name] = pos<EOL><DEDENT>else:<EOL><INDENT>existing_pos = pd[key_name]<EOL>if isinstance(existing_pos, dict):<EOL><INDENT>pd[key_name] = [existing_pos]<EOL><DEDENT>pd[key_name].append(pos)<EOL><DEDENT><DEDENT><DEDENT>elif key_name in REPEATED_KEYS:<EOL><INDENT>if key_name not in composite_dict:<EOL><INDENT>composite_dict[key_name] = []<EOL><DEDENT>composite_dict[key_name].append(d[key_name])<EOL>if self.include_position:<EOL><INDENT>if key_name not in pd:<EOL><INDENT>pd[key_name] = []<EOL><DEDENT>pd[key_name].append(pos)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>assert len(d.items()) == <NUM_LIT:1><EOL>if self.include_position:<EOL><INDENT>pd[key_name] = pos<EOL><DEDENT>if self.include_comments and comments:<EOL><INDENT>comments_dict[key_name] = comments<EOL><DEDENT>composite_dict[key_name] = d[key_name]<EOL><DEDENT><DEDENT><DEDENT>return composite_dict<EOL>
Handle the composite types e.g. CLASS..END
t is a list in the form [[Token(__LAYER36, 'LAYER')], [OrderedDict([...])]]