From d5eeb005a056470e3aeed9e60aba7986971d59e3 Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 3 Aug 2024 22:04:00 +0200 Subject: [PATCH 01/11] Add Latin1Supplement and Chinese character ranges --- src/compiler/Parser/InkParser.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compiler/Parser/InkParser.ts b/src/compiler/Parser/InkParser.ts index 95bb7b4e..5f8e55cc 100644 --- a/src/compiler/Parser/InkParser.ts +++ b/src/compiler/Parser/InkParser.ts @@ -349,6 +349,12 @@ export class InkParser extends StringParser { new CharacterSet() ); + public static readonly Latin1Supplement: CharacterRange = + CharacterRange.Define("\u0080", "\u00FF", new CharacterSet()); + + public static readonly Chinese: CharacterRange = + CharacterRange.Define("\u4E00", "\u9FFF", new CharacterSet()); + private readonly ExtendIdentifierCharacterRanges = ( identifierCharSet: CharacterSet ): void => { @@ -376,6 +382,8 @@ export class InkParser extends StringParser { InkParser.Greek, InkParser.Hebrew, InkParser.Korean, + InkParser.Latin1Supplement, + InkParser.Chinese, ]; /** From 644c0f319dc12260a83a9cce7b05beb9fc12047a Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 3 Aug 2024 22:14:38 +0200 Subject: [PATCH 02/11] Allow optional newline right after a choice name + test --- package.json | 2 +- src/compiler/Parser/InkParser.ts | 3 +++ src/tests/specs/ink/Choices.spec.ts | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 8eadde59..6ad49c24 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "inkjs", - "version": "2.2.5", + "version": "2.3.0", "description": "A javascript port of inkle's ink scripting language (http://www.inklestudios.com/ink/)", "type": "commonjs", "main": "dist/ink-full.js", diff --git a/src/compiler/Parser/InkParser.ts b/src/compiler/Parser/InkParser.ts index 5f8e55cc..0bd7d3cc 100644 --- a/src/compiler/Parser/InkParser.ts +++ b/src/compiler/Parser/InkParser.ts @@ -423,6 +423,9 @@ export class InkParser extends StringParser { this.Whitespace(); + // Allow optional newline right after a choice name + if (optionalName != null) this.Newline(); + // Optional condition for whether the choice should be shown to the player const conditionExpr: Expression = this.Parse( this.ChoiceCondition diff --git a/src/tests/specs/ink/Choices.spec.ts b/src/tests/specs/ink/Choices.spec.ts index 41c5fd0f..859b59e0 100644 --- a/src/tests/specs/ink/Choices.spec.ts +++ b/src/tests/specs/ink/Choices.spec.ts @@ -289,4 +289,14 @@ describe("Choices", () => { expect(context.story.currentChoices[0].text).toEqual("choice"); expect(context.story.currentChoices[0].tags).toEqual(["tag aaabbb"]); }); + + it("tests newline after choice name", () => { + compileStory("newline_after_choice", true); + context.story.Continue(); + + expect(context.story.currentChoices.length).toBe(1); + expect(context.story.currentChoices[0].text).toEqual( + "I did have one interesting fact about bricklaying, if you don't mind me spending taking a fair bit of time to lay the groundwork for it." + ); + }); }); From c2e7f61de650cb997856c99dc53057f310609569 Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 3 Aug 2024 22:18:58 +0200 Subject: [PATCH 03/11] Fix for errors when attempting to load a new version of story during development after major changes --- src/engine/CallStack.ts | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/engine/CallStack.ts b/src/engine/CallStack.ts index 818faf9d..bdeacee3 100644 --- a/src/engine/CallStack.ts +++ b/src/engine/CallStack.ts @@ -179,6 +179,7 @@ export class CallStack { name: string | null, contextIndex: number = -1 ) { + // contextIndex 0 means global, so index is actually 1-based if (contextIndex == -1) contextIndex = this.currentElementIndex + 1; let contextElement = this.callStack[contextIndex - 1]; @@ -359,16 +360,21 @@ export namespace CallStack { ". Has the story changed since this save data was created?" ); else if (threadPointerResult.approximate) { - if (pointer.container === null) { - return throwNullException("pointer.container"); + if (pointer.container !== null) { + storyContext.Warning( + "When loading state, exact internal story location couldn't be found: '" + + currentContainerPathStr + + "', so it was approximated to '" + + pointer.container.path.toString() + + "' to recover. Has the story changed since this save data was created?" + ); + } else { + storyContext.Warning( + "When loading state, exact internal story location couldn't be found: '" + + currentContainerPathStr + + "' and it may not be recoverable. Has the story changed since this save data was created?" + ); } - storyContext.Warning( - "When loading state, exact internal story location couldn't be found: '" + - currentContainerPathStr + - "', so it was approximated to '" + - pointer.container.path.toString() + - "' to recover. Has the story changed since this save data was created?" - ); } } From 69ce6808d9aa4a0d4c2b5f423c47e8a4b47f0631 Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 3 Aug 2024 22:32:41 +0200 Subject: [PATCH 04/11] Fix for choices that were storing thread references in a non-safe way, meaning that it could cause corruption during a background save. --- src/engine/Choice.ts | 14 ++++++++++++++ src/engine/Story.ts | 4 ++-- src/engine/StoryState.ts | 19 +++++++++++++++++-- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/engine/Choice.ts b/src/engine/Choice.ts index d29a9e96..662ae268 100644 --- a/src/engine/Choice.ts +++ b/src/engine/Choice.ts @@ -21,4 +21,18 @@ export class Choice extends InkObject { set pathStringOnChoice(value: string) { this.targetPath = new Path(value); } + + public Clone() { + let copy = new Choice(); + copy.text = this.text; + copy.sourcePath = this.sourcePath; + copy.index = this.index; + copy.targetPath = this.targetPath; + copy.originalThreadIndex = this.originalThreadIndex; + copy.isInvisibleDefault = this.isInvisibleDefault; + if (this.threadAtGeneration !== null) + copy.threadAtGeneration = this.threadAtGeneration.Copy(); + + return copy; + } } diff --git a/src/engine/Story.ts b/src/engine/Story.ts index ea74618d..a4ae5a6d 100644 --- a/src/engine/Story.ts +++ b/src/engine/Story.ts @@ -664,7 +664,7 @@ export class Story extends InkObject { public StateSnapshot() { this._stateSnapshotAtLastNewline = this._state; - this._state = this._state.CopyAndStartPatching(); + this._state = this._state.CopyAndStartPatching(false); } public RestoreStateSnapshot() { @@ -696,7 +696,7 @@ export class Story extends InkObject { ); let stateToSave = this._state; - this._state = this._state.CopyAndStartPatching(); + this._state = this._state.CopyAndStartPatching(true); this._asyncSaving = true; return stateToSave; } diff --git a/src/engine/StoryState.ts b/src/engine/StoryState.ts index 7ac8e01b..d70a2caf 100644 --- a/src/engine/StoryState.ts +++ b/src/engine/StoryState.ts @@ -491,17 +491,32 @@ export class StoryState { this._aliveFlowNamesDirty = true; } - public CopyAndStartPatching() { + public CopyAndStartPatching(forBackgroundSave: boolean) { let copy = new StoryState(this.story); copy._patch = new StatePatch(this._patch); copy._currentFlow.name = this._currentFlow.name; copy._currentFlow.callStack = new CallStack(this._currentFlow.callStack); - copy._currentFlow.currentChoices.push(...this._currentFlow.currentChoices); copy._currentFlow.outputStream.push(...this._currentFlow.outputStream); copy.OutputStreamDirty(); + // When background saving we need to make copies of choices since they each have + // a snapshot of the thread at the time of generation since the game could progress + // significantly and threads modified during the save process. + // However, when doing internal saving and restoring of snapshots this isn't an issue, + // and we can simply ref-copy the choices with their existing threads. + + if (forBackgroundSave) { + for (let choice of this._currentFlow.currentChoices) { + copy._currentFlow.currentChoices.push(choice.Clone()); + } + } else { + copy._currentFlow.currentChoices.push( + ...this._currentFlow.currentChoices + ); + } + if (this._namedFlows !== null) { copy._namedFlows = new Map(); for (let [namedFlowKey, namedFlowValue] of this._namedFlows) { From bc15c805924d417e078bd25b98f135157a3c61ae Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 3 Aug 2024 22:39:24 +0200 Subject: [PATCH 05/11] Fix for errors when attempting to load a new version of story during development after major changes --- src/engine/Container.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/engine/Container.ts b/src/engine/Container.ts index 25b36c21..80672e8d 100644 --- a/src/engine/Container.ts +++ b/src/engine/Container.ts @@ -168,13 +168,24 @@ export class Container extends InkObject implements INamedContent { let foundObj: InkObject | null = currentContainer.ContentWithPathComponent(comp); + // Couldn't resolve entire path? if (foundObj == null) { result.approximate = true; break; } + // Are we about to loop into another container? + // Is the object a container as expected? It might + // no longer be if the content has shuffled around, so what + // was originally a container no longer is. + const nextContainer: Container | null = asOrNull(foundObj, Container); + if (i < partialPathLength - 1 && nextContainer == null) { + result.approximate = true; + break; + } + currentObj = foundObj; - currentContainer = asOrNull(foundObj, Container); + currentContainer = nextContainer; } result.obj = currentObj; From 90d7a41a2900537f21e105ff830fdaaf97c28f1d Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 3 Aug 2024 23:06:56 +0200 Subject: [PATCH 06/11] Slight API improvements to Ink Lists --- src/engine/InkList.ts | 46 +++++++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/src/engine/InkList.ts b/src/engine/InkList.ts index abaa2d1e..1a34cb46 100644 --- a/src/engine/InkList.ts +++ b/src/engine/InkList.ts @@ -170,6 +170,7 @@ export class InkList extends Map { } public static FromString(myListItem: string, originStory: Story) { + if (myListItem == null || myListItem == "") return new InkList(); let listValue = originStory.listDefinitions?.FindSingleItemListWithName(myListItem); if (listValue) { @@ -186,7 +187,10 @@ export class InkList extends Map { } } - public AddItem(itemOrItemName: InkListItem | string | null) { + public AddItem( + itemOrItemName: InkListItem | string | null, + storyObject: Story | null = null + ) { if (itemOrItemName instanceof InkListItem) { let item = itemOrItemName; @@ -216,8 +220,9 @@ export class InkList extends Map { throw new Error( "Failed to add item to list because the item was from a new list definition that wasn't previously known to this list. Only items from previously known lists can be used, so that the int value can be found." ); - } else { - let itemName = itemOrItemName as string | null; + } else if (itemOrItemName !== null) { + //itemOrItemName is a string + let itemName = itemOrItemName as string; let foundListDef: ListDefinition | null = null; @@ -242,16 +247,23 @@ export class InkList extends Map { } } - if (foundListDef == null) - throw new Error( - "Could not add the item " + - itemName + - " to this list because it isn't known to any list definitions previously associated with this list." - ); - - let item = new InkListItem(foundListDef.name, itemName); - let itemVal = foundListDef.ValueForItem(item); - this.Add(item, itemVal); + if (foundListDef == null) { + if (storyObject == null) { + throw new Error( + "Could not add the item " + + itemName + + " to this list because it isn't known to any list definitions previously associated with this list." + ); + } else { + let newItem = InkList.FromString(itemName, storyObject) + .orderedItems[0]; + this.Add(newItem.Key, newItem.Value); + } + } else { + let item = new InkListItem(foundListDef.name, itemName); + let itemVal = foundListDef.ValueForItem(item); + this.Add(item, itemVal); + } } } public ContainsItemNamed(itemName: string | null) { @@ -519,6 +531,14 @@ export class InkList extends Map { return ordered; } + + get singleItem(): InkListItem | null { + for (let item of this.orderedItems) { + return item.Key; + } + return null; + } + public toString() { let ordered = this.orderedItems; From caa804e05a8a40deb4e85cb00f3e12e2516b5e94 Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sat, 3 Aug 2024 23:22:59 +0200 Subject: [PATCH 07/11] Fix for choice tags not being serialised --- src/engine/JsonSerialisation.ts | 34 ++++++++++++++++++++------------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/src/engine/JsonSerialisation.ts b/src/engine/JsonSerialisation.ts index 97356b95..d6a8aa3b 100644 --- a/src/engine/JsonSerialisation.ts +++ b/src/engine/JsonSerialisation.ts @@ -580,10 +580,16 @@ export class JsonSerialisation { choice.sourcePath = jObj["originalChoicePath"].toString(); choice.originalThreadIndex = parseInt(jObj["originalThreadIndex"]); choice.pathStringOnChoice = jObj["targetPath"].toString(); + choice.tags = this.JArrayToTags(jObj); + return choice; + } + + public static JArrayToTags(jObj: Record) { if (jObj["tags"]) { - choice.tags = jObj["tags"]; + return jObj["tags"]; + } else { + return null; } - return choice; } public static WriteChoice(writer: SimpleJson.Writer, choice: Choice) { @@ -593,20 +599,22 @@ export class JsonSerialisation { writer.WriteProperty("originalChoicePath", choice.sourcePath); writer.WriteIntProperty("originalThreadIndex", choice.originalThreadIndex); writer.WriteProperty("targetPath", choice.pathStringOnChoice); - if (choice.tags) { - writer.WriteProperty("tags", (w) => { - w.WriteArrayStart(); - for (const tag of choice.tags!) { - w.WriteStringStart(); - w.WriteStringInner(tag); - w.WriteStringEnd(); - } - w.WriteArrayEnd(); - }); - } + this.WriteChoiceTags(writer, choice); writer.WriteObjectEnd(); } + public static WriteChoiceTags(writer: SimpleJson.Writer, choice: Choice) { + if (choice.tags && choice.tags.length > 0) { + writer.WritePropertyStart("tags"); + writer.WriteArrayStart(); + for (const tag of choice.tags!) { + writer.Write(tag); + } + writer.WriteArrayEnd(); + writer.WritePropertyEnd(); + } + } + public static WriteInkList(writer: SimpleJson.Writer, listVal: ListValue) { let rawList = listVal.value; if (rawList === null) { From 8e8301dd75dd6f25d9fd9775c85d6ab3317a0cc9 Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sun, 4 Aug 2024 00:02:21 +0200 Subject: [PATCH 08/11] Fix to allow variable observers to run new ink more robustly by having the callback fire later --- src/engine/NativeFunctionCall.ts | 4 +- src/engine/Story.ts | 28 ++++++++++- src/engine/StoryState.ts | 12 +++++ src/engine/VariablesState.ts | 48 +++++++++++-------- .../inkfiles/original/lists/list_range.ink | 1 + src/tests/specs/ink/Lists.spec.ts | 1 + 6 files changed, 71 insertions(+), 23 deletions(-) diff --git a/src/engine/NativeFunctionCall.ts b/src/engine/NativeFunctionCall.ts index 5eed05a3..92bea48b 100644 --- a/src/engine/NativeFunctionCall.ts +++ b/src/engine/NativeFunctionCall.ts @@ -94,7 +94,9 @@ export class NativeFunctionCall extends InkObject { for (let p of parameters) { if (p instanceof Void) throw new StoryException( - 'Attempting to perform operation on a void value. Did you forget to "return" a value from a function you called here?' + "Attempting to perform " + + this.name + + ' on a void value. Did you forget to "return" a value from a function you called here?' ); if (p instanceof ListValue) hasList = true; } diff --git a/src/engine/Story.ts b/src/engine/Story.ts index a4ae5a6d..882909fe 100644 --- a/src/engine/Story.ts +++ b/src/engine/Story.ts @@ -370,7 +370,9 @@ export class Story extends InkObject { this._state.ResetOutput(); if (this._recursiveContinueCount == 1) - this._state.variablesState.batchObservingVariableChanges = true; + this._state.variablesState.StartVariableObservation(); + } else if (this._asyncContinueActive && !isAsyncTimeLimited) { + this._asyncContinueActive = false; } let durationStopwatch = new Stopwatch(); @@ -400,6 +402,8 @@ export class Story extends InkObject { durationStopwatch.Stop(); + let changedVariablesToObserve: Map | null = null; + if (outputStreamEndsInNewline || !this.canContinue) { if (this._stateSnapshotAtLastNewline !== null) { this.RestoreStateSnapshot(); @@ -439,7 +443,7 @@ export class Story extends InkObject { this._sawLookaheadUnsafeFunctionAfterNewline = false; if (this._recursiveContinueCount == 1) - this._state.variablesState.batchObservingVariableChanges = false; + changedVariablesToObserve = this._state.variablesState.CompleteVariableObservation(); this._asyncContinueActive = false; if (this.onDidContinue !== null) this.onDidContinue(); @@ -494,6 +498,12 @@ export class Story extends InkObject { throw new StoryException(sb.toString()); } } + if ( + changedVariablesToObserve != null && + Object.keys(changedVariablesToObserve).length > 0 + ) { + this._state.variablesState.NotifyObservers(changedVariablesToObserve); + } } public ContinueSingleStep() { @@ -1836,6 +1846,20 @@ export class Story extends InkObject { let foundExternal = typeof funcDef !== "undefined"; + if ( + foundExternal && + !funcDef!.lookAheadSafe && + this._state.inStringEvaluation + ) { + this.Error( + "External function " + + funcName + + ' could not be called because 1) it wasn\'t marked as lookaheadSafe when BindExternalFunction was called and 2) the story is in the middle of string generation, either because choice text is being generated, or because you have ink like "hello {func()}". You can work around this by generating the result of your function into a temporary variable before the string or choice gets generated: ~ temp x = ' + + funcName + + "()" + ); + } + if ( foundExternal && !funcDef!.lookAheadSafe && diff --git a/src/engine/StoryState.ts b/src/engine/StoryState.ts index d70a2caf..c71e612f 100644 --- a/src/engine/StoryState.ts +++ b/src/engine/StoryState.ts @@ -227,6 +227,18 @@ export class StoryState { } } + get previousPathString() { + let pointer = this.previousPointer; + if (pointer.isNull) { + return null; + } else { + if (pointer.path === null) { + return throwNullException("previousPointer.path"); + } + return pointer.path.toString(); + } + } + get currentPointer() { return this.callStack.currentElement.currentPointer.copy(); } diff --git a/src/engine/VariablesState.ts b/src/engine/VariablesState.ts index 871a9580..39f0f606 100644 --- a/src/engine/VariablesState.ts +++ b/src/engine/VariablesState.ts @@ -47,27 +47,35 @@ export class VariablesState extends VariablesStateAccessor< public patch: StatePatch | null = null; - get batchObservingVariableChanges() { - return this._batchObservingVariableChanges; + public StartVariableObservation() { + this._batchObservingVariableChanges = true; + this._changedVariablesForBatchObs = new Set(); } - set batchObservingVariableChanges(value: boolean) { - this._batchObservingVariableChanges = value; - if (value) { - this._changedVariablesForBatchObs = new Set(); - } else { - if (this._changedVariablesForBatchObs != null) { - for (let variableName of this._changedVariablesForBatchObs) { - let currentValue = this._globalVariables.get(variableName); - if (!currentValue) { - throwNullException("currentValue"); - } else { - this.variableChangedEvent(variableName, currentValue); - } - } - this._changedVariablesForBatchObs = null; + public CompleteVariableObservation(): Map { + this._batchObservingVariableChanges = false; + let changedVars = new Map(); + if (this._changedVariablesForBatchObs != null) { + for (let variableName of this._changedVariablesForBatchObs) { + let currentValue = this._globalVariables.get(variableName) as InkObject; + this.variableChangedEvent(variableName, currentValue); + } + } + // Patch may still be active - e.g. if we were in the middle of a background save + if (this.patch != null) { + for (let variableName of this.patch.changedVariables) { + let patchedVal = this.patch.TryGetGlobal(variableName, null); + if (patchedVal.exists) changedVars.set(variableName, patchedVal); } } + this._changedVariablesForBatchObs = null; + return changedVars; + } + + public NotifyObservers(changedVars: Map){ + for (const [key, value] of changedVars) { + this.variableChangedEvent(key, value); + } } get callStack() { @@ -77,8 +85,6 @@ export class VariablesState extends VariablesStateAccessor< this._callStack = callStack; } - private _batchObservingVariableChanges: boolean = false; - // the original code uses a magic getter and setter for global variables, // allowing things like variableState['varname]. This is not quite possible // in js without a Proxy, so it is replaced with this $ function. @@ -429,7 +435,7 @@ export class VariablesState extends VariablesStateAccessor< oldValue !== null && value !== oldValue.result ) { - if (this.batchObservingVariableChanges) { + if (this._batchObservingVariableChanges) { if (this._changedVariablesForBatchObs === null) { return throwNullException("this._changedVariablesForBatchObs"); } @@ -495,4 +501,6 @@ export class VariablesState extends VariablesStateAccessor< private _callStack: CallStack; private _changedVariablesForBatchObs: Set | null = new Set(); private _listDefsOrigin: ListDefinitionsOrigin | null; + + private _batchObservingVariableChanges: boolean = false; } diff --git a/src/tests/inkfiles/original/lists/list_range.ink b/src/tests/inkfiles/original/lists/list_range.ink index 124bfed0..218c08bc 100644 --- a/src/tests/inkfiles/original/lists/list_range.ink +++ b/src/tests/inkfiles/original/lists/list_range.ink @@ -6,6 +6,7 @@ VAR all = () {all} {LIST_RANGE(all, 2, 3)} {LIST_RANGE(LIST_ALL(Numbers), Two, Six)} +{LIST_RANGE(LIST_ALL(Numbers), Currency, Three)} {LIST_RANGE(LIST_ALL(Numbers), 2, Four)} // mix int and list {LIST_RANGE(LIST_ALL(Numbers), Two, 5)} // mix list and int {LIST_RANGE((Pizza, Pasta), -1, 100)} // allow out of range diff --git a/src/tests/specs/ink/Lists.spec.ts b/src/tests/specs/ink/Lists.spec.ts index 7d4ca56f..b18b2f70 100644 --- a/src/tests/specs/ink/Lists.spec.ts +++ b/src/tests/specs/ink/Lists.spec.ts @@ -68,6 +68,7 @@ describe("Lists", () => { `Pound, Pizza, Euro, Pasta, Dollar, Curry, Paella Euro, Pasta, Dollar, Curry Two, Three, Four, Five, Six +One, Two, Three Two, Three, Four Two, Three, Four, Five Pizza, Pasta From c4ad34f90009badb85241e86015a61a5accf3ae0 Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sun, 4 Aug 2024 00:07:12 +0200 Subject: [PATCH 09/11] test file for newline_after_choice --- src/tests/inkfiles/original/choices/newline_after_choice.ink | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/tests/inkfiles/original/choices/newline_after_choice.ink diff --git a/src/tests/inkfiles/original/choices/newline_after_choice.ink b/src/tests/inkfiles/original/choices/newline_after_choice.ink new file mode 100644 index 00000000..a87b3dc4 --- /dev/null +++ b/src/tests/inkfiles/original/choices/newline_after_choice.ink @@ -0,0 +1,2 @@ +* (say_something_interesting_about_bricklaying) + I did have one interesting fact about bricklaying, if you don't mind me spending taking a fair bit of time to lay the groundwork for it. \ No newline at end of file From e34b5dd0469b3095f1c0d5d418b15d3bf77c3899 Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sun, 4 Aug 2024 00:12:47 +0200 Subject: [PATCH 10/11] lint:fix --- src/compiler/Parser/InkParser.ts | 7 +++++-- src/engine/Story.ts | 3 ++- src/engine/VariablesState.ts | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/compiler/Parser/InkParser.ts b/src/compiler/Parser/InkParser.ts index 0bd7d3cc..5a8e8bc7 100644 --- a/src/compiler/Parser/InkParser.ts +++ b/src/compiler/Parser/InkParser.ts @@ -352,8 +352,11 @@ export class InkParser extends StringParser { public static readonly Latin1Supplement: CharacterRange = CharacterRange.Define("\u0080", "\u00FF", new CharacterSet()); - public static readonly Chinese: CharacterRange = - CharacterRange.Define("\u4E00", "\u9FFF", new CharacterSet()); + public static readonly Chinese: CharacterRange = CharacterRange.Define( + "\u4E00", + "\u9FFF", + new CharacterSet() + ); private readonly ExtendIdentifierCharacterRanges = ( identifierCharSet: CharacterSet diff --git a/src/engine/Story.ts b/src/engine/Story.ts index 882909fe..19a83cf4 100644 --- a/src/engine/Story.ts +++ b/src/engine/Story.ts @@ -443,7 +443,8 @@ export class Story extends InkObject { this._sawLookaheadUnsafeFunctionAfterNewline = false; if (this._recursiveContinueCount == 1) - changedVariablesToObserve = this._state.variablesState.CompleteVariableObservation(); + changedVariablesToObserve = + this._state.variablesState.CompleteVariableObservation(); this._asyncContinueActive = false; if (this.onDidContinue !== null) this.onDidContinue(); diff --git a/src/engine/VariablesState.ts b/src/engine/VariablesState.ts index 39f0f606..d75e5caa 100644 --- a/src/engine/VariablesState.ts +++ b/src/engine/VariablesState.ts @@ -72,7 +72,7 @@ export class VariablesState extends VariablesStateAccessor< return changedVars; } - public NotifyObservers(changedVars: Map){ + public NotifyObservers(changedVars: Map) { for (const [key, value] of changedVars) { this.variableChangedEvent(key, value); } From 755d48ccd812b0a03c1903a00e3d5fbcd74a517b Mon Sep 17 00:00:00 2001 From: Ju / smwhr Date: Sun, 4 Aug 2024 00:15:30 +0200 Subject: [PATCH 11/11] update compat table --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9be1d448..b8c8f4e7 100644 --- a/README.md +++ b/README.md @@ -224,3 +224,4 @@ import { Identifier } from 'inkjs/compiler/Parser/ParsedHierarchy/Identifier'; | 0.9.0 | 1.11.0 | 19 | | 1.0.0 | 2.0.0 - 2.1.0 | 20 | | 1.1.1 | 2.2.* | 21 | +| 1.2.0 | 2.3.0 | |