console_input.py 422 B

1234567891011121314
  1. class ConsoleInput(object):
  2. def __init__(self, token_stream):
  3. self.stream = token_stream
  4. def run(self):
  5. while True:
  6. try:
  7. cmd = raw_input('> ')
  8. for token in cmd.split(' '):
  9. token = token.strip()
  10. if token:
  11. self.stream.add_token(token)
  12. except EOFError:
  13. return