Skip to content

Instantly share code, notes, and snippets.

@titsuki
Created December 3, 2017 05:04
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 titsuki/1243c76dc7099a15b425709d51e05c81 to your computer and use it in GitHub Desktop.
Save titsuki/1243c76dc7099a15b425709d51e05c81 to your computer and use it in GitHub Desktop.
my @lines = $*IN.lines;
while @lines {
my $chunk = @lines.join("\n"); # (#1)
my $result = Infobox::Grammar.parse($chunk, actions => Infobox::Actions).made; # (#2)
if $result<name>:exists {
$result<name>.say;
for @($result<propertylist>) -> (:$key, :value($content-list)) { # (#3)
$key.say;
for @($content-list) -> $content {
$content.say;
}
}
}
shift @lines;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment