std/path/zz/functions

Standard Library documentation

Function definitions for ZZPath expressions.

Module

Name
std/path/zz/functions
Area
Standard Library
Source
modules/std/path/zz/functions.zzm

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_NAMES

    Type: Array. Names of inherited ZPath functions available to ZZPath.

  • STANDARD_FUNCTIONS

    Type: Array. Complete ZZPath function definition table.

Functions

  • first_arg_node(name, ev, ctx, args)

    Parameters: function name, evaluator, context, and argument AST nodes. Returns: Node or null. 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: spelling is 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 string index-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.