Pugs::Runtime::StrPos - Represent a position inside a string


Pugs-Compiler-Rule documentation  | view source Contained in the Pugs-Compiler-Rule distribution.

Index


NAME

Top

Pugs::Runtime::StrPos - Represent a position inside a string

OPTIONAL MODULES

Top

* YAML::Syck

- in order to support 'yaml()'

METHODS

Top

* 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

Top

* numeric

- return the count of graphemes, or undef.

* boolean

- test whether a position is defined. The position 'zero' is true.

Dumper methods

Top

* 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

Top

v6 on CPAN

AUTHORS

Top

The Pugs Team <perl6-compiler@perl.org>.

COPYRIGHT

Top


Pugs-Compiler-Rule documentation  | view source Contained in the Pugs-Compiler-Rule distribution.