Skip to content

Commit

Permalink
RakuAST: introduce RakuAST::Doc::Row class
Browse files Browse the repository at this point in the history
This object represents a row in a =table rakudoc.  For now just the
bare necessities to make it known and allow it to deparse and rakufy
  • Loading branch information
lizmat committed May 11, 2023
1 parent 74d021c commit cd6bc20
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core.c/RakuAST/Deparse.pm6
Expand Up @@ -646,6 +646,10 @@ class RakuAST::Deparse {
$ast.atoms.map({ self!deparse-unquoted($_) }).join
}

multi method deparse(RakuAST::Doc::Row:D $ast --> Str:D) {
$ast.Str
}

#- Dot -------------------------------------------------------------------------

multi method deparse(RakuAST::DottyInfix::Call:D $ --> Str:D) {
Expand Down
7 changes: 7 additions & 0 deletions src/core.c/RakuAST/Fixups.pm6
Expand Up @@ -5,6 +5,13 @@ my class RakuAST::LegacyPodify { ... }
# needed to compile the Raku setting) to be written in Raku rather
# than in NQP.

my class RakuAST::Doc::Row {
has str $.column-dividers;
has $.column-offsets is built(:bind); # native int array
has $.cells is built(:bind); # native str array
has Bool $.multi-line is built(False); # columns are multi-line
}

augment class RakuAST::Doc {

# just pass it on for now, make using another class possible
Expand Down
4 changes: 4 additions & 0 deletions src/core.c/RakuAST/Raku.pm6
Expand Up @@ -364,6 +364,10 @@ augment class RakuAST::Node {
self!positionals(self.atoms)
}

multi method raku(RakuAST::Doc::Row:D: --> Str:D) {
self!nameds: <column-dividers column-offsets cells>
}

#- Dot -------------------------------------------------------------------------

# Handles all of the RakuAST::DottyInfix::xxx classes
Expand Down

0 comments on commit cd6bc20

Please sign in to comment.