Skip to content

Instantly share code, notes, and snippets.

@tadzik
Created July 10, 2011 15:54
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 tadzik/1074641 to your computer and use it in GitHub Desktop.
Save tadzik/1074641 to your computer and use it in GitHub Desktop.
414 my $past;
415 if $sepnum == 0 {
416 say('# ordinary table, nothing fancy');
417 my @content := [];
418 for @rows -> $row {
419 my @cells := [];
420 for $row -> $cell {
421 say("cell: '$cell'");
422 my $p := $*ST.add_constant(
423 'Str', 'str', ~$cell
424 );
425 @cells.push($p<compile_time_value>);
426 }
427 my $p := $*ST.add_constant(
428 'Array', 'type_new', |@cells
429 );
430 @content.push($p<compile_time_value>);
431 say("added new array: ", $p<compile_time_value>);
432 }
433 my $insides := $*ST.add_constant(
434 'Array', 'type_new',
435 |@content,
436 );
437 $past := $*ST.add_constant(
438 'Pod::Block::Table', 'type_new',
439 :content($insides<compile_time_value>),
440 );
441 } elsif $sepnum == 1 {
And then, the resulting Array:
# ordinary table, nothing fancy
cell: 'The Shoveller'
cell: 'Eddie Stevens'
cell: 'King Arthur's singing shovel'
added new array: The Shoveller Eddie Stevens King Arthur's singing shovel
cell: 'Blue Raja'
cell: 'Geoffrey Smith'
cell: 'Master of cutlery'
added new array: Blue Raja Geoffrey Smith Master of cutlery
cell: 'Mr Furious'
cell: 'Roy Orson'
cell: 'Ticking time bomb of fury'
added new array: Mr Furious Roy Orson Ticking time bomb of fury
cell: 'The Bowler'
cell: 'Carol Pinnsler'
cell: 'Haunted bowling ball'
added new array: The Bowler Carol Pinnsler Haunted bowling ball
ok 1 - The object is-a 'Block::Table'
Array.new("The Shoveller", "Eddie Stevens", "King Arthur's singing shovel", "Blue Raja", "Geoffrey Smith", "Master of cutlery", "Mr Furious", "Roy Orson", "Ticking time bomb of fury", "The Bowler", "Carol Pinnsler", "Haunted bowling ball")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment