~/lightning

Lightning Talk: Improving an HTML Parser with Swift 6 Pattern Matching

Lightningat CppCon 2024 · on Sunday, 2024-09-15· [swift, web-platform]
slides:none on file

A C++ HTML tokenizer for Ladybird LibWeb is rewired into Swift 6 pattern matching and choice types, replacing a macro-heavy giant switch with small functions that return enum results to drive the top-level state machine. The HTML spec requires roughly 80 parser states, and the reimplementation targets the tokenizer portion, emitting tokens, switching states, or EOF via pattern matches. The result compiles and runs, yielding a far clearer, testable state machine and removing goto/macros while matching the spec.

AI-written summary · about

~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.