HS-gen: string-aware line-comment stripping (+1 test)

process_hs_val stripped `//…` line comments with a naïve regex,
which devoured `https://yyy.xxxxxx.com/…` inside a backtick template
— the 'properly interpolates values 2' fixture was landing with
the HS source truncated at `https:`.

New helper _strip_hs_line_comments walks char-by-char and only
strips `//` / leading-whitespace `--` when not inside `'…'`, `"…"`,
or backticks; respects `\\`-escapes inside strings.

Suite hs-upstream-core/regressions: 11/16 → 12/16.
Smoke 0-195: 163/195 → 164/195.
This commit is contained in:
2026-04-24 09:42:19 +00:00
parent 094945d86a
commit cb37259d10
4 changed files with 51 additions and 9 deletions

View File

@@ -2070,7 +2070,7 @@
(deftest "properly interpolates values 2"
(hs-cleanup!)
(let ((_el-button (dom-create-element "button")))
(dom-set-attr _el-button "_" "on click set trackingcode to `AB123456789KK` then set pdfurl to `https:")
(dom-set-attr _el-button "_" "on click set trackingcode to `AB123456789KK` then set pdfurl to `https://yyy.xxxxxx.com/path/out/${trackingcode}.pdf` then put pdfurl into me")
(dom-append (dom-body) _el-button)
(hs-activate! _el-button)
(dom-dispatch _el-button "click" nil)
@@ -11019,7 +11019,7 @@
(deftest "handles set url regression properly"
(hs-cleanup!)
(let ((_el-div (dom-create-element "div")))
(dom-set-attr _el-div "_" "on click set trackingcode to `foo` then set pdfurl to `https:")
(dom-set-attr _el-div "_" "on click set trackingcode to `foo` then set pdfurl to `https://yyy.xxxxxx.com/path/out/${trackingcode}.pdf` then put pdfurl into me")
(dom-set-inner-html _el-div "lolwat")
(dom-append (dom-body) _el-div)
(hs-activate! _el-div)