Help Petit Parse
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
On 12. Mar 2018, at 23:07, Pau Guillot <emailpauguillotpuig@gmail.com> 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. ;)
That is indeed the solution. Doru
On Mar 13, 2018, at 6:16 AM, Holger Freyther <holger@freyther.de> wrote:
On 12. Mar 2018, at 23:07, Pau Guillot <emailpauguillotpuig@gmail.com> 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."
Thank you both, Pau -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
participants (3)
-
Holger Freyther -
Pau Guillot -
Tudor Girba