Doru
 
Many thanks. I knew it must be something simple. I was nearly there, because
I had tried 'negated' as an alternative to 'not'.
 
You may regret the invitation in your last line. The documentation is rather
sparse, so there may well be more questions. I shall always try to solve it
myself first, of course.
 
Thanks also for the speedy answer - on a Saturday afternoon too!
 
Peter

  _____  

From: Pharo-users [mailto:pharo-users-boun...@lists.pharo.org] On Behalf Of
Tudor Girba
Sent: 22 February 2014 16:38
To: Any question about pharo is welcome
Subject: Re: [Pharo-users] Moose: Problem in Petit Parser


Hi, 

For Moose related questions, there exists a dedicated mailing list:
http://www.moosetechnology.org/about/contact


Related to your problem, "not" does consume the input. You want to use
"negate", which is implemented as:
PPParser>>negate
"Answer a new parser consumes any input token but the receiver." 
^ self not , #any asParser ==> #second

Keep the questions flowing :)

Cheers,
Doru


On Sat, Feb 22, 2014 at 5:25 PM, PBK Research <pe...@pbkresearch.co.uk>
wrote:



Hello All
 
Not sure whether this is the right forum for this question - please excuse
and point me in the right direction if I'm wrong.
 
I have been playing with Moose 4.8, downloaded last October, mainly because
I am interested in PetitParser. I have been constructing fairly trivial
parsers to get to understand the system. I took as an example a typical HTML
tag, i.e. any text enclosed in angle brackets <>. My first attempt was:
 
($< asParser, $> asParser not star, $> asParser).
 
This seemed to send the parser into a loop, except in the case where there
was no text between the brackets. Floundering around, I tried:
 

($< asParser, (PPPredicateObjectParser anyExceptAnyOf: '>') star, $>
asParser).
 
This worked as expected, but I was not happy with the apparent clumsiness of
the middle term. So I tried:
 

($< asParser, (PPPredicateObjectParser char: $>) not star, $> asParser).
 
This again sent the parser into a loop.
 
It looks as though I have some fundamental misunderstanding of the function
of 'not' in a parser, or else it is not working as specified. Could someone
kindly explain to an inquisitive idiot what is going wrong?
 
Many thanks in advance
 
Peter Kenny




-- 

www.tudorgirba.com

"Every thing has its own flow"

Reply via email to