|
ra8-firmware 0.1.0
Bare-metal firmware for the Renesas RA8 family (RA8D2 / RA8P1)
|
Private contracts for the bounded XML reader implementation. More...
Go to the source code of this file.
Functions | |
| static bool | internal_space (uint8_t c) |
| Test whether one byte is XML spacing. | |
| static bool | internal_ascii_letter (uint8_t c) |
| Test whether one byte is an ASCII letter. | |
| static bool | internal_name_start (uint8_t c) |
| Test a supported ASCII NCName start byte. | |
| static bool | internal_name_continue (uint8_t c) |
| Test a supported later ASCII NCName byte. | |
| static ra8_err_t | internal_attr_parse (const uint8_t *source, size_t source_len, uint32_t end, xml_attr_cursor_t *cursor, xml_attribute_t *out) |
| Parse one attribute at a bounded tag cursor. | |
| static bool | internal_attr_duplicate (const uint8_t *source, size_t source_len, const xml_event_t *event, const xml_attribute_t *current, uint16_t prior_count) |
| Detect a duplicate attribute name. | |
| static ra8_err_t | internal_markup_end (const uint8_t *source, size_t length, size_t start, size_t *out_end) |
| Locate a markup closing byte while respecting quotes. | |
| static ra8_err_t | internal_attributes (const uint8_t *source, size_t source_len, xml_event_t *event) |
| Count and validate one start tag's attributes. | |
| static ra8_err_t | internal_start (xml_reader_t *reader, size_t end, xml_event_t *event) |
| Parse one start element and update nesting. | |
| static ra8_err_t | internal_end (xml_reader_t *reader, size_t end, xml_event_t *event) |
| Parse one close element and update nesting. | |
| static ra8_err_t | internal_terminator (const uint8_t *source, size_t length, size_t start, const char *terminator, size_t *out_start) |
| Locate a literal terminator in a bounded source. | |
| static ra8_err_t | internal_comment (xml_reader_t *reader) |
| Validate and skip one XML comment. | |
| static bool | internal_xml_target (const uint8_t *source, size_t start, size_t end) |
| Test for the reserved case-insensitive PI target XML. | |
| static bool | internal_encoding (const uint8_t *source, xml_span_t value) |
| Validate an XML declaration encoding name. | |
| static bool | internal_declaration_attr (const uint8_t *source, size_t source_len, const xml_attribute_t *attribute, uint16_t ordinal, bool *saw_encoding, bool *saw_standalone) |
| Validate one ordered XML-declaration pseudo-attribute. | |
| static ra8_err_t | internal_declaration (xml_reader_t *reader, size_t target_end, size_t term) |
| Validate and skip the leading XML declaration. | |
| static ra8_err_t | internal_pi (xml_reader_t *reader) |
| Validate and skip a PI or leading XML declaration. | |
| static ra8_err_t | internal_cdata (xml_reader_t *reader, xml_event_t *event) |
| Validate and emit one CDATA payload. | |
| static ra8_err_t | internal_special (xml_reader_t *reader, xml_event_t *event, bool *out_emitted) |
| Dispatch comment, CDATA, DOCTYPE, or processing instruction. | |
| static ra8_err_t | internal_text (xml_reader_t *reader, xml_event_t *event) |
| Validate and emit one text run. | |
Private contracts for the bounded XML reader implementation.
Declares the file-local lexical and event helpers of xml.c so their contracts remain authoritative without inflating the implementation unit. The entity/UTF-8 decoding half of the reader lives in xml_decode.c and documents its helpers at their definitions. [Ring 3 / LIB] {World: NS}
Definition in file xml_reader_internal.h.
|
static |
Test whether one byte is an ASCII letter.
Performs locale-independent XML-name classification.
| [in] | c | Byte to classify. |
| true | c is an ASCII letter. |
| false | c is outside both letter ranges. |
c is an unsigned source byte. c. References RA8_INTERNAL.
|
static |
Detect a duplicate attribute name.
Replays prior source-order attributes and compares raw QName bytes.
| [in] | source | Immutable XML source. |
| [in] | source_len | Exact readable source extent. |
| [in] | event | Start event being validated. |
| [in] | current | Newly parsed attribute. |
| [in] | prior_count | Number of prior attributes to compare. |
| true | Duplicate or malformed prior attribute detected. |
| false | Current name is unique among prior attributes. |
source_len. prior_count does not exceed the event's parsed prefix. References RA8_INTERNAL.
|
static |
Parse one attribute at a bounded tag cursor.
Validates QName, quoting, decoded value, and cursor progression.
| [in] | source | Immutable XML source. |
| [in] | source_len | Exact readable source extent. |
| [in] | end | Offset of the closing tag delimiter. |
| [in,out] | cursor | Attribute cursor. |
| [out] | out | Parsed source-aliasing attribute spans. |
| k_ra8_ok | Attribute parsed and decoded value validated. |
| k_ra8_err_validation_failed | Syntax or value was invalid. |
end and cursor position lie within source_len. out. References RA8_INTERNAL.
|
static |
Count and validate one start tag's attributes.
Enforces unique names, quoted decoded values, and exact tag tail.
| [in] | source | Immutable XML source. |
| [in] | source_len | Exact readable source extent. |
| [in,out] | event | Start event whose count is populated. |
| k_ra8_ok | Attributes validated and counted. |
| k_ra8_err_validation_failed | Tag attributes were malformed. |
source_len. event is writable and source remains immutable.
|
static |
Validate and emit one CDATA payload.
CDATA is accepted only within a live element and aliases source.
| [in,out] | reader | Active reader positioned at <![CDATA[. |
| [out] | event | CDATA event to populate. |
| k_ra8_ok | Payload validated and emitted. |
| k_ra8_err_validation_failed | Placement, bytes, or terminator was invalid. |
event is writable and does not overlap reader/source. References RA8_INTERNAL.
|
static |
Validate and skip one XML comment.
Rejects internal double dash and a payload ending in dash.
| [in,out] | reader | Active reader positioned at <!--. |
| k_ra8_ok | Comment validated and skipped. |
| k_ra8_err_validation_failed | Comment text or terminator was invalid. |
References RA8_INTERNAL.
|
static |
Validate and skip the leading XML declaration.
Enforces byte-zero/BOM-zero placement and ordered declaration grammar.
| [in,out] | reader | Active reader at the lowercase xml target. |
| [in] | target_end | One-past-last target byte. |
| [in] | term | First byte of ?>. |
| k_ra8_ok | Declaration accepted and skipped. |
| k_ra8_err_validation_failed | Placement or grammar was invalid. |
|
static |
Validate one ordered XML-declaration pseudo-attribute.
Enforces version first, then optional encoding and standalone.
| [in] | source | Immutable XML source. |
| [in] | source_len | Exact readable source extent. |
| [in] | attribute | Parsed pseudo-attribute. |
| [in] | ordinal | Zero-based declaration attribute index. |
| [in,out] | saw_encoding | Encoding-presence state. |
| [in,out] | saw_standalone | Standalone-presence state. |
| true | Attribute was accepted and state updated. |
| false | Attribute was invalid or out of order. |
source_len. References RA8_INTERNAL.
|
static |
Validate an XML declaration encoding name.
Accepts exactly UTF-8 or utf-8 and no aliases.
| [in] | source | Immutable XML source. |
| [in] | value | Source-relative declared encoding span. |
| true | Encoding is supported. |
| false | Encoding is absent from the supported set. |
value lies within readable source. References RA8_INTERNAL.
|
static |
Parse one close element and update nesting.
Allows trailing XML spacing and requires an exact open-name match.
| [in,out] | reader | Active pull reader positioned at a close tag. |
| [in] | end | Offset of its closing delimiter. |
| [out] | event | End event to populate. |
| k_ra8_ok | Event emitted and top frame popped. |
| k_ra8_err_validation_failed | Close syntax or nesting mismatched. |
end is within the reader source. References RA8_INTERNAL.
|
static |
Locate a markup closing byte while respecting quotes.
Ignores greater-than bytes inside single or double quoted values.
| [in] | source | Immutable XML source. |
| [in] | length | Exact readable source extent. |
| [in] | start | Offset of the opening less-than byte. |
| [out] | out_end | Offset of the closing greater-than byte. |
| k_ra8_ok | Closing byte located. |
| k_ra8_err_validation_failed | Markup was unterminated. |
source spans length bytes and start is in range. out_end is writable and does not overlap source. out_end within the source. References RA8_INTERNAL.
|
static |
Test a supported later ASCII NCName byte.
Adds digits, dot, and dash to the start-byte set.
| [in] | c | Byte to classify. |
| true | c can continue an NCName component. |
| false | c cannot continue one. |
c is an unsigned source byte. c. References RA8_INTERNAL.
|
static |
Test a supported ASCII NCName start byte.
Accepts an ASCII letter or underscore.
| [in] | c | Byte to classify. |
| true | c can begin an NCName component. |
| false | c cannot begin one. |
c is an unsigned source byte. c. References RA8_INTERNAL.
|
static |
Validate and skip a PI or leading XML declaration.
QName-validates the target and reserves case-insensitive XML.
| [in,out] | reader | Active reader positioned at <?. |
| k_ra8_ok | Instruction/declaration validated and skipped. |
| k_ra8_err_validation_failed | Target, data, or placement was invalid. |
References RA8_INTERNAL.
|
static |
Test whether one byte is XML spacing.
Recognises only space, tab, carriage return, and line feed.
| [in] | c | Byte to classify. |
| true | c is XML spacing. |
| false | c is not XML spacing. |
c is an unsigned source byte. c. References RA8_INTERNAL.
|
static |
Dispatch comment, CDATA, DOCTYPE, or processing instruction.
Fails closed for unsupported declarations and malformed openers.
| [in,out] | reader | Active reader positioned at special markup. |
| [out] | event | Optional semantic event storage. |
| [out] | out_emitted | Whether event contains CDATA. |
| k_ra8_ok | Supported markup validated and consumed. |
| k_ra8_err_validation_failed | Unsupported or malformed markup. |
|
static |
Parse one start element and update nesting.
Validates QName/attributes/root/depth before pushing a live frame.
| [in,out] | reader | Active pull reader positioned at a start tag. |
| [in] | end | Offset of its closing delimiter. |
| [out] | event | Start event to populate. |
| k_ra8_ok | Event emitted and reader advanced. |
| k_ra8_err_validation_failed | Tag, root, or depth was invalid. |
end is within the reader source and was quote-aware scanned. References RA8_INTERNAL.
|
static |
Locate a literal terminator in a bounded source.
Performs a forward byte-exact search without sentinel reads.
| [in] | source | Immutable source bytes. |
| [in] | length | Exact readable extent. |
| [in] | start | First candidate byte. |
| [in] | terminator | NUL-terminated ASCII terminator. |
| [out] | out_start | First terminator byte. |
| k_ra8_ok | Terminator found. |
| k_ra8_err_validation_failed | Terminator absent. |
start does not exceed length. References RA8_INTERNAL.
|
static |
Validate and emit one text run.
Validates UTF-8/entities, rejects raw ]]>, and enforces outer S.
| [in,out] | reader | Active reader positioned at text. |
| [out] | event | Text event to populate. |
| k_ra8_ok | Text span validated and emitted. |
| k_ra8_err_validation_failed | Text bytes or document placement was invalid. |
event is writable and does not overlap reader/source. References RA8_INTERNAL.
|
static |
Test for the reserved case-insensitive PI target XML.
Compares exactly three bytes with ASCII case folding.
| [in] | source | Immutable source bytes. |
| [in] | start | First target byte. |
| [in] | end | One-past-last target byte. |
| true | Reserved target matched. |
| false | Length or bytes differed. |
start does not exceed end. References RA8_INTERNAL.