jssm 5.145.6 → 5.146.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,81 @@
1
+ /**
2
+ * CodeMirror 6 language support for FSL (the source language of jssm
3
+ * finite-state machines), exposed at the `jssm/cm6` subpath.
4
+ *
5
+ * Built on `StreamLanguage` (token-stream based, not a Lezer tree grammar) —
6
+ * a deliberate v1 choice (see `notes/superpowers/specs/2026-05-12-editor-widget-packaging-design.md`):
7
+ * the tokenizer never blocks on the parser, so a failing parse never kills
8
+ * highlighting. The companion linter (driven by `fsl_parser.parse()`) supplies
9
+ * error squiggles separately.
10
+ *
11
+ * The keyword vocabulary is reconciled against the live grammar
12
+ * (`src/ts/fsl_parser.peg`) and guarded by `fsl_language.spec.ts`, which
13
+ * extracts the grammar's config keys and fails if any is not recognized here —
14
+ * so the highlighter cannot silently drift out of date the way the original
15
+ * `sketch/cm6-lang-fsl` did.
16
+ */
17
+ import { StreamLanguage, LanguageSupport, HighlightStyle, type StreamParser } from '@codemirror/language';
18
+ import { Tag } from '@lezer/highlight';
19
+ /**
20
+ * Tag modifier marking FSL syntax that still parses but is deprecated (e.g.
21
+ * the flat `graph_bg_color` key, superseded by the `graph: {}` block). Applied
22
+ * to a base tag — `fslDeprecated(tags.propertyName)` — and rendered distinctly
23
+ * by {@link fslHighlightStyle} (struck through) so editors can flag stale
24
+ * syntax. StreamLanguage expresses this through its `tokenTable`; see
25
+ * {@link fslStreamParser}.
26
+ */
27
+ export declare const fslDeprecated: (tag: Tag) => Tag;
28
+ /**
29
+ * Structural / declaration keywords — block openers and the `property`
30
+ * declaration keyword. Highlighted as `keyword`.
31
+ */
32
+ export declare const STRUCTURAL_KEYWORDS: ReadonlySet<string>;
33
+ /**
34
+ * Configuration / property / style keys (the left side of a `key: value;`
35
+ * config line). Highlighted as `propertyName`. Reconciled against the
36
+ * `"<key>" WS? ":"` rules in `fsl_parser.peg` and guarded by the drift test.
37
+ */
38
+ export declare const PROPERTY_KEYWORDS: ReadonlySet<string>;
39
+ /**
40
+ * Keys that still parse but are deprecated. Highlighted with the
41
+ * {@link fslDeprecated} modifier so editors can visibly flag them.
42
+ */
43
+ export declare const DEPRECATED_KEYWORDS: ReadonlySet<string>;
44
+ /**
45
+ * Enumerated literal values (layout engines, corner/line styles, directions,
46
+ * booleans, theme names). Highlighted as `atom`.
47
+ */
48
+ export declare const ENUM_KEYWORDS: ReadonlySet<string>;
49
+ interface FslStreamState {
50
+ inBlockComment: boolean;
51
+ }
52
+ /**
53
+ * The StreamLanguage tokenizer for FSL. Classifies each token into a standard
54
+ * CodeMirror highlight name, or {@link DEPRECATED_TOKEN} (mapped through
55
+ * `tokenTable` to `fslDeprecated(tags.propertyName)`).
56
+ */
57
+ export declare const fslStreamParser: StreamParser<FslStreamState>;
58
+ /**
59
+ * CodeMirror 6 `Language` for FSL. Most consumers use {@link fsl} instead.
60
+ */
61
+ export declare const fslLanguage: StreamLanguage<FslStreamState>;
62
+ /**
63
+ * Recommended highlight style. Beyond the editor theme's own keyword/string/etc.
64
+ * rules, this renders {@link fslDeprecated} tokens struck-through and dimmed, so
65
+ * deprecated FSL syntax is visible at a glance. Include it alongside your theme;
66
+ * a bare theme without it simply won't distinguish deprecated keywords.
67
+ */
68
+ export declare const fslHighlightStyle: HighlightStyle;
69
+ /**
70
+ * CodeMirror 6 `LanguageSupport` for FSL. Drop into an editor's `extensions`.
71
+ *
72
+ * @returns A `LanguageSupport` extension for FSL highlighting.
73
+ *
74
+ * @example
75
+ * import { EditorView, basicSetup } from 'codemirror';
76
+ * import { fsl } from 'jssm/cm6';
77
+ * new EditorView({ doc: "a 'go' -> b;", parent: document.body,
78
+ * extensions: [ basicSetup, fsl() ] });
79
+ */
80
+ export declare function fsl(): LanguageSupport;
81
+ export {};