def parse_title(self):
     title = self.pop(0).astext().strip()
     option = extract_option(title)
     if title in HTTP_METHODS:
         # <HTTP request method>
         self["identifier"] = ""
         self["http_method"] = title
         self["uri"] = None
     elif option is None:
         # <HTTP request method> <URI template>
         http_method, uri = title.split()
         self["identifier"] = ""
         self["http_method"] = http_method
         self["uri"] = uri
     else:
         matched = re.search("^(.*)\s+\[(.*)\]$", title)
         self["identifier"] = matched.group(1)
         parts = matched.group(2).split()
         if len(parts) == 1:
             # <identifier> [<HTTP request method>]
             self["http_method"] = parts[0]
             self["uri"] = None
         else:
             # <identifier> [<HTTP request method> <URI template>]
             self["http_method"] = parts[0]
             self["uri"] = parts[1]
 def parse_title(self):
     title = self.pop(0).astext()
     parts = title.split()
     option = extract_option(title)
     if len(parts) == 1:
         # <URI template>
         self["identifier"] = ""
         self["uri"] = parts[0]
     else:
         # <identifier> [<URI template>]
         self["identifier"] = re.sub("\s*\[(.*)\]$", "", title)
         self["uri"] = option