1515 +----------------------------------------------------------------------+
1616*/
1717
18- /* Native markup (RFC: Native Markup Expressions) compile-time support:
18+ /* Native Markup Expressions compile-time support:
1919 *
2020 * - text normalization and character-reference decoding, called by the
2121 * lexer (Zend/zend_language_scanner.l) on markup text and literal
3636#include "zend_markup.h"
3737#include "zend_markup_entities.h"
3838
39- /* Native markup whitespace normalization (RFC §7) , following the JSX/Babel rules:
39+ /* Native markup whitespace normalization, following the JSX/Babel rules:
4040 * - split the text node into lines;
4141 * - trim leading whitespace on every line but the first, and trailing
4242 * whitespace on every line but the last;
4343 * - drop lines that are empty after trimming;
4444 * - join the surviving lines with a single space.
4545 * The net effect: indentation/newlines between block elements vanish, while a
4646 * meaningful single space between inline content is preserved. Returns a new
47- * zend_string (possibly empty — the caller drops empty text nodes).
47+ * zend_string (possibly empty - the caller drops empty text nodes).
4848 *
4949 * One streaming pass: because a non-first line is left-trimmed and a non-last
5050 * line is right-trimmed, any line that survives contains a non-whitespace
5151 * character, so "join surviving lines with a single space" is simply a space
52- * before every surviving line except the first — no line table or lookahead
52+ * before every surviving line except the first - no line table or lookahead
5353 * for the last non-blank line is needed. A single-line text is untouched apart
5454 * from the tab conversion, exactly as before. */
5555zend_string * zend_markup_normalize_text (const char * text , size_t len )
@@ -108,13 +108,13 @@ zend_string *zend_markup_normalize_text(const char *text, size_t len)
108108 return result ;
109109}
110110
111- /* Native markup character references (RFC §7) . Markup text and literal
111+ /* Native markup character references. Markup text and literal
112112 * attribute values decode HTML character references at compile time: the
113113 * frozen WHATWG named set (semicolon-terminated forms only; the standard
114114 * guarantees the list will never grow) plus numeric { / 😀 forms.
115115 * Decoding is lenient like HTML and JSX: anything that does not parse as a
116- * reference — a bare "&", an unknown name, an out-of-range or surrogate
117- * codepoint — stays literal text, so "fish & chips" needs no escaping.
116+ * reference - a bare "&", an unknown name, an out-of-range or surrogate
117+ * codepoint - stays literal text, so "fish & chips" needs no escaping.
118118 * Decoded text is a plain string escaped at render time, so "&" in source
119119 * round-trips to "&" in output. Text decodes after whitespace
120120 * normalization, so " " survives it (the entity spelling of JSX's {' '}). */
@@ -256,7 +256,7 @@ zend_string *zend_markup_decode_entities(zend_string *str)
256256 return smart_str_extract (& buf );
257257}
258258
259- /* Native markup AST lowering (RFC: Native Markup Expressions, Phase 2/3) .
259+ /* Native markup AST lowering.
260260 * Lower a markup element into an ordinary `new \Html\Element(tag, [], [children])`
261261 * (or `new \Html\Fragment([children])` when the tag name is empty) so no new AST
262262 * node kind or zend_compile.c support is needed. `name` is the tag-name zval AST
@@ -273,7 +273,7 @@ static zend_ast *zend_ast_markup_fq_name(const char *name, size_t len)
273273 return ast ;
274274}
275275
276- /* Element vs component classification (RFC §4) : a tag whose first character is
276+ /* Element vs component classification: a tag whose first character is
277277 * uppercase, which is namespace-qualified (contains "\"), or which names a
278278 * static method via "::", dispatches as a component; anything else is a literal
279279 * HTML element. The single home for this rule: the compiler applies it to
@@ -302,7 +302,7 @@ static zend_ast *zend_ast_wrap_fragment(zend_ast *children)
302302}
303303
304304/* Wrap a string AST in a `\Html\raw(...)` call (trusted passthrough). Used for
305- * `<!-- … -->` comments, which are emitted as literal HTML (RFC §7) . */
305+ * `<!-- … -->` comments, which are emitted as literal HTML. */
306306zend_ast * zend_ast_create_markup_raw (zend_ast * str )
307307{
308308 zend_ast * fn = zend_ast_markup_fq_name (ZEND_STRL (ZEND_MARKUP_RAW_FQ ));
@@ -311,16 +311,16 @@ zend_ast *zend_ast_create_markup_raw(zend_ast *str)
311311}
312312
313313/* Wrap a children list in
314- * `new \Html\LazyFragment(fn() => new \Html\Fragment([children]))` (RFC §5, the
315- * `:lazy` directive). The arrow function defers building the child subtree —
316- * and running any side effects in its interpolations — until the component
314+ * `new \Html\LazyFragment(fn() => new \Html\Fragment([children]))` (the
315+ * `:lazy` directive). The arrow function defers building the child subtree -
316+ * and running any side effects in its interpolations - until the component
317317 * actually renders the slot, so a component that discards its body never
318318 * evaluates it. Consumes `children`. */
319319static zend_ast * zend_ast_wrap_lazy_fragment (zend_ast * children , uint32_t lineno )
320320{
321321 zend_ast * frag = zend_ast_wrap_fragment (children );
322322
323- /* fn() => new \Html\Fragment([...]) — an arrow function so its body
323+ /* fn() => new \Html\Fragment([...]) - an arrow function so its body
324324 * auto-captures by value whatever it references, exactly as a hand-written
325325 * one would; only the expression evaluation is deferred. */
326326 zend_ast * params = zend_ast_create_list (0 , ZEND_AST_PARAM_LIST );
@@ -362,24 +362,24 @@ static bool zend_markup_extract_lazy(zend_ast *attrs)
362362
363363/* Lower a component tag (a capitalized or namespace-qualified name, or
364364 * "Class::method") into a call to \Html\render_component(component, props, slot)
365- * (RFC §3). Attributes become the props array and the body content becomes a
365+ * Attributes become the props array and the body content becomes a
366366 * single \Html\Fragment passed as the slot (or a lazy \Html\LazyFragment when
367367 * the `:lazy` directive is present).
368368 *
369369 * Component resolution is two-stage, and every tag resolves through the *class*
370370 * name rules only: a bare/qualified tag lowers to ZEND_AST_CLASS_NAME (the
371371 * `Component::class` machinery), and a "Class::method" tag lowers the class
372- * part the same way with "::method" appended — both honor `use` imports and
372+ * part the same way with "::method" appended - both honor `use` imports and
373373 * the current namespace, with a leading "\" fully qualified. The runtime then
374374 * resolves the name to a class implementing Html\Htmlable (instantiated) or a
375- * public static method (called) — see PHP_FUNCTION(Html_render_component) in
375+ * public static method (called) - see PHP_FUNCTION(Html_render_component) in
376376 * ext/html/html.c.
377377 *
378378 * Plain *function* components are deliberately out of v1: a bare tag gives no
379379 * signal whether a class or a function is meant, and functions resolve through
380380 * the separate `use function` import table, so supporting them would need a
381381 * second compile-time resolution and a new AST kind to carry it. A static
382- * method has no such ambiguity — its class part resolves like any class. */
382+ * method has no such ambiguity - its class part resolves like any class. */
383383static zend_ast * zend_ast_create_markup_component (zend_ast * name , zend_ast * attrs , zend_ast * children )
384384{
385385 uint32_t lineno = zend_ast_get_lineno (name );
@@ -415,7 +415,7 @@ static zend_ast *zend_ast_create_markup_component(zend_ast *name, zend_ast *attr
415415 }
416416 attrs -> attr = ZEND_ARRAY_SYNTAX_SHORT ;
417417
418- /* The `:lazy` directive is a compiler marker, not a prop — strip it first. */
418+ /* The `:lazy` directive is a compiler marker, not a prop - strip it first. */
419419 bool lazy = zend_markup_extract_lazy (attrs );
420420
421421 /* The body becomes a single slot Fragment, or null when there is no body.
@@ -465,7 +465,7 @@ zend_ast *zend_ast_create_markup_element(zend_ast *name, zend_ast *attrs, zend_a
465465 ? zend_ast_get_lineno (name ) : zend_ast_get_lineno (children );
466466
467467 /* A capitalized name, a namespace-qualified name, or one containing "::"
468- * is a component (RFC §3) . */
468+ * is a component. */
469469 if (name != NULL && zend_markup_name_is_component (zend_ast_get_str (name ))) {
470470 result = zend_ast_create_markup_component (name , attrs , children );
471471 result -> lineno = lineno ;
@@ -500,7 +500,7 @@ zend_ast *zend_ast_create_markup_element(zend_ast *name, zend_ast *attrs, zend_a
500500}
501501
502502/* Build a markup element (or, with `dynamic`, a dynamic tag) after checking
503- * the closing tag matches the opener (RFC §7) : `<div>…</span>` and
503+ * the closing tag matches the opener: `<div>…</span>` and
504504 * `<$a>…</$b>` are compile errors alike. Both `open` and `close` NULL means a
505505 * `<>…</>` fragment. `close` is consumed. */
506506zend_ast * zend_ast_create_markup_checked (zend_ast * open , zend_ast * attrs , zend_ast * children , zend_ast * close , bool dynamic )
@@ -568,7 +568,7 @@ static zend_ast *zend_markup_dynamic_call(zend_ast *tag_expr, zend_ast *attrs, z
568568 return result ;
569569}
570570
571- /* Lower a dynamic tag `<$tag …>…</$tag>` (RFC §4) into a call to
571+ /* Lower a dynamic tag `<$tag …>…</$tag>` into a call to
572572 * \Html\render_dynamic($tag, attributes, children). The variable's runtime
573573 * value decides what a static tag name decides at compile time, by the same
574574 * classification rule (zend_markup_name_is_component); only classification
@@ -592,4 +592,3 @@ zend_ast *zend_ast_create_markup_dynamic_expr(zend_ast *expr, zend_ast *attrs, z
592592{
593593 return zend_markup_dynamic_call (expr , attrs , children , zend_ast_get_lineno (expr ));
594594}
595-
0 commit comments