From d0b358eca23548d90282ebf30f892400816f7e9d Mon Sep 17 00:00:00 2001 From: giles Date: Fri, 8 May 2026 07:16:27 +0000 Subject: [PATCH] =?UTF-8?q?HS:=20parser+compiler=20=E2=80=94=20toggle=20fo?= =?UTF-8?q?r-in=20lookahead,=20throttled/debounced=20modifiers=20(-2=20ski?= =?UTF-8?q?ps)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit parser.sx parse-toggle-cmd: when seeing 'toggle .foo for', peek the following two tokens. If they are ' in', it is a for-in loop and toggle does NOT consume 'for' as a duration clause. Restores the trailing for-in to the command list. parser.sx parse-on (handler modifiers): recognize 'throttled at ' and 'debounced at ' as handler modifiers. Captured as :throttle / :debounce kwargs in the on-form parts list. compiler.sx emit-on: pre-extract :throttle / :debounce from parts via new _strip-throttle-debounce helper before scan-on, then wrap the built handler with (hs-throttle! handler ms) or (hs-debounce! handler ms). runtime.sx: hs-throttle! — closure with __hs-last-fire timestamp, fires immediately and drops events arriving within ms of the last fire. hs-debounce! — closure with __hs-timer, clears any pending timer and schedules a new setTimeout(handler, ms) so only the last burst event fires. Both formerly-architectural skips now pass: - "toggle does not consume a following for-in loop" - "throttled at