Skip to content

Instantly share code, notes, and snippets.

@titsuki
Last active October 20, 2016 15:40
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save titsuki/664c94a99154d8008cfa537d08538171 to your computer and use it in GitHub Desktop.
MeCab::NodePath
use NativeCall;
my class MeCab::Path is repr('CStruct') { ... }
class MeCab::Node is repr('CStruct') {
has MeCab::Node $.prev;
has MeCab::Node $.next;
has MeCab::Node $.enext;
has MeCab::Node $.bnext;
has MeCab::Path $.rpath;
has MeCab::Path $.lpath;
has Str $.surface;
has Str $.feature;
has uint32 $.id;
has uint16 $.length;
has uint16 $.rlength;
has uint16 $.rcAttr;
has uint16 $.lcAttr;
has uint16 $.posid;
has uint8 $.char_type;
has uint8 $.stat;
has uint8 $.isbest;
has num32 $.alpha;
has num32 $.beta;
has num32 $.prob;
has int16 $.wcost;
has int64 $.cost;
}
class MeCab::Path is repr('CStruct') {
has MeCab::Node $.rnode;
has MeCab::Path $.rnext;
has MeCab::Node $.lnode;
has MeCab::Path $.lnext;
has int32 $.cost;
has num32 $.prob;
}
# Cannot change REPR of MeCab::Path now (must be set at initial declaration)
# at /home/itoyota/Programs/p6-MeCab/lib/MeCab/Loadable.pm6 (MeCab::Loadable):29
# ------> class MeCab::Path is repr('CStruct')⏏ {
# Dubious, test returned 1 (wstat 256, 0x100)
# No subtests run
#
# Test Summary Report
# -------------------
# ./t/01-basic.t (Wstat: 256 Tests: 0 Failed: 0)
# Non-zero exit status: 1
# Parse errors: No plan found in TAP output
# Files=1, Tests=0, 2 wallclock secs ( 0.01 usr 0.01 sys + 1.45 cusr 0.12 csys = 1.59 CPU)
# Result: FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment