kschiess / parslet

A small PEG based parser library. See the Hacking page in the Wiki as well.
kschiess.github.com/parslet
MIT License
809 stars 95 forks source link

Offset is wrong #104

Closed LeFnord closed 10 years ago

LeFnord commented 10 years ago

... in 1.6

after parsing a text, I need the offset of the parsed text, but he is wrong in 1.6

Can someone give me a hint, where can I find the place, where the offset would be computed, so I could fix it.

floere commented 10 years ago

Can you help us by providing a breaking example? (parser + input)

LeFnord commented 10 years ago

sure.

input:

" 1. A compound represented by the following formula (1):‡ 2. A compound represented by the following formula (2):‡ 3. An α1 adrenergic receptor antagonistic [...]"

in 1.5, the result is (wo transforming, the raw from parsing):

"A compound represented by the following formula (1):"@5 "A compound represented by the following formula (2):"@67

and in 1.6:

"A compound represented by the following formula (1):"@5 "A compound represented by the following formula (2):"@69

the first offset is correct, but the next are different (ergo wrong)

and, of course, its both the same input.

kschiess commented 10 years ago

Offset is computed in source.rb:40.

This is not a bug report unless you give us something to work on. I am marking this as delayed for now.

LeFnord commented 10 years ago

thanks, i try to fix/change it.

as i saw, its parse fine, but with different offset for the same input

LeFnord commented 10 years ago

fixed, see pull request #106

kschiess commented 10 years ago

Released in 1.6.1 - please give it a spin.