(commands: io.TextIOWrapper)
| 52 | |
| 53 | @staticmethod |
| 54 | def _tokenize_default(commands: io.TextIOWrapper) -> Tokens: |
| 55 | # The default set of commands are each a single character. |
| 56 | # So tokenizing is really easy. Yay. |
| 57 | while True: |
| 58 | chunk = commands.read(256) |
| 59 | if not chunk: |
| 60 | break |
| 61 | for char in chunk: |
| 62 | yield char |
| 63 | |
| 64 | def interpret(self, tokens: Tokens) -> Lines: |
| 65 | """Interpret the given tokens as 3D Turtle commands.""" |