[Parrot-users] validate and Unicode
Aaron Sherman
ajs at ajs.com
Thu Jul 22 16:14:48 UTC 2010
WARNING: utter PIR newbie ahead...
Working from Rakudo, I have the following PIR block:
.local pmc p
.local string s
.local int r
# The string parameter to my Perl 6 function
p = find_lex '$s'
s = p
r = validate s
%r = box r
And I'm getting an error:
error:imcc:syntax error, unexpected VAR, expecting '(' ('s')
I believe this is because "validate" isn't a valid operation on a string, so
I'm wondering how I invoke the validate function that I find in
parrot/src/string/charset/unicode.c? That validate:
static UINTVAL validate(PARROT_INTERP, const STRING *src)
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?
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?
--
Aaron Sherman
Email or GTalk: ajs at ajs.com
http://www.ajs.com/~ajs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.parrot.org/pipermail/parrot-users/attachments/20100722/2cc69cdf/attachment.html>
More information about the Parrot-users
mailing list