std/path/z/functions

Standard Library documentation

Function definitions for ZPath.

Module

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

NAME

std/path/z/functions - Function definitions for ZPath.

IMPLEMENTATION SUPPORT

This module is supported by all implementations of ZuzuScript.

DESCRIPTION

This module defines the function objects and standard function table used by std/path/z.

EXPORTS

Classes

  • Func({ spelling: String, f: Function })

    Constructs a ZPath function definition. Returns: Func.

    • func.has_name(n)

      Parameters: n is a function name. Returns: Boolean. Returns true when n matches the function spelling.

Functions

  • replace(haystack, needle, replacement)

    Parameters: haystack is source text, needle is a pattern, and replacement is replacement text. Returns: String. Performs ZPath replacement with capture substitutions.

  • mk_single_number_function(String name, Function impl)

    Parameters: name is a ZPath function name and impl maps one number. Returns: Function. Builds a function wrapper for per-node numeric functions.

  • mk_aggregate_number_function(String name, Function impl)

    Parameters: name is a ZPath function name and impl maps an array of numbers. Returns: Function. Builds a function wrapper for aggregate numeric functions.

  • mk_single_string_function(String name, Function impl)

    Parameters: name is a ZPath function name and impl maps one string. Returns: Function. Builds a function wrapper for per-node string functions.

  • mk_match_function()

    Parameters: none. Returns: Function. Builds the standard ZPath match function implementation.

Constants

  • STANDARD_FUNCTIONS

    Type: Array. Standard ZPath function definitions.

COPYRIGHT AND LICENCE

std/path/z/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.