NAME
Pugs::Runtime::StrPos - Represent a position inside a string
OPTIONAL MODULES
* YAML::Syck
- in order to support 'yaml()'
METHODS
* new({ str => "...", codes => $n });
create a new StrPos object.
'str' must be utf-8.
'codes' can be undef, meaning "nowhere in this string".
* from_str( $str )
create a new StrPos object, using the perl5-string internal 'pos'.
* from_str_graphs( $str, $graphs ) * from_str_codes( $str, $codes )
create a new StrPos object using grapheme or codepoint units.
* bytes() * codes() * graphs()
- return the position as an integer, counting in bytes, codepoints, or graphemes.
* langs()
- TODO - return the position as an integer, counting in language dependent chars.
* bool()
- test whether a position is defined.
* add_codes($n) * add_graphs($n)
- return a new StrPos with the new position
* clone
- return a new StrPos with the same position
OVERLOADS
* numeric
- return the count of graphemes, or undef.
* boolean
- test whether a position is defined. The position 'zero' is true.
Dumper methods
* perl
- return the internal representation as Perl source code.
* yaml
- return the internal representation as YAML. Requires the YAML::Syck
module.
* dump_hs
- for Pugs interoperability
SEE ALSO
v6
on CPAN
AUTHORS
The Pugs Team <perl6-compiler@perl.org>.
COPYRIGHT
Copyright 2007 by Flavio Soibelmann Glock and others.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.