strscan-js icon indicating copy to clipboard operation
strscan-js copied to clipboard

Failed `check` interferes with `unscan`

Open Phrogz opened this issue 14 years ago • 0 comments

var s1 = new StringScanner("a2z"); s1.scan(/a/); s1.scan(/\d+/); s1.check(/z/); s1.unscan(); console.log(s1.getPosition()) // Correctly outputs "1"

var s2 = new StringScanner("a2z"); s2.scan(/a/); s2.scan(/\d+/); s2.check(/O/); s2.unscan(); // "nothing to unscan"

Phrogz avatar Jul 25 '11 20:07 Phrogz