def parse(self, text, fn=None):
if PY2 and not isinstance(text, unicode):<EOL><INDENT>text = unicode(text, '<STR_LIT:utf-8>')<EOL><DEDENT>if self.expand_includes:<EOL><INDENT>text = self.load_includes(text, fn=fn)<EOL><DEDENT>try:<EOL><INDENT>self._comments[:] = []  <EOL>tree = self.lalr.parse(text)<EOL>if self.include_comments:<EOL><INDENT>self.assign_comments(tree, self._comments)<EOL><DEDENT>return tree<EOL><DEDENT>except (ParseError, UnexpectedInput) as ex:<EOL><INDENT>if fn:<EOL><INDENT>log.error("<STR_LIT>".format(fn))<EOL><DEDENT>else:<EOL><INDENT>log.error("<STR_LIT>")<EOL><DEDENT>log.info(ex)<EOL>raise<EOL><DEDENT>
Parse the Mapfile