squiffy-compiler 7.0.0-beta.5 → 7.0.0-beta.6

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,305 @@
1
+ // Converts the text of a Quest gamebook page, which is HTML with Quest's text processor commands
2
+ // in it ({if ...}, {once:...}, {page:...} and so on), into Squiffy text.
3
+ import { attributeRef, display, print, quote, Unconvertible } from "../twine/expression.js";
4
+ import { sectionLink, urlLink } from "../twine/convert.js";
5
+ // Finds the next {...} the way Quest does: the first {, and the } that matches it, counting the
6
+ // ones in between. Undefined if there isn't one.
7
+ function nextCommand(text, from) {
8
+ const start = text.indexOf("{", from);
9
+ if (start == -1)
10
+ return undefined;
11
+ let depth = 1;
12
+ for (let i = start + 1; i < text.length; i++) {
13
+ if (text[i] == "{")
14
+ depth++;
15
+ else if (text[i] == "}" && --depth == 0)
16
+ return { start, end: i };
17
+ }
18
+ return undefined;
19
+ }
20
+ export function convertQuestText(text, ctx, mode) {
21
+ let result = "";
22
+ let pos = 0;
23
+ text = text.replace(/\r\n?/g, "\n");
24
+ for (;;) {
25
+ const command = nextCommand(text, pos);
26
+ if (!command)
27
+ break;
28
+ result += literal(text.substring(pos, command.start), mode);
29
+ const inner = text.substring(command.start + 1, command.end);
30
+ try {
31
+ result += convertCommand(inner, ctx, mode);
32
+ }
33
+ catch (e) {
34
+ if (!(e instanceof Unconvertible))
35
+ throw e;
36
+ result += ctx.unconvertible(`{${inner}}`, `This couldn't be converted: ${e.message}.`);
37
+ }
38
+ pos = command.end + 1;
39
+ }
40
+ return result + literal(text.substring(pos), mode);
41
+ }
42
+ // The commands Quest's gamebook text processor has, in the order it tries them
43
+ const commands = [
44
+ "if ", "either ", "here ", "nothere ", "popup:", "i:", "b:", "s:", "u:", "colour:", "color:", "back:", "object:",
45
+ "command:", "page:", "exit:", "once:", "notfirst:", "random:", "rndalt:", "img:", "counter:", "select:", "eval:", "=",
46
+ ];
47
+ function convertCommand(section, ctx, mode) {
48
+ const command = commands.find(c => section.startsWith(c));
49
+ const nested = (t) => convertQuestText(t, ctx, mode);
50
+ switch (command) {
51
+ case "if ":
52
+ return convertIf(section, ctx, mode);
53
+ case "i:":
54
+ case "b:":
55
+ case "s:":
56
+ case "u:": {
57
+ const tag = section[0];
58
+ return `<${tag}>${nested(section.substring(2))}</${tag}>`;
59
+ }
60
+ case "colour:":
61
+ case "color:":
62
+ case "back:": {
63
+ // Quest splits these at every colon, not just the first two
64
+ const parts = section.split(":");
65
+ const colour = parts[1] ?? "";
66
+ const rest = parts.slice(2).join(":");
67
+ const property = command == "back:" ? "background-color" : "color";
68
+ return `<span style="${property}: ${escapeAttribute(colour.trim())}">${nested(rest)}</span>`;
69
+ }
70
+ case "command:":
71
+ case "page:":
72
+ return convertPageLink(section, ctx, mode);
73
+ case "once:":
74
+ return `{{#if ${print(visits(ctx))} = 1}}${nested(section.substring(5))}{{/if}}`;
75
+ case "notfirst:":
76
+ return `{{#if ${print(visits(ctx))} > 1}}${nested(section.substring(9))}{{/if}}`;
77
+ case "random:":
78
+ return convertRandom(section.substring(7), ctx);
79
+ case "img:": {
80
+ const file = section.substring(4).trim();
81
+ ctx.asset(file);
82
+ return `<img src="${escapeAttribute(file)}" alt="">`;
83
+ }
84
+ case "counter:":
85
+ // Quest shows 0 for a counter that hasn't been set, as adding 0 does
86
+ return `{{= ${attributeRef(ctx.attribute(section.substring(8)))} + 0}}`;
87
+ case "popup:": {
88
+ const parts = section.substring(6).split(":");
89
+ const link = parts[0];
90
+ const content = parts.slice(1).join(":");
91
+ if (!ctx.addPassage || mode == "inline") {
92
+ ctx.approximate(`{${section}}`, "Squiffy has no popups, and this one is in a link's text, so only its link text has been kept.");
93
+ return nested(link);
94
+ }
95
+ // A passage link shows the popup's text when it's clicked
96
+ const name = ctx.addPassage(link, convertQuestText(content, ctx, "block"));
97
+ return `[${nested(link).replace(/\]/g, "&#93;").replace(/\[/g, "&#91;")}](${name})`;
98
+ }
99
+ case "either ":
100
+ case "eval:":
101
+ case "=":
102
+ throw new Unconvertible("Quest expressions in text can't be converted yet");
103
+ case "here ":
104
+ case "nothere ":
105
+ case "object:":
106
+ case "exit:":
107
+ throw new Unconvertible("it's for Quest's text adventures, not gamebooks");
108
+ case "rndalt:":
109
+ case "select:":
110
+ throw new Unconvertible(`Squiffy has nothing like {${command}}`);
111
+ }
112
+ return convertOther(section, ctx, mode);
113
+ }
114
+ // {game.score} shows an attribute. Anything else in curly brackets is shown as it is.
115
+ function convertOther(section, ctx, mode) {
116
+ const dot = section.indexOf(".");
117
+ if (dot != -1) {
118
+ const object = section.substring(0, dot);
119
+ const attribute = section.substring(dot + 1);
120
+ if (object == "game" && /^[\w ]+$/.test(attribute)) {
121
+ return display({ k: "var", name: ctx.attribute(attribute) });
122
+ }
123
+ if (/^[\w ]+$/.test(object) && /^\w+$/.test(attribute) && (object == "player" || ctx.target(object))) {
124
+ return display({ k: "var", name: ctx.attribute(objectAttribute(object, attribute)) });
125
+ }
126
+ }
127
+ return literalBraces(convertQuestText(section, ctx, mode));
128
+ }
129
+ // Text Quest shows in curly brackets, as it doesn't know the command. They're written as
130
+ // entities, so Squiffy doesn't take them for Squiffy 5 commands.
131
+ function literalBraces(inner) {
132
+ return "&#123;" + inner + "&#125;";
133
+ }
134
+ // The Squiffy attribute for an attribute of the player or a page, such as player.strength. Flags
135
+ // and counters are attributes of the game, and keep their names.
136
+ export function objectAttribute(object, attribute) {
137
+ return object == "game" ? attribute : `${object}_${attribute}`;
138
+ }
139
+ function visits(ctx) {
140
+ return { k: "call", fn: "visits", args: [{ k: "str", v: ctx.section }] };
141
+ }
142
+ // {if flag:text}, {if not flag:text}, {if counter>5:text}, {if game.flag:text}, {if Page3.visited:text}
143
+ function convertIf(section, ctx, mode) {
144
+ const command = section.substring(3);
145
+ const colon = command.indexOf(":");
146
+ // Quest shows an {if} with no text as it is
147
+ if (colon == -1)
148
+ return literalBraces(convertQuestText(section, ctx, mode));
149
+ const text = convertQuestText(command.substring(colon + 1), ctx, mode);
150
+ const condition = command.substring(0, colon);
151
+ const operator = ["<=", ">=", "<>", "<", ">", "="].find(op => condition.includes(op));
152
+ let expr;
153
+ if (!operator) {
154
+ let name = condition.trim();
155
+ let negate = false;
156
+ if (name.startsWith("not ")) {
157
+ negate = true;
158
+ name = name.substring(4).trim();
159
+ }
160
+ expr = reference(name, ctx);
161
+ if (negate)
162
+ expr = { k: "not", e: expr };
163
+ }
164
+ else {
165
+ const index = condition.indexOf(operator);
166
+ const lhs = reference(condition.substring(0, index).trim(), ctx);
167
+ const rhsText = condition.substring(index + operator.length).trim();
168
+ const rhs = /^-?\d+(\.\d+)?$/.test(rhsText) ? { k: "num", v: Number(rhsText) } : { k: "str", v: rhsText };
169
+ expr = { k: "bin", op: operator == "<>" ? "!=" : operator, l: lhs, r: rhs };
170
+ }
171
+ return `{{#if ${print(expr)}}}${text}{{/if}}`;
172
+ }
173
+ // A flag or counter, game.attribute, or page.visited, in an {if}
174
+ function reference(name, ctx) {
175
+ const dot = name.indexOf(".");
176
+ if (dot == -1)
177
+ return { k: "var", name: ctx.attribute(name) };
178
+ const object = name.substring(0, dot).trim();
179
+ const attribute = name.substring(dot + 1).trim();
180
+ if (!/^\w+$/.test(attribute))
181
+ throw new Unconvertible(`Squiffy can't read ${name}`);
182
+ if (object == "game")
183
+ return { k: "var", name: ctx.attribute(attribute) };
184
+ const target = ctx.target(object);
185
+ if (attribute == "visited") {
186
+ if (target && "section" in target)
187
+ return { k: "call", fn: "seen", args: [{ k: "str", v: target.section }] };
188
+ if (!target) {
189
+ ctx.approximate(name, `There's no page called "${object}", so this is never true, as in Quest.`);
190
+ return { k: "bool", v: false };
191
+ }
192
+ }
193
+ if (object == "player" || target)
194
+ return { k: "var", name: ctx.attribute(objectAttribute(object, attribute)) };
195
+ throw new Unconvertible(`there's nothing called "${object}" in the game`);
196
+ }
197
+ // {page:Page2}, {page:Page2:text}, and {command:Page2:text}, which does the same in a gamebook
198
+ function convertPageLink(section, ctx, mode) {
199
+ let page = section.substring(section.indexOf(":") + 1);
200
+ let text = page;
201
+ const colon = page.indexOf(":");
202
+ if (colon != -1) {
203
+ text = page.substring(colon + 1);
204
+ page = page.substring(0, colon);
205
+ }
206
+ const linkText = convertQuestText(text, ctx, "inline");
207
+ if (mode == "inline") {
208
+ ctx.approximate(`{${section}}`, "This link is in a link's text, or one of a random choice, where Squiffy can't have a link, so only its text has been kept.");
209
+ return linkText;
210
+ }
211
+ const target = ctx.target(page);
212
+ if (!target) {
213
+ ctx.approximate(`{${section}}`, `There's no page called "${page}", so this isn't a link.`);
214
+ return linkText;
215
+ }
216
+ if ("url" in target)
217
+ return urlLink(linkText, target.url);
218
+ return sectionLink(linkText, target.section);
219
+ }
220
+ // Quest's Tsplit: splits at colons that aren't inside {...}
221
+ function splitItems(text) {
222
+ const items = [];
223
+ let depth = 0;
224
+ let start = 0;
225
+ for (let i = 0; i < text.length; i++) {
226
+ if (text[i] == "{")
227
+ depth++;
228
+ else if (text[i] == "}")
229
+ depth--;
230
+ else if (text[i] == ":" && depth <= 0) {
231
+ items.push(text.substring(start, i));
232
+ start = i + 1;
233
+ }
234
+ }
235
+ items.push(text.substring(start));
236
+ return items;
237
+ }
238
+ function convertRandom(text, ctx) {
239
+ const items = splitItems(text).map(item => {
240
+ const converted = convertQuestText(item, ctx, "inline");
241
+ if (/\{\{|\[\[/.test(converted))
242
+ throw new Unconvertible("Squiffy's {{random}} can't have links or other commands in its choices");
243
+ return converted;
244
+ });
245
+ return `{{random (array${items.map(i => " " + quote(i)).join("")})}}`;
246
+ }
247
+ function escapeAttribute(s) {
248
+ return s.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/\[/g, "&#91;").replace(/\]/g, "&#93;");
249
+ }
250
+ // Text from the page, with no commands in it, as Squiffy text. Quest's text is HTML, not
251
+ // Markdown, so anything Markdown would read is escaped, outside HTML tags. In a page's text,
252
+ // <br/> and line breaks become Squiffy lines, and two or more of them a new paragraph.
253
+ function literal(text, mode) {
254
+ if (!text)
255
+ return "";
256
+ let result = "";
257
+ let pos = 0;
258
+ for (const tag of text.matchAll(/<\/?[A-Za-z][^<>]*>/g)) {
259
+ result += prose(text.substring(pos, tag.index));
260
+ result += tag[0].replace(/\[/g, "&#91;").replace(/\]/g, "&#93;").replace(/\{\{/g, "&#123;{").replace(/\}\}/g, "}&#125;");
261
+ pos = tag.index + tag[0].length;
262
+ }
263
+ result += prose(text.substring(pos));
264
+ if (mode == "inline")
265
+ return result.replace(/\s*\n\s*/g, " ");
266
+ return result.replace(/(?:[ \t]*(?:<br\s*\/?>|\n)[ \t]*)+/gi, breaks => {
267
+ const count = (breaks.match(/<br\s*\/?>|\n/gi) ?? []).length;
268
+ return count >= 2 ? "\n\n" : "\n";
269
+ });
270
+ }
271
+ function prose(text) {
272
+ let result = "";
273
+ for (let i = 0; i < text.length; i++) {
274
+ const c = text[i];
275
+ if (c == "*")
276
+ result += "&#42;";
277
+ else if (c == "`")
278
+ result += "&#96;";
279
+ else if (c == "~")
280
+ result += "&#126;";
281
+ else if (c == "\\")
282
+ result += "&#92;";
283
+ else if (c == "[")
284
+ result += "&#91;";
285
+ else if (c == "]")
286
+ result += "&#93;";
287
+ else if (c == "_" && !(/\w/.test(text[i - 1] ?? "") && /\w/.test(text[i + 1] ?? "")))
288
+ result += "&#95;";
289
+ // A { here has no }, so Quest shows it, and the rest of the text, as it is
290
+ else if (c == "{")
291
+ result += "&#123;";
292
+ else if (c == "}")
293
+ result += "&#125;";
294
+ else
295
+ result += c;
296
+ }
297
+ return result;
298
+ }
299
+ // Lines that Markdown would read as a heading, list or quote, which in Quest are just text
300
+ export function escapeLineStarts(text) {
301
+ return text.split("\n").map(line => line
302
+ .replace(/^(\s*)#/, "$1&#35;")
303
+ .replace(/^(\s*)([-+])(\s)/, (_, space, c, after) => `${space}${c == "-" ? "&#45;" : "&#43;"}${after}`)
304
+ .replace(/^(\s*\d+)\.(\s)/, "$1&#46;$2")).join("\n");
305
+ }
package/dist/setters.js CHANGED
@@ -373,6 +373,9 @@ export function findUnquotedText(file, isSet) {
373
373
  export const BUILT_IN_ATTRIBUTES = new Map([
374
374
  // #377: stories written before Squiffy counted turns often kept their own count called "turns"
375
375
  ["turns", "the number of links clicked in the story so far"],
376
+ // #56: and a story may have kept track of where the player had been
377
+ ["previous", "the section or passage the player saw just before this one"],
378
+ ["previous_section", "the section the player was in before this one"],
376
379
  ]);
377
380
  // Finds where a file sets one of the BUILT_IN_ATTRIBUTES: on the left of a setter, in @inc, @dec
378
381
  // and @unset, and as the quoted first argument of set, inc, dec or unset, which covers
@@ -1,5 +1,5 @@
1
1
  import type { Location } from "./language-service.js";
2
- import type { Diagnostic, EmbedNode, GotoNode, LinkNode, PassageNode, Position, SectionNode, SquiffyFile } from "./syntax.js";
2
+ import type { DeactivateNode, Diagnostic, EmbedNode, GotoNode, LinkNode, PassageNode, Position, SectionNode, SquiffyFile } from "./syntax.js";
3
3
  export interface StoryGraph {
4
4
  nodes: GraphNode[];
5
5
  edges: GraphEdge[];
@@ -40,6 +40,7 @@ export interface GraphUsage {
40
40
  link?: LinkNode;
41
41
  embed?: EmbedNode;
42
42
  goto?: GotoNode;
43
+ deactivate?: DeactivateNode;
43
44
  }
44
45
  export type GraphTarget = {
45
46
  kind: "section";
@@ -173,6 +173,8 @@ export function buildStoryGraph(source) {
173
173
  return ranges.some(r => comparePositions(r.start, position) <= 0 && comparePositions(position, r.end) <= 0);
174
174
  };
175
175
  for (const usage of source.usages) {
176
+ if (usage.deactivate)
177
+ continue;
176
178
  const from = containerIds.get(usage.container);
177
179
  // Not part of the story, or replaced by a later section or passage of the same name
178
180
  if (from === undefined)
package/dist/syntax.d.ts CHANGED
@@ -7,7 +7,7 @@ export interface Range {
7
7
  end: Position;
8
8
  }
9
9
  export type DiagnosticSeverity = "error" | "warning" | "hint";
10
- export type DiagnosticCode = "squiffy/passage-without-section" | "squiffy/text-in-ui-block" | "squiffy/content-before-section" | "squiffy/v5-syntax" | "squiffy/at-attribute" | "squiffy/unquoted-text" | "squiffy/built-in-attribute" | "squiffy/external-files-unavailable" | "squiffy/no-next-section" | "squiffy/unknown-embed" | "squiffy/unknown-goto" | "squiffy/unknown-section-link" | "squiffy/unknown-passage-link" | "squiffy/duplicate-section" | "squiffy/duplicate-passage" | "squiffy/not-in-main-file" | "squiffy/redundant-import" | "squiffy/project-file" | "squiffy/unreachable-section" | "squiffy/dead-end";
10
+ export type DiagnosticCode = "squiffy/passage-without-section" | "squiffy/text-in-ui-block" | "squiffy/content-before-section" | "squiffy/v5-syntax" | "squiffy/at-attribute" | "squiffy/unquoted-text" | "squiffy/built-in-attribute" | "squiffy/external-files-unavailable" | "squiffy/no-next-section" | "squiffy/unknown-embed" | "squiffy/unknown-goto" | "squiffy/unknown-deactivate" | "squiffy/unknown-section-link" | "squiffy/unknown-passage-link" | "squiffy/duplicate-section" | "squiffy/duplicate-passage" | "squiffy/not-in-main-file" | "squiffy/repeat-not-in-passage" | "squiffy/redundant-import" | "squiffy/project-file" | "squiffy/unreachable-section" | "squiffy/dead-end";
11
11
  export interface Diagnostic {
12
12
  file: string;
13
13
  range: Range;
@@ -35,6 +35,7 @@ export interface SectionNode {
35
35
  links: LinkNode[];
36
36
  embeds: EmbedNode[];
37
37
  gotos: GotoNode[];
38
+ deactivates: DeactivateNode[];
38
39
  }
39
40
  export interface PassageNode {
40
41
  type: "passage";
@@ -46,6 +47,7 @@ export interface PassageNode {
46
47
  links: LinkNode[];
47
48
  embeds: EmbedNode[];
48
49
  gotos: GotoNode[];
50
+ deactivates: DeactivateNode[];
49
51
  }
50
52
  export interface SnippetNode {
51
53
  type: "snippet";
@@ -111,6 +113,10 @@ export interface ClearNode {
111
113
  type: "clear";
112
114
  range: Range;
113
115
  }
116
+ export interface RepeatNode {
117
+ type: "repeat";
118
+ range: Range;
119
+ }
114
120
  export interface EndNode {
115
121
  type: "end";
116
122
  range: Range;
@@ -134,7 +140,7 @@ export interface TextNode {
134
140
  text: string;
135
141
  range: Range;
136
142
  }
137
- export type StatementNode = SeparatorNode | TitleNode | StartNode | ImportNode | UiBlockStartNode | UiFileNode | ClearNode | EndNode | AttributeNode | JsNode | TextNode;
143
+ export type StatementNode = SeparatorNode | TitleNode | StartNode | ImportNode | UiBlockStartNode | UiFileNode | ClearNode | RepeatNode | EndNode | AttributeNode | JsNode | TextNode;
138
144
  export interface LinkNode {
139
145
  type: "link";
140
146
  linkType: "section" | "passage";
@@ -150,6 +156,12 @@ export interface EmbedNode {
150
156
  range: Range;
151
157
  nameRange: Range;
152
158
  }
159
+ export interface DeactivateNode {
160
+ type: "deactivate";
161
+ name: string;
162
+ range: Range;
163
+ nameRange: Range;
164
+ }
153
165
  export interface GotoNode {
154
166
  type: "goto";
155
167
  name: string;
package/dist/text.d.ts CHANGED
@@ -16,6 +16,7 @@ export interface TextEmbed {
16
16
  nameEnd: number;
17
17
  }
18
18
  export type TextGoto = TextEmbed;
19
+ export type TextDeactivate = TextEmbed;
19
20
  export interface NoNextSection {
20
21
  display: string;
21
22
  start: number;
@@ -26,6 +27,7 @@ export interface TransformResult {
26
27
  links: TextLink[];
27
28
  embeds: TextEmbed[];
28
29
  gotos: TextGoto[];
30
+ deactivates: TextDeactivate[];
29
31
  noNextSection: NoNextSection[];
30
32
  }
31
33
  export declare const balancedTarget: string;
package/dist/text.js CHANGED
@@ -170,9 +170,10 @@ export function transformText(text, getNextSectionName, expressions = false) {
170
170
  };
171
171
  // Handlebars expressions can contain square brackets that aren't links, such as
172
172
  // {{someArray.[1]}} or {{someHelper "[x]"}}, so swap each one for a placeholder while
173
- // converting links. Text between block helpers like {{#if x}}...{{/if}} is still converted.
173
+ // converting links. Text between block helpers like {{#if x}}...{{/if}} is still converted. A
174
+ // comment ends at --}}, and can have }} and links in it before that.
174
175
  const mustaches = [];
175
- input.replace(/\{\{\{[\s\S]*?\}\}\}|\{\{[\s\S]*?\}\}/g, ([match]) => {
176
+ input.replace(/\{\{!--[\s\S]*?--\}\}|\{\{\{[\s\S]*?\}\}\}|\{\{[\s\S]*?\}\}/g, ([match]) => {
176
177
  mustaches.push(match);
177
178
  return `${mustaches.length - 1}`;
178
179
  });
@@ -181,8 +182,9 @@ export function transformText(text, getNextSectionName, expressions = false) {
181
182
  // [[Buy]](shop, gold -= (price - 1) * 2), so the target can contain balanced brackets, up to
182
183
  // three deep. Without, it ends at the first ")", as in Squiffy 6.
183
184
  const target = expressions ? balancedTarget : "(?:.*?)";
184
- // nextSectionLinkRegex matches [[text>]] - a link to the next section
185
- const nextSectionLinkRegex = /\[\[([^\]]*?)>\]\]/g;
185
+ // nextSectionLinkRegex matches [[text>]] - a link to the next section. Followed by a (target),
186
+ // it's a named link whose text ends with >, such as [[<i>Go in</i>]](cave).
187
+ const nextSectionLinkRegex = /\[\[([^\]]*?)>\]\](?!\()/g;
186
188
  input.replace(nextSectionLinkRegex, ([match, rawText], offset) => {
187
189
  const text = restore(rawText);
188
190
  const nextSectionName = getNextSectionName();
@@ -284,7 +286,7 @@ export function transformText(text, getNextSectionName, expressions = false) {
284
286
  return result;
285
287
  };
286
288
  embeds.push(...findNamed("embed"));
287
- return { output: input.value, links, embeds, gotos: findNamed("goto"), noNextSection };
289
+ return { output: input.value, links, embeds, gotos: findNamed("goto"), deactivates: findNamed("deactivate"), noNextSection };
288
290
  }
289
291
  // Returns a function that converts an offset into lines.join("\n") to a position in the source file.
290
292
  export function positionMapper(lines, lineLengths) {
@@ -34,6 +34,7 @@ export interface ConvertedPassage {
34
34
  directives: string[];
35
35
  body: string;
36
36
  }
37
+ export declare const reservedAttributes: Set<string>;
37
38
  export declare class StoryContext {
38
39
  readonly twine: TwineStory;
39
40
  readonly problems: TwineConversionProblem[];
@@ -58,6 +59,11 @@ export declare class StoryContext {
58
59
  sectionForUnknown(passageName: string): string;
59
60
  uniqueSectionName(hint: string): string;
60
61
  newLabel(hint: string): string;
62
+ private readonly loops;
63
+ get looping(): boolean;
64
+ inLoop<T>(vars: Map<string, "item" | "index">, array: string | undefined, convert: () => T): T;
65
+ private loopVariable;
66
+ variable(name: string, temporary: boolean): Expr;
61
67
  attribute(name: string, temporary: boolean): string;
62
68
  }
63
69
  export declare function sanitiseName(name: string): string;
@@ -72,4 +78,5 @@ export declare function comment(text: string): string;
72
78
  export declare function formatTwineProblems(result: TwineConversionResult, sourceName?: string): string;
73
79
  export declare function convertTwine(source: string, options?: TwineConversionOptions): TwineConversionResult;
74
80
  export declare function convertTwineStory(twine: TwineStory, options?: TwineConversionOptions): TwineConversionResult;
81
+ export declare function usesOuterLoop(text: string): boolean;
75
82
  export declare function finishText(text: string): string;