Returns all chars till a non-escaped char is found. Will also consume the closing char, but and return it as second return value
(stream, chars)
| 89 | |
| 90 | |
| 91 | def _parse_till_unescaped_char(stream, chars): |
| 92 | """ |
| 93 | Returns all chars till a non-escaped char is found. |
| 94 | |
| 95 | Will also consume the closing char, but and return it as second |
| 96 | return value |
| 97 | """ |
| 98 | rv = "" |
| 99 | while True: |
| 100 | escaped = False |
| 101 | for char in chars: |
| 102 | if EscapeCharToken.starts_here(stream, char): |
| 103 | rv += next(stream) + next(stream) |
| 104 | escaped = True |
| 105 | if not escaped: |
| 106 | char = next(stream) |
| 107 | if char in chars: |
| 108 | break |
| 109 | rv += char |
| 110 | return rv, char |
| 111 | |
| 112 | |
| 113 | class Token: |