NAME
TPath::Grammar - parses TPath expressions into ASTs
VERSION
version 1.007
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, unescaping escaped strings, folding constants, and otherwise optimizing the parse tree and preparing it for compilation.
parse
throws an exception (dies) if the expression is is unparsable or, in some cases, contains an impossible condition, [1=2]
, for example. 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.