Browse files

add bool and match uniprop opcodes

  • Loading branch information...
1 parent e79a521 commit f30b65fed3418221dd7ee41f94e344064a4497f3 @TimToady TimToady committed Mar 4, 2014
Showing with 21 additions and 4 deletions.
  1. +19 −4 docs/ops.markdown
  2. +2 −0 src/vm/moar/QAST/QASTOperationsMAST.nqp
@@ -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
@@ -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');

0 comments on commit f30b65f

Please sign in to comment.