NAME
std/path/zz/functions - Function definitions for ZZPath expressions.
IMPLEMENTATION SUPPORT
This module is supported by all implementations of ZuzuScript.
DESCRIPTION
This module extends the base ZPath function table with ZuzuScript-flavoured path expression helpers.
EXPORTS
Constants
STANDARD_FUNCTION_NAMESType:
Array. Names of inherited ZPath functions available to ZZPath.STANDARD_FUNCTIONSType:
Array. Complete ZZPath function definition table.
Functions
first_arg_node(name, ev, ctx, args)Parameters: function name, evaluator, context, and argument AST nodes. Returns:
Nodeornull. Resolves the first argument or current context node.first_number_arg(name, ev, ctx, args),nth_number_arg(name, ev, ctx, args, i)Parameters: function name, evaluator, context, arguments, and optional index. Returns:
Number. Resolves an argument as a number.first_string_arg(name, ev, ctx, args),nth_string_arg(name, ev, ctx, args, i)Parameters: function name, evaluator, context, arguments, and optional index. Returns:
String. Resolves an argument as a string.nth_value_arg(name, ev, ctx, args, i)Parameters: function name, evaluator, context, arguments, and index. Returns: value. Resolves an argument as a primitive value.
nth_array_arg(name, ev, ctx, args, i)Parameters: function name, evaluator, context, arguments, and index. Returns:
Array. Resolves an argument as an array value.number_args(ev, ctx, args)Parameters: evaluator, context, and argument AST nodes. Returns:
Array. Resolves all arguments as numbers.first_arg_value(name, ev, ctx, args)Parameters: function name, evaluator, context, and arguments. Returns: value. Resolves the first argument as a primitive value.
z_function(spelling)Parameters:
spellingis a base ZPath function name. Returns:Function. Returns the inherited function implementation.string_index_of(funk, ev, ast, ctx, args)Parameters: standard ZPath function callback arguments. Returns:
Array. Implements stringindex-of.string_rindex(funk, ev, ast, ctx, args)Parameters: standard ZPath function callback arguments. Returns:
Array. Implements string reverse-index lookup.defined_function(funk, ev, ast, ctx, args)Parameters: standard ZPath function callback arguments. Returns:
Array. Implements defined-value testing.empty_function(funk, ev, ast, ctx, args)Parameters: standard ZPath function callback arguments. Returns:
Array. Implements empty-value testing.
COPYRIGHT AND LICENCE
std/path/zz/functions is copyright Toby Inkster.
It is free software; you may redistribute it and/or modify it under the terms of either the Artistic License 1.0 or the GNU General Public License version 2.