Fork me on GitHub
#instaparse
<
2015-08-27
>
ska07:08:58

@nodename: One Char is a character from the range given in the regexp. You allow many Chars with the +. Maybe you want Term = Char

ska07:08:14

Char = #'[a-z]+'

ska07:08:03

So that the regexp eats the characters. Of course then "Char" is not a really good name anymore and might become sth like Symbol or Name

nodename07:08:57

Yes, that works, but I expected what I had to work too. Don’t see why not.

ska07:08:57

It actually does that, it's just not the first result. Your grammar is ambiguous. See the result of insta/parses

ska07:08:25

The reason is, that + in instaparse is not greedy but allows all possible paths whereas + in the regexp would be greedy

nodename07:08:32

Ah, thanks. Do you know how I could modify Term to make it greedy?

ska07:08:07

My approach would be to use the regexp mentioned above. To me that is kinda the tokenization step in instaparse. I don't know if other solutions exists from the top off my head

ska07:08:23

Looks like I tried that already and came to the conclusion that there is no other way: https://github.com/ska2342/sourcetalk14/blob/master/de.skamphausen.stt14/src/de/skamphausen/stt14.clj#L460

nodename07:08:21

Ha, OK, will read! Thanks!