@descent-vtt/spec-guard 0.25.0 → 0.27.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.
@@ -61,11 +61,12 @@ export declare const SYNTAX_NAMES: Record<ModuleLanguage, string>;
61
61
  /** Strips the delimiters off a literal as the lexer captured it. */
62
62
  export declare function literalValue(raw: string): string;
63
63
  /**
64
- * Whitespace-skipping cursor over masked code.
64
+ * Whitespace-skipping cursor over masked code, which a Go import and a Python
65
+ * dynamic import are read with.
65
66
  *
66
67
  * Exported so its edges can be pinned directly. Reaching "what does peek() do
67
- * at the end of the file" through a C# source string is possible but says
68
- * nothing about C#.
68
+ * at the end of the file" through a Go source string is possible but says
69
+ * nothing about Go.
69
70
  */
70
71
  export declare class Reader {
71
72
  readonly text: string;
@@ -73,36 +74,7 @@ export declare class Reader {
73
74
  constructor(text: string);
74
75
  skipSpace(): void;
75
76
  peek(): string;
76
- eat(token: string): boolean;
77
- /**
78
- * Eats a word only when it really is the whole word.
79
- *
80
- * `eat('static')` also matches the first six characters of a namespace called
81
- * `staticfiles`, and would then read the dependency as `files`.
82
- */
83
- keyword(word: string): boolean;
84
77
  identifier(): string;
85
- /**
86
- * Reads `a.b.c`, leaving out a C# alias qualifier.
87
- *
88
- * `global::A.B` and `Legacy::A.B` both name the namespace `A.B`: what comes
89
- * before `::` says where to look it up - the global namespace, or the
90
- * assembly an extern alias names - and is not part of the name. Until 0.10.2
91
- * this read `global.A.B`, and no pattern written for `A.B` matched it.
92
- */
93
- dotted(): string;
94
- /**
95
- * Skips a generic argument list, so an alias target's `<...>` does not end
96
- * the read.
97
- *
98
- * No bracket counting. A `using` directive ends at the first `;` or newline
99
- * whatever is nested inside its angle brackets, and the caller's only
100
- * question is whether the next non-space character is that `;` - so `A<B>`
101
- * and `A<B<C>>` are both passed over by the same rule. The depth counter
102
- * that used to be here could not change an answer for any input C# accepts,
103
- * which is another way of saying no test could hold it in place.
104
- */
105
- skipGenerics(): void;
106
78
  }
107
79
  /** Offset of the matching close, given the depth-tracking characters. */
108
80
  export declare function matchingClose(text: string, open: number, opener: string, closer: string): number;
@@ -115,20 +87,32 @@ export declare function matchingClose(text: string, open: number, opener: string
115
87
  *
116
88
  * A line ends where Python ends one: at LF, at CRLF and at a lone CR. Only
117
89
  * LF ended one here, so every line of a file with CRLF endings kept its
118
- * carriage return. The pattern that reads a `from` statement cannot reach
90
+ * carriage return. The pattern that read a `from` statement could not reach
119
91
  * the end of such a line, and read none in the file, and a backslash before
120
92
  * the carriage return continued nothing (ADR-0008, amended 2026-10-12).
93
+ *
94
+ * `starts` is where each physical line begins, in the text and in the
95
+ * source. A statement after a `;` stands on a line of its own where the
96
+ * statement before it ran over several, and is reported there (ADR-0008,
97
+ * amended 2026-10-14).
121
98
  */
122
99
  export declare function logicalLines(code: string): Array<{
123
100
  text: string;
124
101
  offset: number;
102
+ starts: Array<[at: number, offset: number]>;
125
103
  }>;
126
104
  /**
127
- * Expands one `use` path into the module paths it actually names.
105
+ * Expands one use tree, with its `;` or without, into the module paths it
106
+ * names.
128
107
  *
129
- * `a::{b, c::{d, e}}` is three dependencies written as one statement, and a
130
- * rule about `a::c` has to see them. Returns null when the expansion would
131
- * exceed MAX_EXPANSION, which the caller reports rather than truncating.
108
+ * `a::{b, c::{d, e}}` is three dependencies written as one declaration, and a
109
+ * rule about `a::c` has to see them. A tree is read as rustc reads it: white
110
+ * space and comments between its tokens, a raw identifier without its `r#`, a
111
+ * name in its NFC form, and `self` at the end of a path naming what is before
112
+ * it. Text that is no use tree, which rustc refuses, names nothing (ADR-0008,
113
+ * amended 2026-10-18). Returns null when the tree would name more than
114
+ * MAX_EXPANSION paths, or nest its groups deeper than that, which the caller
115
+ * reports rather than truncating.
132
116
  */
133
117
  export declare function expandUsePath(input: string): string[] | null;
134
118
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"polyglot.d.ts","sourceRoot":"","sources":["../src/polyglot.ts"],"names":[],"mappings":"AAAA;;;;;;;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