def _readRegExp(regExp):
"""
Discard leading white space characters from standard input. Then read
from standard input and return a string matching regular expression
regExp. Raise an EOFError if no non-whitespace characters remain
in standard input. Raise a ValueError if the next characters to
be read from standard input do not match 'regExp'.
"""
global _buffer
if isEmpty():
raise EOFError()
compiledRegExp = re.compile(r'^\s*' + regExp)
match = compiledRegExp.search(_buffer)
if match is None:
raise ValueError()
s = match.group()
_buffer = _buffer[match.end():]
return s.lstrip()
#-----------------------------------------------------------------------
评论列表
文章目录