| 280 | |
| 281 | |
| 282 | class Tokens(list): |
| 283 | |
| 284 | def __init__(self, source, error=DocoptExit): |
| 285 | self += source.split() if hasattr(source, 'split') else source |
| 286 | self.error = error |
| 287 | |
| 288 | @staticmethod |
| 289 | def from_pattern(source): |
| 290 | source = re.sub(r'([\[\]\(\)\|]|\.\.\.)', r' \1 ', source) |
| 291 | source = [s for s in re.split('\s+|(\S*<.*?>)', source) if s] |
| 292 | return Tokens(source, error=DocoptLanguageError) |
| 293 | |
| 294 | def move(self): |
| 295 | return self.pop(0) if len(self) else None |
| 296 | |
| 297 | def current(self): |
| 298 | return self[0] if len(self) else None |
| 299 | |
| 300 | |
| 301 | def parse_long(tokens, options): |
no outgoing calls
no test coverage detected