Open p6rt opened 6 years ago
⺠perl6 -v This is Rakudo version 2017.07 built on MoarVM version 2017.07 implementing Perl 6.c.
⺠cat calc.pl
use v6;
grammar Calculator {
token TOP { [ \
⺠perl6 calc.pl
ï½¢2 + 3ï½£
add => ï½¢2 + 3ï½£
num => ï½¢2ï½£
num => ï½¢3ï½£
Cannot use a Buf as a string, but you called the Str method on it
in block \
It appears grammars only accept strings, but I also want to parse non-text input, e.g. binary file formats.
In Perl 6.c, regexes/grammars can only parse strings (at the grapheme level).
If you want to parse a Blob or Buf, you have to decode it into a string first by calling the `.decode` method¹ on it.
Early Perl 6 design documents² suggested support for parsing at the byte or code-point level, but this hasn't become part of the language yet. I suspect it might be added in a future version.
Marking this ticket [NYI].
1) https://docs.perl6.org/routine/decode 2) http://design.perl6.org/S05.html#line_476
The RT System itself - Status changed from 'new' to 'open'
Migrated from rt.perl.org#132003 (status was 'open')
Searchable as RT132003$