Handbook
Glossary
(named-character-reference-state) ( document n string ch -- document n' string )
Vocabulary
html5
Inputs
document
an
object
n
an
object
string
an
object
ch
an
object
Outputs
document
an
object
n'
an
object
string
an
object
Definition
USING:
assocs
kernel
math
sequences
;
IN:
html5
::
(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
;