helllo William,
> > Marc wrote:
> > i'm inclined to think that this is easier to read:
> > method col:sym<quoted> ($/) { .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.
Built on MoarVM version 2021.09.
> 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<quoted> is on line 20):
the whole grammar and action is:
grammar CSV {
rule TOP {<line>* }
token line { <col>* %% ',' \n }
proto token col {*}
token col:sym<bare> { <-[\n",]>* }
token col:sym<quoted> {
'"' ~ '"'
[<( [ '""' | <-[\n"]> ]* )>]
}
}
class CSV_as_table {
method TOP ($/) { make $/<line>.map: *.made }
method line ($/) { make $/<col>.map: *.made }
method col:sym<bare> ($/) { make ~$/ }
method col:sym<quoted> ($_) { .make: ~S:g/'""'/"/ }
}
regards
marc