XPath 2.0 Grammar
This is an XPath 2.0 grammar for SableCC.
Remarks
- This grammar and accompanying files are also available at the git project page: http://repo.or.cz/w/xpath20.git
- Use ant to build: ant clean compile-src
- Run with the following command(s):
- (bash - Terminate input with Ctrl-D Ctrl-D) run.sh
- (dos - Terminate input with Ctrl-M Ctrl-Z Ctrl-M) java -classpath build/src;build/gen/;lib/sablecc-anttask.jar;lib/ xpath.XPath20
XPath 2.0 Grammar File
- xpath.sablecc: This file contains the XPath 2.0 grammar.
Some Test Input
- ./child::node()[ 12 ]
- //system/application
- ./child::node()[ 1 ]/child::service/child::port/ child::soap:address/attribute::location
- /descendant-or-self::element()
- /GPS/memory[text()="64MB"]
- for $i in (10, 20), $j in (1, 2) return ( $i + $j )
Known Issues
- can’t use ‘1’ or ‘-‘ in tag names
- an ‘if’ statement requires a corresponding ‘else’
Attachments
-
xpath.sablecc
(25.8 KB) - added by timothyjwashington@yahoo.ca
20 months ago.