WARNING: utter PIR newbie ahead...<div><br></div><div>Working from Rakudo, I have the following PIR block:<div><br></div><div><div>      .local pmc p</div><div>      .local string s</div><div>      .local int r</div><div><br>
</div><div>      # The string parameter to my Perl 6 function</div><div>      p = find_lex &#39;$s&#39;</div><div>      s = p</div><div>      r = validate s</div><div>      %r = box r</div><div><br></div><div>And I&#39;m getting an error:</div>
<div><br></div></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div><div><div>error:imcc:syntax error, unexpected VAR, expecting &#39;(&#39; (&#39;s&#39;)</div>
</div></div></div></blockquote><div><div><div><br></div><div>I believe this is because &quot;validate&quot; isn&#39;t a valid operation on a string, so I&#39;m wondering how I invoke the validate function that I find in parrot/src/string/charset/unicode.c? That validate:</div>
<div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><div>static UINTVAL validate(PARROT_INTERP, const STRING *src)</div></div></blockquote><div><div>
<br></div><div>appears to be registered in association with the character set for Unicode, but does that mean that I have to have an explicitly Unicode string in hand? How do I mark this string as Unicode, even if I think it might be invalid?</div>
<div><br></div><div>The goal, here, is to provide a test in Perl which takes a string and returns true if it contains valid Unicode codepoints. Is there a better way to do that in PIR?</div><br>-- <br>Aaron Sherman<br>Email or GTalk: <a href="mailto:ajs@ajs.com">ajs@ajs.com</a><br>
<a href="http://www.ajs.com/~ajs">http://www.ajs.com/~ajs</a><br>
</div></div>