Skip to content

Commit 50407c1

Browse files
committed
document more opcodes.
1 parent 825038b commit 50407c1

File tree

1 file changed

+70
-1
lines changed

1 file changed

+70
-1
lines changed

docs/ops.markdown

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,20 @@ Return a hash. The first argument is a key, the second its value, and so on.
482482
Be sure to pass an even number of arguments, a VM specific error may occur
483483
otherwise.
484484

485+
## index
486+
* `index(str $haystack, str $needle)`
487+
* `index(str $haystack, str $needle, int $pos)`
488+
489+
Return the position in `$haystack` at which `$needle` appears, or -1
490+
if `$needle` does not appear. Begin searching at position `$pos` if specified,
491+
or at 0, otherwise.
492+
493+
## indexfrom
494+
* `indexfrom(str $haystack, str $needle, int $pos)`
495+
496+
Return the position in `$haystack` at which `$needle` appears, or -1
497+
if `$needle` does not appear. Begin searching at position `$pos`.
498+
485499
## iscclass
486500
* `iscclass(int $class, str $str, int $i)`
487501

@@ -543,6 +557,26 @@ The $flags is a bitmask that modifies the parse and/or result:
543557
Replace the the characters of `$str` starting at `$offset` for `$count`
544558
characters, with the `$replacement` string.
545559

560+
## rindex
561+
* `rindex(str $haystack, str $needle)`
562+
* `rindex(str $haystack, str $needle, int $pos)`
563+
564+
Searching backwards through the `$haystack`, return the position at which
565+
`$needle` appears, or -1 if it does not. Begin searching at `$pos` if
566+
specified, otherwise start from the last position.
567+
568+
## rindexfrom
569+
* `rindexfrom(str $haystack, str $needle, int $pos)`
570+
571+
Searching backwards through the `$haystack`, starting at `$pos` return the
572+
position at which `$needle` appears, or -1 if it does not.
573+
574+
## rindexfromend
575+
* `rindexfromend(str $haystack, str $needle)`
576+
577+
Searching backwards through the `$haystack`, return the position at which
578+
`$needle` appears, or -1 if it does not.
579+
546580
## uc
547581
* `uc(str $str)`
548582

@@ -1127,7 +1161,7 @@ Convert Big Integer value to a native number.
11271161
Given a Perl 6 object, return a native with the same value,
11281162
of the type indicated by the opcode suffix.
11291163

1130-
# OO Opcodes
1164+
# OO/SixModel Opcodes
11311165

11321166
## can
11331167
* `can(Any $obj, str $method)`
@@ -1152,6 +1186,41 @@ Returns 1 if the objects are the same object in the underlying VM,
11521186
If the object has a method of the given name, return it. Otherwise,
11531187
throw an exception.
11541188

1189+
## how
1190+
* `how(Any $obj)`
1191+
1192+
NQP equivalent for Perl 6's `$obj.HOW`.
1193+
1194+
## rebless
1195+
* `rebless(Any $obj, Type $type)`
1196+
1197+
Convert `$obj` to be an object of the new `$type`.
1198+
1199+
## reprname
1200+
* `reprname(Any $obj)`
1201+
1202+
Return the name of the REPR for the given object.
1203+
1204+
## setwho
1205+
* `setwho(Any $obj, Any $who)`
1206+
1207+
Replace `$obj`'s WHO. Return `$obj`.
1208+
1209+
## who
1210+
* `who(Any $obj)`
1211+
1212+
NQP equivalent for Perl 6's `$obj.WHO`.
1213+
1214+
## what
1215+
* `what(Any $obj)`
1216+
1217+
NQP equivalent for Perl 6's `$obj.WHAT`.
1218+
1219+
## where
1220+
* `where(Any $obj)`
1221+
1222+
Return a unique ID for this `$obj`.
1223+
11551224
# Bit Opcodes
11561225

11571226
## bitand

0 commit comments

Comments
 (0)