Split path into words and separators /
and //
via ANTLR itself then walk path elements from left to right. At each separator-word pair, find set of nodes. Next stage uses those as work list.
The basic interface is (tree, pathString, parser)
. But that is just shorthand for:
XPath p = newXPath (parser, pathString); return p.evaluate (tree);
See org.antlr.v4.test.TestXPath
for descriptions. In short, this allows operators:
and path elements:
Whitespace is not allowed.