antlr/antlr4 — pull request #352 by parrt (2013-11-13 22:21:05+00:00)
Title: Add XPath to collect parse tree nodes/subtrees.

XPath notation with exception that I introduce '!' negation operator. Samples:
/prog/func, -> all funcs under prog at root
/prog/*, -> all children of prog at root /*/func, -> all func kids of any root node
prog, -> prog must be root node /prog, -> prog must be root node
/*, -> any root
*, -> any root
//ID, -> any ID in tree
//expr/primary/ID, -> any ID child of a primary under any expr
//body//ID, -> any ID under a body
//'return', -> any 'return' literal in tree //primary/*, -> all kids of any primary
//func/*/stat, -> all stat nodes grandkids of any func node
/prog/func/'def', -> all def literal kids of func kid of prog
//stat/';', -> all ';' under any stat node
//expr/primary/!ID, -> anything but ID under primary under any expr node //expr/!primary, -> anything but primary under any expr node
//!*, -> nothing anywhere /!*, -> nothing at root