|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Bounded external-only DOCTYPE lexer for the no-heap XML reader. More...
Go to the source code of this file.
Functions | |
| static bool | internal_space (uint8_t byte) |
| Test whether one byte is XML spacing inside a DOCTYPE. | |
| static bool | internal_skip_space (const uint8_t *source, size_t end, size_t *position) |
| Skip XML spacing and report whether at least one byte was consumed. | |
| static bool | internal_pubid_byte (uint8_t byte) |
| Test the XML PubidChar subset accepted in public identifiers. | |
| static ra8_err_t | internal_literal (const uint8_t *source, size_t end, size_t *position, bool public_id) |
| Parse one quoted system or public identifier literal. | |
| static ra8_err_t | internal_keyword (const uint8_t *source, size_t end, size_t *position, const char *keyword) |
| Consume an exact ASCII keyword followed by required spacing. | |
| static ra8_err_t | internal_external_id (const uint8_t *source, size_t end, size_t *position) |
| Parse a SYSTEM or PUBLIC external identifier. | |
| ra8_err_t | priv_xml_doctype (xml_reader_t *reader) |
| Validate and skip one supported pre-root external DOCTYPE. | |
Bounded external-only DOCTYPE lexer for the no-heap XML reader.
Accepts and ignores lexically valid bare, SYSTEM, and PUBLIC declarations before the root without resolving external resources; internal subsets and unsupported declaration forms fail closed.
[Ring 3 / LIB] {World: NS}
Definition in file xml_doctype.c.
|
static |
Parse a SYSTEM or PUBLIC external identifier.
Accepts SYSTEM literal or PUBLIC identifier plus system literal.
| [in] | source | Immutable XML source. |
| [in] | end | One-past-last readable declaration byte. |
| [in,out] | position | Offset at the external identifier keyword. |
| k_ra8_ok | One valid external identifier consumed. |
| k_ra8_err_validation_failed | Identifier grammar was malformed. |
source spans at least end bytes. position is writable. Definition at line 177 of file xml_doctype.c.
References internal_keyword(), internal_literal(), internal_skip_space(), k_ra8_err_validation_failed, k_ra8_ok, and priv_xml_bytes_equal().
Referenced by priv_xml_doctype().
|
static |
Consume an exact ASCII keyword followed by required spacing.
Matches case-sensitively without reading beyond end.
| [in] | source | Immutable XML source. |
| [in] | end | One-past-last readable declaration byte. |
| [in,out] | position | Current keyword offset. |
| [in] | keyword | NUL-terminated expected ASCII keyword. |
| k_ra8_ok | Keyword and following XML spacing consumed. |
| k_ra8_err_validation_failed | Bytes or required spacing did not match. |
source spans at least end bytes. position and keyword are valid inputs. Definition at line 149 of file xml_doctype.c.
References internal_skip_space(), k_ra8_err_validation_failed, k_ra8_ok, priv_xml_bytes_equal(), and strlen().
Referenced by internal_external_id().
|
static |
Parse one quoted system or public identifier literal.
Respects either quote and validates optional PubidChar bytes.
| [in] | source | Immutable XML source. |
| [in] | end | One-past-last readable declaration byte. |
| [in,out] | position | Offset of the opening quote, then byte after closure. |
| [in] | public_id | Require XML PubidChar bytes when true. |
| k_ra8_ok | Literal validated and consumed. |
| k_ra8_err_validation_failed | Quote, byte, or terminator was invalid. |
source spans at least end bytes. position is writable. Definition at line 108 of file xml_doctype.c.
References internal_pubid_byte(), k_ra8_err_validation_failed, k_ra8_ok, and priv_xml_raw().
Referenced by internal_external_id().
|
static |
Test the XML PubidChar subset accepted in public identifiers.
Accepts XML spacing, alphanumerics, and XML punctuation.
| [in] | byte | Byte to classify. |
| true | byte is permitted. |
| false | byte is forbidden. |
byte is an unsigned source byte. byte. Definition at line 80 of file xml_doctype.c.
References RA8_INTERNAL, and strchr().
Referenced by internal_literal().
|
static |
Skip XML spacing and report whether at least one byte was consumed.
Advances only inside the supplied half-open byte range.
| [in] | source | Immutable XML source. |
| [in] | end | One-past-last readable byte for this declaration. |
| [in,out] | position | Current scan offset. |
| true | Position advanced. |
| false | No XML spacing began at the position. |
source spans at least end bytes. position is writable. end. Definition at line 57 of file xml_doctype.c.
References internal_space(), and RA8_INTERNAL.
Referenced by internal_external_id(), internal_keyword(), and priv_xml_doctype().
|
static |
Test whether one byte is XML spacing inside a DOCTYPE.
Recognises the four XML S characters without locale state.
| [in] | byte | Byte to classify. |
| true | byte is XML spacing. |
| false | byte is not XML spacing. |
byte is an unsigned source byte. byte. Definition at line 35 of file xml_doctype.c.
References RA8_INTERNAL.
Referenced by internal_skip_space().
| ra8_err_t priv_xml_doctype | ( | xml_reader_t * | reader | ) |
Validate and skip one supported pre-root external DOCTYPE.
Accepts bare, SYSTEM, or PUBLIC external-only forms and fetches nothing.
| [in,out] | reader | Active reader positioned at <!DOCTYPE. |
| k_ra8_ok | Supported declaration consumed. |
| k_ra8_err_validation_failed | Placement, subset, or grammar was invalid. |
Definition at line 196 of file xml_doctype.c.
References xml_reader_t::doctype_seen, internal_external_id(), internal_skip_space(), k_ra8_err_validation_failed, k_ra8_ok, xml_reader_t::position, priv_xml_bytes_equal(), priv_xml_qname(), xml_reader_t::root_count, xml_reader_t::source, and xml_reader_t::source_len.
Referenced by internal_special().