Class IXML
java.lang.Object
org.libxmq.IXML
A compiled ixml grammar, used to parse many inputs, see XMQ.compileIXML and
XMQ.parseBufferWithIXML. Like an XMQDoc parsed with XMQ_CONTENT_IXML in xmq.h.
A grammar that is LL(*) is parsed with the fast predictive parser, any other
grammar with the Earley parser.
-
Method Summary
Modifier and TypeMethodDescriptionstatic IXMLCompile an ixml grammar.parse(byte[] input) Parse an UTF-8 input with the grammar.parse(byte[] buf, int start, int stop) Parse an UTF-8 input with the grammar, the bytes start to stop of the buffer.Parse an input with the grammar.source()The ixml grammar source.
-
Method Details
-
compile
Compile an ixml grammar.- Parameters:
grammar- The ixml grammar source.- Returns:
- The compiled grammar.
- Throws:
ParseException- if the grammar has a syntax error.
-
source
-
parse
Parse an input with the grammar.- Parameters:
input- The input to parse.- Returns:
- The parse tree.
- Throws:
ParseException- if the input is rejected by the grammar.
-
parse
Parse an UTF-8 input with the grammar. The Earley parser decodes the code points directly from the bytes, the input is not copied into a String.- Parameters:
input- The input to parse, UTF-8.- Returns:
- The parse tree.
- Throws:
ParseException- if the input is rejected by the grammar, or is not valid UTF-8.
-
parse
Parse an UTF-8 input with the grammar, the bytes start to stop of the buffer.- Parameters:
buf- The buffer with the input, UTF-8.start- The first byte of the input.stop- The end of the input, exclusive.- Returns:
- The parse tree.
- Throws:
ParseException- if the input is rejected by the grammar, or is not valid UTF-8.
-