Skip to content

Instantly share code, notes, and snippets.

Created December 27, 2016 22:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/249e7a564fe52f3f2a09fefc4a514127 to your computer and use it in GitHub Desktop.
Save anonymous/249e7a564fe52f3f2a09fefc4a514127 to your computer and use it in GitHub Desktop.
$scr no parsed
cat cbl214.pl6
#!/opt/rakudo-star-2016.10/bin/perl6
use v6;
use Grammar::Tracer;
#use Grammar::Debugger;
grammar TEST {
rule TOP { \s* [<sqlstart> <sqltext> <sqlend>]}
token sqlstart {'EXEC SQL'}
token sqlend {'END-EXEC'}
regex sqltext { .+ <before 'END-EXEC'> }
}
my $cbl = q:to/FIN_INI/;
EXEC SQL include sqlca END-EXEC
FIN_INI
my $scr = TEST.parse($cbl);
say $scr;
result :
cbl214.pl6
TOP
| sqlstart
| * MATCH "EXEC SQL"
| sqltext
| * MATCH "include sqlca "
| sqlend
| * MATCH "END-EXEC"
* MATCH "EXEC SQL include sqlca END-EXEC"
(Any)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment