(named-character-reference-state) ( document n string ch -- document n' string )


Vocabulary
html5

Inputs
documentan object
nan object
stringan object
chan object


Outputs
documentan object
n'an object
stringan object


Definition


:: (named-character-reference-state)
( document n string ch -- document n' string )
ch drop n 1 - :> start f :> match! start :> end! start 1 +
:> i!
[ i string length <= i start - longest-entity-name <= and ]
[
start i string subseq "&" prepend load-entities at
[ match! i end! ] when* i 1 + i!
] while match [
document temporary-buffer-attribute? end 1 - string nth
59 = not and end string ?nth dup
[ dup ascii-alphanumeric? swap 61 = or ] [ drop f ] if
and [
document flush-temporary-buffer
document start string return-state
] [
match "characters" of
document string>new-temporary-buffer
document flush-temporary-buffer
document end string return-state
] if
] [
document flush-temporary-buffer
document start string return-state
] if ;