How to make R2 parse 'to' word accept arguments ?
Hello, This works in Red and R3 but not in R2 What's the better way to achieve the following in R2 ? space: " " dash: "-" text: "321 255-6665" digit: charset "0123456789" separator: ["-" | space ] rule:[ copy areacode 3 digit to separator skip any space copy first3digit 3 digit to separator skip copy last4digit 4 digit to end] parse text rule print areacode print first3digit print last4digit Thanks !
posted by: OneArb 29-Apr-2014/18:31:20-7:00
You can use 'compose to build the parse rule: R E B O L [] space: " " dash: "-" text: "321 255-6665" digit: charset "0123456789" separator: compose/deep [[to (space) | to "-"]] rule: compose [ copy areacode (separator) copy first3digit (separator) skip any (dash) copy last4digit 4 digit to end ] probe rule parse text rule print areacode print trim first3digit print last4digit halt
posted by: Nick 1-May-2014/3:49:08-7:00
Actually, all you need to compose in this case is the separator: R E B O L [] space: " " dash: "-" text: "321 255 6665" digit: charset "0123456789" separator: compose [opt (dash) | opt (space)] rule: [ copy areacode 3 digit separator copy first3digit 3 digit separator copy last4digit to end ] probe rule parse text rule probe areacode probe first3digit probe last4digit halt And if you don't want to count the digits: R E B O L [] space: " " dash: "-" text: "321 255-6665" digit: charset "0123456789" separator: compose [to (space) | to "-"] nxt: compose [opt dash | opt space] rule: [ copy areacode separator nxt copy first3digit separator nxt copy last4digit to end ] probe rule parse text rule probe areacode probe first3digit probe last4digit halt
posted by: Nick 1-May-2014/3:51:55-7:00
Nick, Thanks for the tips. This comparison got me more curious about R3 and Saphirion. Could you please specify : 1) Which database is part of Saphirion AG R3 stack 2) What are the main aspects of writing view blocks for Saphirion vs R3 3) is test-driven-development (TDD) for GUI part of R3GUI public release Thanks !
posted by: OneArb 16-May-2014/14:43:44-7:00
OneArb, Just to clarify, I'm not affiliated with Saphirion. If none of the guys answers here, you may want to contact Cyphre or Robert on AltME. Perhaps this info will help. 1) Not Saphirion, but Atronix appears to be using the MySQL: https://github.com/zsx . I also seem to remember that Robert mentioned Saphirion had an SQLite driver which they were using internally (not released publicly as far as I know). 2) Do you mean to compare changes which Saphirion made to Carl's original (unfinished) implementation of R3-GUI? 3) You should ask Cyphre about this, and probably Shixin Zeng too (he is the one who worked on the release of R3-GUI for Linux, by Atronix). I think there was some collaboration between them, so they may both have some input about their development process. I did see some links for Red test suites, by Peter Wood, but I'm not sure if Doc and/or Xie use TDD to drive their work.
posted by: Nick 16-May-2014/18:57:04-7:00
Thanks for those details, I follow up onto another thread.
posted by: OneArb 6-Jun-2014/18:51:13-7:00
|