Example #1
0
 def __parse_section__(self, conditions):
     command = re.search(r"\w+", self.current.data).group()
     result = {"data": []}
     self.next()
     result["name"] = self.__parse_arguments__()
     result["data"] = self.__recursive_parse__(conditions)
     result = utilities.del_empty_keys(result)
     return {command: result}
Example #2
0
 def __parse_function__(self):
     command = re.search(r"\w+", self.current.data).group()
     result = {"arguments": [], "options": []}
     self.next()
     while self.current.name in ["StartOption", "StartArgument"]:
         if self.current.name == "StartOption":
             result["options"] += self.__parse_options__()
         elif self.current.name == "StartArgument":
             result["arguments"] += self.__parse_arguments__()
     result = utilities.del_empty_keys(result)
     return {command: result}
Example #3
0
 def __parse_object__(self):
     result = {"options": []}
     command = self.current.name.replace("Begin", "")
     condition = [self.current.name.replace("Begin", "End")]
     self.next()
     if self.current.name == "StartOption":
         result["options"] += self.__parse_options__()
     result["data"] = self.__recursive_parse__(condition)
     if self.current.name in condition:
         self.next()
     else:
         raise error.TeXError(error.SYNTAX.format(self.current.name, condition))
     result = utilities.del_empty_keys(result)
     return {command: result}