Help Petit Parse

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Help Petit Parse

Pau Guillot
Hello,
I can not manage this syntax that seems to be simple.

MyParser parse: 'A123A123'  -> '123123'
not: #('123' '123')

(#word asParser , #digit asParser plus flatten ==> [:node | node second])
star parse: 'A123A123'.
-> #('123' '123')

(#word asParser , #digit asParser plus flatten ==> [:node | node second])
star flatten parse: 'A123A123'. -> 'A123A123'


Thank you.




--
Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Reply | Threaded
Open this post in threaded view
|

Re: Help Petit Parse

Holger Freyther


> On 12. Mar 2018, at 23:07, Pau Guillot <[hidden email]> wrote:
>
> (#word asParser , #digit asParser plus flatten ==> [:node | node second])
> star parse: 'A123A123'.
> -> #('123' '123')

(((#word asParser , #digit asParser plus flatten ==> [:node | node second]) plus) ==> [ :node  | '' join: node]) parse: 'a123a123'
=> '123123'

probably there is a nicer way. ;)
Reply | Threaded
Open this post in threaded view
|

Re: Help Petit Parse

Tudor Girba-2
That is indeed the solution.

Doru


> On Mar 13, 2018, at 6:16 AM, Holger Freyther <[hidden email]> wrote:
>
>
>
>> On 12. Mar 2018, at 23:07, Pau Guillot <[hidden email]> wrote:
>>
>> (#word asParser , #digit asParser plus flatten ==> [:node | node second])
>> star parse: 'A123A123'.
>> -> #('123' '123')
>
> (((#word asParser , #digit asParser plus flatten ==> [:node | node second]) plus) ==> [ :node  | '' join: node]) parse: 'a123a123'
> => '123123'
>
> probably there is a nicer way. ;)

--
www.tudorgirba.com
www.feenk.com

“Live like you mean it."


Reply | Threaded
Open this post in threaded view
|

Re: Help Petit Parse

Pau Guillot