Commit 9c5d1cc5 authored by Leon Arnott's avatar Leon Arnott
Browse files

Fixed a bug where error messages would incorrectly call custom macros'...

Fixed a bug where error messages would incorrectly call custom macros' parameters "a number" even if that parameter was restricted to something else.

Also updated the version numbers to 3.2.2, the next version.
parent a92b343e541b
......@@ -2,6 +2,13 @@
Documentation is at http://twine2.neocities.org/. See below for compilation instructions.
### 3.2.2 changes (unreleased):
#### Bugfixes
* Fixed a bug where error messages would incorrectly call custom macros' parameters "a number" even if that parameter was restricted to something else.
* Fixed a code generation bug in the "The passage ___ was visited" option of the "If" pane of the editor toolbar.
### 3.2.1 changes (Jan 18, 2021):
#### Bugfixes
......
window.storyFormat({"name":"Harlowe","version":"3.2.1","author":"Leon Arnott","description":"The default story format for Twine 2. Now with an editor toolbar! Consult its <a href='https://twine2.neocities.org/' target='_blank' rel='noopener noreferrer'>documentation</a>.","image":"icon.svg","url":"http://twinery.org/","license":"Zlib","proofing":false,"source":"","setup":""});
\ No newline at end of file
window.storyFormat({"name":"Harlowe","version":"3.2.2","author":"Leon Arnott","description":"The default story format for Twine 2. Now with an editor toolbar! Consult its <a href='https://twine2.neocities.org/' target='_blank' rel='noopener noreferrer'>documentation</a>.","image":"icon.svg","url":"http://twinery.org/","license":"Zlib","proofing":false,"source":"","setup":""});
\ No newline at end of file
"use strict";
define(['jquery','utils/operationutils','internaltypes/changedescriptor', 'internaltypes/varref', 'internaltypes/varscope', 'internaltypes/twineerror', 'internaltypes/twinenotifier'], ($, {objectName, matches}, ChangeDescriptor, VarRef, VarScope, TwineError, TwineNotifier) => {
define(['jquery','utils/operationutils','internaltypes/changedescriptor', 'internaltypes/varref', 'internaltypes/varscope', 'internaltypes/twineerror', 'internaltypes/twinenotifier'], ($, {objectName, typeName, matches}, ChangeDescriptor, VarRef, VarScope, TwineError, TwineNotifier) => {
const {assign,create} = Object;
/*d:
CustomMacro data
......@@ -251,7 +251,7 @@ define(['jquery','utils/operationutils','internaltypes/changedescriptor', 'inter
if (p.datatype.toTypeSignatureObject) {
type = p.datatype.toTypeSignatureObject({rest:p.rest});
} else {
type = {pattern: "range", range: e => matches(p.datatype, e)};
type = {pattern: "range", range: e => matches(p.datatype, e), name: typeName(p.datatype)};
}
/*
TypedVars, when "spread", become rest parameters. These should be translated
......
......@@ -151,7 +151,27 @@ define([
converted to that format when they're used for custom macros.
*/
toTypeSignatureObject() {
const innerPattern = { pattern: "range", range: typeIndex[this.name] };
const {name} = this;
const innerPattern = { pattern: "range", range: typeIndex[name],
/*
The name is used for type errors when these are used as custom macro parameter types.
A proper description of the typenames, lining up with Harlowe's built-in macro error messages, needs to be constructed.
*/
name: "a " + (
name === "dm" ? "datamap" :
name === "ds" ? "dataset" :
name === "num" ? name + "ber" :
name === "str" ? name + "ing" :
name === "color" ? "colour" :
name === "bool" ? name + "ean" :
name === "alnum" ? "alphanumeric character" :
name === "int" ? name + "eger" :
name === "even" || name === "odd" ? name + " number" :
name.endsWith("case") || name === "whitespace" ? name + " character" :
name === "empty" ? name + " value" :
name
)
};
/*
Rest datatypes' semantics are "zero or more" rather than the 1-or-more semantics used for pattern:"rest" internally.
*/
......
......@@ -8,7 +8,7 @@ But at the end, Harlowe finally became, for the first time, a hypertext fiction
And now you get to enjoy all of this, and more.
* A means of creating custom macros, using (macro:), (output:) and (output-hook:).
* A means of creating custom macros, using (macro:), (output:) and (output-data:).
* String patterns, an advanced means of matching strings comprehensively, that can be used with `matches` and the new (split:) and (trimmed:) macros.
* Changers for creating block elements, (box:) and (float-box:), with the latter allowing you to overlay a box of text anywhere in the browser window.
* Support for storylets as an alternative to hard-coded links between sections of a game, provided by (storylet:), (open-storylets:), and their related macros.
......
{
"name": "twine-harlowe",
"version": "3.2.1",
"version": "3.2.2",
"author": "Leon Arnott",
"description": "The default runtime for Twine 2 stories",
"license": "Zlib",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment