The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

TPath::Grammar - parses TPath expressions into ASTs

VERSION

version 0.013

SYNOPSIS

    use TPath::Grammar qw(parse);

    my $ast = parse('/>a[child::b || @foo("bar")][-1]');

DESCRIPTION

TPath::Grammar exposes a single function: parse. Parsing is a preliminary step to compiling the expression into an object that will select the tree nodes matching the expression.

TPath::Grammar is really intended for use by TPath modules, but if you want a parse tree, here's how to get it.

Also exportable from TPath::Grammar is %AXES, the set of axes understood by TPath expressions. See TPath for the list and explanation.

FUNCTIONS

parse

Converts a TPath expression to a parse tree, normalizing boolean expressions and parentheses and unescaping escaped strings. parse throws an error with a stack trace if the expression is unparsable. Otherwise it returns a hashref.

AUTHOR

David F. Houghton <dfhoughton@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2013 by David F. Houghton.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.