Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add bool and match uniprop opcodes

  • Loading branch information...
commit f30b65fed3418221dd7ee41f94e344064a4497f3 1 parent e79a521
@TimToady TimToady authored
Showing with 21 additions and 4 deletions.
  1. +19 −4 docs/ops.markdown
  2. +2 −0  src/vm/moar/QAST/QASTOperationsMAST.nqp
View
23 docs/ops.markdown
@@ -696,16 +696,31 @@ Looks up a property name in its property category, and returns which
table within that category to use.
## getuniprop_int
-* `getuniprop_int(int $codepoint, int $propcode, int $pvalcode)`
+* `getuniprop_int(int $codepoint, int $propcode)`
-Uses the table found by the previous two opcodes to look up an integer property value
-for a given codepoint.
+Uses the table found by unipropcode to look up an integer property value
+for a given codepoint. Note that many properties that are officially
+numeric are really stored as strings, and if you try to use this op
+on such a property, you'll get a meaningless position in an enum table
+instead of the value you want.
## getuniprop_str
-* `getuniprop_str(int $codepoint, int $propcode, int $pvalcode)`
+* `getuniprop_str(int $codepoint, int $propcode)`
Same thing, but fetches a string property value.
+## getuniprop_bool
+* `getuniprop_bool(int $codepoint, int $propcode)`
+
+Same thing, but fetches a boolean property value.
+
+## matchuniprop
+* `matchuniprop(int $codepoint, int $propcode, int $pvalcode)`
+
+Looks up a codepoint property and return 1 if it matches the pval, 0 otherwise.
+The propcode and pvalcode may be looked up with the opcodes above. (Note that
+you can use the property value name (e.g. Nd) for both lookups.)
+
# Conditional Opcodes
## if
View
2  src/vm/moar/QAST/QASTOperationsMAST.nqp
@@ -1957,6 +1957,8 @@ QAST::MASTOperations.add_core_moarop_mapping('unipvalcode', 'unipvalcode');
QAST::MASTOperations.add_core_moarop_mapping('getuniname', 'getuniname');
QAST::MASTOperations.add_core_moarop_mapping('getuniprop_int', 'getuniprop_int');
QAST::MASTOperations.add_core_moarop_mapping('getuniprop_str', 'getuniprop_str');
+QAST::MASTOperations.add_core_moarop_mapping('getuniprop_bool', 'getuniprop_bool');
+QAST::MASTOperations.add_core_moarop_mapping('matchuniprop', 'matchuniprop');
# serialization context opcodes
QAST::MASTOperations.add_core_moarop_mapping('sha1', 'sha1');
Please sign in to comment.
Something went wrong with that request. Please try again.