Commit 6541fae
committed
Improve JS highlighter fidelity: bare-param scoping + regex after contextual keywords
Two language-agnostic gen-tm fixes surfaced by the JavaScript coverage gate:
- Unannotated parameters (plain function f(x), methods, constructors) now get
variable.parameter instead of variable.other. Previously only arrow params and
type-annotated params (x: T) triggered param scoping, so the copy+strip'd JS
grammar -- which has no annotations -- lost it. A structural declaration-param-name
matcher inside the params scope handles bare params; annotated params still defer
to the type-annotation path. JS highlighter visual accuracy 96.4% -> 98.0%
(real-gap 16 -> 9 tokens).
- Regex-vs-division detection now flattens alt()/opt()/group() when collecting the
keywords that may precede an expression, so a keyword reachable only through an
alternative (e.g. alt('in','of') Expr in the for-head) is seen. Fixes regex
literals after `of` (for (x of /re/.exec(s)), upstream #883) in both the JS and
TS TextMate output; a / b still parses as division.
Both engine changes stay agnostic (no hardcoded language tokens; agnostic 5/5).
TS unaffected: coverage 99.3%, valid-code 100% (FN=0), bidirectional 97.84%.
Regenerated both grammars' artifacts.1 parent cb39056 commit 6541fae
4 files changed
Lines changed: 61 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
187 | | - | |
| 187 | + | |
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
| |||
418 | 418 | | |
419 | 419 | | |
420 | 420 | | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
421 | 432 | | |
422 | 433 | | |
423 | 434 | | |
| |||
433 | 444 | | |
434 | 445 | | |
435 | 446 | | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
436 | 450 | | |
437 | 451 | | |
438 | 452 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
399 | 399 | | |
400 | 400 | | |
401 | 401 | | |
402 | | - | |
| 402 | + | |
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
797 | 808 | | |
798 | 809 | | |
799 | 810 | | |
| |||
812 | 823 | | |
813 | 824 | | |
814 | 825 | | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
815 | 829 | | |
816 | 830 | | |
817 | 831 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
981 | 981 | | |
982 | 982 | | |
983 | 983 | | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
984 | 991 | | |
985 | | - | |
| 992 | + | |
986 | 993 | | |
987 | 994 | | |
988 | 995 | | |
| |||
1777 | 1784 | | |
1778 | 1785 | | |
1779 | 1786 | | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
1780 | 1809 | | |
1781 | 1810 | | |
1782 | 1811 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
315 | 315 | | |
316 | 316 | | |
317 | 317 | | |
318 | | - | |
| 318 | + | |
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| |||
0 commit comments