-
-
Save Skarsnik/cdcfcb15e766913970c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub build-tree(mxml_node_t $node, $parent, $cpt = 0) { | |
say "build tree"; | |
#say $node; | |
given $node.type { | |
when MXML_ELEMENT { | |
say "ELEMENT"; | |
say '--' x $cpt ~ $node.value.element.name ~ " : " ~ $node.value.element.num_attrs; | |
say $node.child; | |
if $node.child !=== Pointer { | |
say "=has child="; | |
my $child = $node.child; | |
repeat { | |
say '--' x $cpt ~ "BUILD-TREE-CHILD"; | |
build-tree($child.deref, 'foo', $cpt + 1); | |
} while $child = $child.deref.next | |
} | |
} | |
when MXML_TEXT { | |
say "Text"; | |
say '--' x $cpt ~ $node.value.text.string; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
NativeCall::Types::Pointer[MiniXML::Raw::mxml_node_t]<0xb830080> | |
=has child= | |
BUILD-TREE-CHILD | |
build tree | |
ELEMENT | |
--p : 1 | |
NativeCall::Types::Pointer[MiniXML::Raw::mxml_node_t]<0xb830140> | |
=has child= | |
root@testperl6:~/piko/perl6-MiniXML# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment