std/path/z/lexer

Standard Library documentation

Pure Zuzu lexer for ZPath expressions.

Module

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

NAME

std/path/z/lexer - Pure Zuzu lexer for ZPath expressions.

IMPLEMENTATION SUPPORT

This module is supported by all implementations of ZuzuScript.

DESCRIPTION

This module provides the pure-Zuzu lexer used by ZPath.

EXPORTS

Classes

  • Lexer({ src: String, allowed_operators: Array })

    Constructs a ZPath lexer. Returns: Lexer. Tokenizes src using the allowed operator table.

    • lexer.peek()

      Parameters: none. Returns: Dict. Returns the current token without advancing.

    • lexer.peek_n(n)

      Parameters: n is a zero-based lookahead offset. Returns: Dict. Returns a token ahead of the current position.

    • lexer.peek_kind()

      Parameters: none. Returns: String. Returns the current token kind.

    • lexer.peek_kind_n(n)

      Parameters: n is a zero-based lookahead offset. Returns: String. Returns a token kind ahead of the current position.

    • lexer.next_tok()

      Parameters: none. Returns: Dict. Consumes and returns the current token.

    • lexer.expect(k)

      Parameters: k is the expected token kind. Returns: Dict. Consumes and returns the current token, throwing when it has a different kind.

    • lexer.known_operators()

      Parameters: none. Returns: Array. Returns the allowed operator definitions.

COPYRIGHT AND LICENCE

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