sliekens / Txt

A text parsing framework for .NET.
MIT License
2 stars 4 forks source link

Improve pushback behavior #4

Closed sliekens closed 9 years ago

sliekens commented 9 years ago

Being able to backtrack within a text source is an important requirement for most parsing algorithms.

Backtracking is currently implemented like this:

Right now, the TextScanner class implements both behaviors using a complex soup of if..else blocks to determine which of the two strategies to use.

Instead, I want to split the TextScanner class into two classes, where each class implements one of the two backtracking strategies: