Re: [Pharo-users] PetitParser question

2019-01-30 Thread Tudor Girba
Great. I am happy you found a solution :) Cheers, Doru > On Jan 30, 2019, at 3:37 PM, Konrad Hinsen wrote: > > Tudor Girba writes: > >> Would this not work: > > It works. And as much as I hate to admit it, my version of yesterday was > very similar except ... that it lacked a set of parenth

Re: [Pharo-users] PetitParser question

2019-01-30 Thread Konrad Hinsen
Tudor Girba writes: > Would this not work: It works. And as much as I hate to admit it, my version of yesterday was very similar except ... that it lacked a set of parentheses :-( > Please note that I used PetitParser2 for this one because it also > addresses the failure message issue you raise

Re: [Pharo-users] PetitParser question

2019-01-29 Thread Tudor Girba
Hi, > On Jan 29, 2019, at 7:04 PM, Konrad Hinsen wrote: > > Tudor Girba writes: > >> But, does it solve your problem? > > Not yet. Not sure it will. Would this not work: p := (#digit asPParser separatedBy: ($+ asPParser / $- asPParser) trim) ==> [:tokens | | result | resu

Re: [Pharo-users] PetitParser question

2019-01-29 Thread Konrad Hinsen
Tudor Girba writes: > But, does it solve your problem? Not yet. Not sure it will. >> More generally, there seems to be a bug in how PetitParser handles >> PPFailure return values. The actually reported error is always different >> from what is passed to PPFailure. I love software ;-) > > What d

Re: [Pharo-users] PetitParser question

2019-01-29 Thread Tudor Girba
Hi, > On Jan 29, 2019, at 6:31 PM, Konrad Hinsen wrote: > > Hi Doru, > > Thanks for pointing out the use case in XML, which gave me an > opportunity to play around with this with almost no > effort. Unfortunately there seems to be a bug in how PPXmlParser > constructs the PPFailure message > (

Re: [Pharo-users] PetitParser question

2019-01-29 Thread Konrad Hinsen
Hi Doru, Thanks for pointing out the use case in XML, which gave me an opportunity to play around with this with almost no effort. Unfortunately there seems to be a bug in how PPXmlParser constructs the PPFailure message (freshly reported: https://github.com/moosetechnology/PetitParser/issues/38).

Re: [Pharo-users] PetitParser question

2019-01-27 Thread Tudor Girba
Hi Konrad, A somewhat similar issue is present in an XML grammar: the closing element must match the opening element. In PPXmlGrammar, you have a condition that matches it and throws a failure otherwise: element "[39] element::= EmptyElemTag | STag content ETag"

Re: [Pharo-users] PetitParser question

2019-01-27 Thread Konrad Hinsen
Dear Tomo, This post might help you. In case of PetitParser2, it's PP2Failure instead of PPFailure. https://stackoverflow.com/questions/15371334/how-can-a-petitparser-parse-rule-signal-an-error That's indeed a possible solution: parse for arbitrary operators, and then add a test for equality

Re: [Pharo-users] PetitParser question

2019-01-26 Thread tomo
Dear Konrad, This post might help you. In case of PetitParser2, it's PP2Failure instead of PPFailure. https://stackoverflow.com/questions/15371334/how-can-a-petitparser-parse-rule-signal-an-error Best Regards, --- tomo -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Re: [Pharo-users] PetitParser Question

2018-03-06 Thread Asbath via Pharo-users
--- Begin Message --- OK, Thanks, Asbath On 06/03/2018 08:43, Julien wrote: Hello, I think this blogpost is a good place to start: https://www.lukas-renggli.ch/blog/petitparser-1 There is also the chapter about PetitParser in Deep Into Pharo: http://pharobooks.gforge.inria.fr/PharoByExam

Re: [Pharo-users] PetitParser Question

2018-03-05 Thread Julien
Hello, I think this blogpost is a good place to start: https://www.lukas-renggli.ch/blog/petitparser-1 There is also the chapter about PetitParser in Deep Into Pharo: http://pharobooks.gforge.inria.fr/PharoByExampleTwo-Eng/latest/PetitParser.pd

Re: [Pharo-users] PetitParser Question

2018-03-05 Thread Stephane Ducasse
Hi Asbath there is a chapter on Pillar in deep into pharo or the next book. You also have a chapter on the http://themoosebook.org Stef On Mon, Mar 5, 2018 at 7:26 PM, Asbath via Pharo-users wrote: > > > -- Forwarded message -- > From: Asbath > To: pharo-users@lists.pharo.org >

Re: [Pharo-users] PetitParser question parsing HTML meta tags

2017-04-05 Thread Paul DeBruicker
Thanks. I really appreciate everyone's help on this. Was at a high level of frustration the other day. monty-3 wrote > You could use XMLHTMLParser from STHub PharoExtras/XMLParserHTML > (supported on Pharo, Squak, and GS): > > descriptions := OrderedCollection new. > (XMLHTMLParser par

Re: [Pharo-users] PetitParser question parsing HTML meta tags

2017-04-02 Thread monty
XMLParserHTML is the fastest HTML parser on Pharo, Squeak, and GS. It has DOM and SAX parsers and works with other libs such as PharoExtras/XPath and PharoExtras/XMLParserStAX. Element and attribute names are normalized to lowercase, and printing XML DOM trees back as HTML is complicated by bro

Re: [Pharo-users] PetitParser question parsing HTML meta tags

2017-03-31 Thread monty
You could use XMLHTMLParser from STHub PharoExtras/XMLParserHTML (supported on Pharo, Squak, and GS): descriptions := OrderedCollection new. (XMLHTMLParser parseURL: aURL) allElementsNamed: 'meta' do: [:each | ((each attributeAt: 'name') asLowercase = 'description'

Re: [Pharo-users] PetitParser question parsing HTML meta tags

2017-03-30 Thread Martin McClure
On 03/30/2017 10:58 AM, PAUL DEBRUICKER wrote: > I can't figure out how to change the startParser parser to accept the second > idiom. And maybe there's a better approach altogether. Anyway. If anyone > has any ideas on different approaches I'd appreciate learning them. This looks like a jo