Thank you, Frank. I'll try your suggestion. El dom, 7 jul 2024 a las 6:19, vfclists (<vfcli...@gmail.com>) escribió:
> > > On Fri, 5 Jul 2024 at 10:39, Rafael Luque <rafael.luque.le...@gmail.com> > wrote: > >> Hi all, >> >> I'm struggling with a small parser using PetitParser2. Here is a fragment >> of some of the rules I'm defining but their behaviour is not as I could >> expect: >> >> andKeyword := 'and' asPParser trim, #letter asPParser not. >> notKeyword := 'not' asPParser trim, #letter asPParser not. >> keyword := andKeyword / notKeyword. >> nonKeywordIdentifier := keyword not, #letter asPParser, #word asPParser >> star. >> word := nonKeywordIdentifier, #blank asPParser star. >> words := word star. >> >> The behaviour of the "nonKeywordIdentifier" is the expected: >> >> identifier end parse: 'hello'. "It parses successfully" >> identifier end parse: 'and'. "It fails as 'and' is a keyword" >> >> However the "words" rule's behavior is the following: >> >> words end parse: 'hello Pharo'. "It parses successfully" >> words end parse: 'hello and bye'. "It parses, when I would expect it >> fails because of 'and' is a keyword" >> >> I don't understand why the "words" rule works this way, but I'm starting >> with PetitParser. Any suggestions? >> >> Thank you. >> > > You might consider asking on stackoverflow. > > A PetitParser2 question has been answered there recently. > -- > Frank Church > > ======================= > >