class ParseError(Exception):
def __init__(self, parser):
super().__init__("Parse error at position %u (near %r)" % (
- parser._pos, parser._data[parser._pos:parser._pos + 20]
+ parser._pos, parser._data[parser._pos:parser._pos + 100]
))
([0-9]{3})?
''')
_REGEX_EOF = re.compile(r'\Z')
-_REGEX_NL = re.compile(r'(?:\r\n|[\r\n])')
+_REGEX_NL = re.compile(r'(?:\r\n|[\r\n]|$)')
_REGEX_BLANK = re.compile(r'(?:\r\n|[\r\n])+')
+_REGEX_OPTIONAL_WHITESPACE = re.compile(r'[ \t]*')
def _parse_ts(ts):
A WebVTT block that may only appear in the header part of the file,
i.e. before any cue blocks.
"""
-
pass
if not m1:
return None
m2 = parser.consume(cls._REGEX_SETTINGS)
+ parser.consume(_REGEX_OPTIONAL_WHITESPACE)
if not parser.consume(_REGEX_NL):
return None