Class XMQParser
java.lang.Object
org.libxmq.imp.XMQParser
- Direct Known Subclasses:
XMQParseIntoDOM
Base class for xmq parsers.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe parsers recurse for every nested xmq body or json object or array, deeper nesting is an error (XMQ_ERROR_TOO_DEEP) instead of a stack overflow. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voiddo_apar_left(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a left parenthesis is parsed.protected abstract voiddo_apar_right(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a right parenthesis is parsed.protected abstract voiddo_attr_key(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an attribute key is parsed.protected abstract voiddo_attr_ns(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an attribute namespace is parsed.protected abstract voiddo_attr_value_compound_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside a compound attribute value is parsed.protected abstract voiddo_attr_value_compound_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a compound attribute value quote is parsed.protected abstract voiddo_attr_value_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside an attribute value is parsed.protected abstract voiddo_attr_value_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a quoted attribute value is parsed.protected abstract voiddo_attr_value_text(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when unquoted attribute value text is parsed.protected abstract voiddo_brace_left(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a left brace is parsed.protected abstract voiddo_brace_right(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a right brace is parsed.protected abstract voiddo_colon(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a colon is parsed.protected abstract voiddo_comment(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a comment is parsed.protected abstract voiddo_comment_continuation(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a continued comment is parsed.protected abstract voiddo_cpar_left(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a left square bracket is parsed.protected abstract voiddo_cpar_right(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a right square bracket is parsed.protected abstract voiddo_element_key(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an element key is parsed.protected abstract voiddo_element_name(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an element name is parsed.protected abstract voiddo_element_ns(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an element namespace is parsed.protected abstract voiddo_element_value_compound_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside a compound element value is parsed.protected abstract voiddo_element_value_compound_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a compound element value quote is parsed.protected abstract voiddo_element_value_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside an element value is parsed.protected abstract voiddo_element_value_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a quoted element value is parsed.protected abstract voiddo_element_value_text(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when unquoted element value text is parsed.protected abstract voiddo_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity is parsed.protected abstract voiddo_equals(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an equals sign is parsed.protected abstract voiddo_equals_done(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an equals sign completes a construct.protected abstract voiddo_ns_colon(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a namespace colon is parsed.protected abstract voiddo_ns_declaration(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a namespace declaration is parsed.protected abstract voiddo_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a quote is parsed.protected abstract voiddo_whitespace(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when whitespace is parsed.booleanParses an xmq buffer.protected voidParses xmq whitespace and invokes the whitespace callback.
-
Field Details
-
MAX_NESTING_DEPTH
public static final int MAX_NESTING_DEPTHThe parsers recurse for every nested xmq body or json object or array, deeper nesting is an error (XMQ_ERROR_TOO_DEEP) instead of a stack overflow. Like XMQ_MAX_NESTING_DEPTH in C.- See Also:
-
-
Constructor Details
-
XMQParser
protected XMQParser()Creates the parser.
-
-
Method Details
-
parse
Parses an xmq buffer.- Parameters:
buf- The xmq source buffer to parse.source- A description of where the buffer comes from, for error messages.- Returns:
- True if the input ends with a single root element.
- Throws:
ParseException- If the input cannot be parsed.
-
parse_xmq_whitespace
protected void parse_xmq_whitespace()Parses xmq whitespace and invokes the whitespace callback. -
do_whitespace
protected abstract void do_whitespace(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when whitespace is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_quote
protected abstract void do_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a quote is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_value_quote
protected abstract void do_element_value_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a quoted element value is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_value_compound_quote
protected abstract void do_element_value_compound_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a compound element value quote is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_attr_value_quote
protected abstract void do_attr_value_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a quoted attribute value is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_attr_value_compound_quote
protected abstract void do_attr_value_compound_quote(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a compound attribute value quote is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_entity
protected abstract void do_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_value_entity
protected abstract void do_element_value_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside an element value is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_value_compound_entity
protected abstract void do_element_value_compound_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside a compound element value is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_attr_value_entity
protected abstract void do_attr_value_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside an attribute value is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_attr_value_compound_entity
protected abstract void do_attr_value_compound_entity(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an entity inside a compound attribute value is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_comment
protected abstract void do_comment(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a comment is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_comment_continuation
protected abstract void do_comment_continuation(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a continued comment is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_key
protected abstract void do_element_key(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an element key is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_name
protected abstract void do_element_name(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an element name is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_ns
protected abstract void do_element_ns(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an element namespace is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_colon
protected abstract void do_colon(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a colon is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_apar_left
protected abstract void do_apar_left(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a left parenthesis is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_apar_right
protected abstract void do_apar_right(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a right parenthesis is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_cpar_left
protected abstract void do_cpar_left(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a left square bracket is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_cpar_right
protected abstract void do_cpar_right(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a right square bracket is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_brace_left
protected abstract void do_brace_left(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a left brace is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_brace_right
protected abstract void do_brace_right(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a right brace is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_equals
protected abstract void do_equals(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an equals sign is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_equals_done
protected abstract void do_equals_done(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an equals sign completes a construct.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_attr_value_text
protected abstract void do_attr_value_text(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when unquoted attribute value text is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_element_value_text
protected abstract void do_element_value_text(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when unquoted element value text is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_ns_declaration
protected abstract void do_ns_declaration(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a namespace declaration is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_attr_key
protected abstract void do_attr_key(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an attribute key is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_ns_colon
protected abstract void do_ns_colon(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when a namespace colon is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-
do_attr_ns
protected abstract void do_attr_ns(int start_line, int start_col, int start, int stop, int stop_suffix) Invoked when an attribute namespace is parsed.- Parameters:
start_line- The 0-based starting line.start_col- The 0-based starting column.start- The starting character index.stop- The stopping character index.stop_suffix- The index after the suffix of the token.
-