On Fri, Nov 19, 2021 at 8:32 AM Marc Chantreux wrote:
>
> [switch `($/)` signature to `($_)` and `make` to `.make:`]
>
> i dug around it but missed it! arggh ...
I've been digging around online doc etc and spotted
that this is covered on the Traps page of the official doc:
hello William,
> #old:
> rule TOP {* %% \n }
> token line { * %% ',' }
> #new:
> rule TOP {* }
> token line { * %% ',' \n }
ohhh ... indeed! when i fixed the code on Ralph's instructions, i
finally was able to slurp a whole file and discovered a emtpy entry at
the end of the flow
Dear Marc, We may have version-specific issues, but I can't be certain at
the moment because you changed the first two lines of your Grammar.
#old:
rule TOP {* %% \n }
token line { * %% ',' }
#new:
rule TOP {* }
token line { * %% ',' \n }
If I change back to the #old lines
> On Sat, Nov 20, 2021 at 9:03 PM Marc Chantreux wrote:
> > > > method col:sym ($/) { .make ~S:g/'""'/"/ }
> > > That's not working for me. I'm on Moar (2021.06).
> > works for me with:
> > method col:sym ($_) { .make: ~S:g/'""'/"/ }
> Yeah, you got it wrong the first time. To explicate, the
On Sat, Nov 20, 2021 at 9:03 PM Marc Chantreux wrote:
> > > method col:sym ($/) { .make ~S:g/'""'/"/ }
> > That's not working for me. I'm on Moar (2021.06).
>
> works for me with:
>
method col:sym ($_) { .make: ~S:g/'""'/"/ }
>
Yeah, you got it wrong the first time. To explicate, the
helllo William,
> > Marc wrote:
> > i'm inclined to think that this is easier to read:
> > method col:sym ($/) { .make ~S:g/'""'/"/ }
> That's not working for me. I'm on Moar (2021.06).
works for me with:
Welcome to 퐑퐚퐤퐮퐝퐨™ v2021.09.
Implementing the 퐑퐚퐤퐮™ programming language v6.d.
>
> Marc wrote:
> i'm inclined to think that this is easier to read:
> method col:sym ($/) { .make ~S:g/'""'/"/ }
>
That's not working for me. I'm on Moar (2021.06).
This Is what I get back (first error below, note the "grammar CSV" line is
the first line of the script, and method col:sym is on
hello William,
> method col:sym ($/) { make $/.subst(/'""'/, '"', :global).Str }
which is just a longuest version of the line Ralph wrote. i'm inclined
to think that this is easier to read:
method col:sym ($/) { .make ~S:g/'""'/"/ }
> The following line seems to work just fine,
Hi Marc,
The following line seems to work just fine, with-or-without the call to
.Str at the end:
method col:sym ($/) { make $/.subst(/'""'/, '"', :global).Str }
#Gives the 12 element result below (in the context of your entire,
previously-posted Grammar):
.raku.say for CSV.parse(
hello Ralph,
Thank you for the whole explaination and links.
> method col:sym ($_) { .make: S:g/'""'/"/ }
i dug around it but missed it! arggh ...
> > am I right when i feel there is a way to do this
> > substitution inside the grammar
> As I've shown, yes. But it draws you into the `$/`
On Fri, Nov 19, 2021 at 1:19 AM Marc Chantreux wrote:
>
> method col:sym ($/) { make S:g/'""'/'"'/ with ~$/ }
>
> Cannot assign to a readonly variable or a value
>
> why isn't it working?
1. Even though `S` politely leaves "the current topic" (`$_`)
alone, it still generates a match
hello rakoons,
I want to be able to parse this:
CSV.parse(
'162,1,2,"Watt, Mrs. James (Elizabeth ""Bessie"" Inglis
Milne)",female,40,0,0,C.A. 33595,15.75,,S',
actions => CSV_as_table.new,
).made.say;
I wrote this simple Grammar and action
grammar CSV {
rule TOP {* %% \n }
12 matches
Mail list logo