squiffy-compiler 7.0.0-beta.3 → 7.0.0-beta.5
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.
- package/dist/analyse.d.ts +2 -0
- package/dist/analyse.js +43 -1
- package/dist/compiler.d.ts +7 -0
- package/dist/compiler.js +3 -0
- package/dist/emit.d.ts +1 -0
- package/dist/emit.js +6 -0
- package/dist/language-service.js +39 -3
- package/dist/node.d.ts +2 -0
- package/dist/node.js +6 -2
- package/dist/parse.js +13 -4
- package/dist/project.d.ts +2 -0
- package/dist/project.js +14 -2
- package/dist/setters.d.ts +40 -0
- package/dist/setters.js +411 -0
- package/dist/story-graph.d.ts +2 -1
- package/dist/story-graph.js +10 -3
- package/dist/syntax.d.ts +9 -1
- package/dist/text.d.ts +4 -1
- package/dist/text.js +56 -32
- package/dist/twine/convert.d.ts +75 -0
- package/dist/twine/convert.js +626 -0
- package/dist/twine/expression.d.ts +62 -0
- package/dist/twine/expression.js +201 -0
- package/dist/twine/harlowe.d.ts +17 -0
- package/dist/twine/harlowe.js +1856 -0
- package/dist/twine/story.d.ts +24 -0
- package/dist/twine/story.js +231 -0
- package/dist/twine/sugarcube.d.ts +33 -0
- package/dist/twine/sugarcube.js +1584 -0
- package/package.json +2 -2
- package/syntaxes/squiffy.tmLanguage.json +33 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "squiffy-compiler",
|
|
3
|
-
"version": "7.0.0-beta.
|
|
3
|
+
"version": "7.0.0-beta.5",
|
|
4
4
|
"description": "A tool for creating multiple-choice interactive stories",
|
|
5
5
|
"author": "Alex Warren",
|
|
6
6
|
"contributors": [
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"syntaxes/squiffy.tmLanguage.json"
|
|
51
51
|
],
|
|
52
52
|
"type": "module",
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "9495ea44822999ad3e5c8fa305a88c5f5e43f1d8"
|
|
54
54
|
}
|
|
@@ -377,7 +377,7 @@
|
|
|
377
377
|
},
|
|
378
378
|
{
|
|
379
379
|
"name": "meta.link.section.squiffy",
|
|
380
|
-
"match": "(\\[\\[)([^\\]]*?)(\\]\\])(\\()(
|
|
380
|
+
"match": "(\\[\\[)([^\\]]*?)(\\]\\])(\\()((?:[^()]|\\((?:[^()]|\\((?:[^()]|\\([^()]*\\))*\\))*\\))*?)(\\))",
|
|
381
381
|
"captures": {
|
|
382
382
|
"1": {
|
|
383
383
|
"name": "punctuation.definition.link.begin.squiffy"
|
|
@@ -461,7 +461,7 @@
|
|
|
461
461
|
},
|
|
462
462
|
{
|
|
463
463
|
"name": "meta.link.passage.squiffy",
|
|
464
|
-
"match": "(\\[)([^\\]]*?)(\\])(\\()(
|
|
464
|
+
"match": "(\\[)([^\\]]*?)(\\])(\\()((?:[^()]|\\((?:[^()]|\\((?:[^()]|\\([^()]*\\))*\\))*\\))*?)(\\))",
|
|
465
465
|
"captures": {
|
|
466
466
|
"1": {
|
|
467
467
|
"name": "punctuation.definition.link.begin.squiffy"
|
|
@@ -560,10 +560,10 @@
|
|
|
560
560
|
}
|
|
561
561
|
},
|
|
562
562
|
"assignments": {
|
|
563
|
-
"comment": "Comma-separated setters after a link's target: [[text]](section, score+=1, not visited)",
|
|
563
|
+
"comment": "Comma-separated setters after a link's target: [[text]](section, score+=1, not visited, msg = \"Hi, there\"). A comma inside quotes or brackets doesn't separate them.",
|
|
564
564
|
"patterns": [
|
|
565
565
|
{
|
|
566
|
-
"match": "([
|
|
566
|
+
"match": "((?:\"[^\"]*\"?|'[^']*'?|\\([^)]*\\)?|[^,\"'(])+)|(,)",
|
|
567
567
|
"captures": {
|
|
568
568
|
"1": {
|
|
569
569
|
"patterns": [
|
|
@@ -580,7 +580,7 @@
|
|
|
580
580
|
]
|
|
581
581
|
},
|
|
582
582
|
"assignment": {
|
|
583
|
-
"comment": "One setter
|
|
583
|
+
"comment": "One setter (setAttribute in runtime/src/squiffy.runtime.ts): a = 1, a += 1 (or -=, *=, /=), a := text with {{...}}, not a, a. In a story with a squiffy.json the value is an expression, as in {{#if}}: a = \"text\", a = b + 1; without one, a = text and a = @b. Patterns inside a capture can't anchor to its start (^ and \\G never match there), but $ is its end, and the earliest match wins.",
|
|
584
584
|
"patterns": [
|
|
585
585
|
{
|
|
586
586
|
"match": "\\s*(\\w*)\\s*(:=)(.*)$",
|
|
@@ -633,7 +633,21 @@
|
|
|
633
633
|
]
|
|
634
634
|
},
|
|
635
635
|
"value": {
|
|
636
|
+
"comment": "A setter's value. One with quotes, brackets, operators or and/or/not is an expression, as in {{#if}}. A single word is an attribute in a story with a squiffy.json, and anything else unquoted is text, as in a story without one. Of two matches at the start, the first listed wins.",
|
|
636
637
|
"patterns": [
|
|
638
|
+
{
|
|
639
|
+
"match": "(?=.*(?:[\"'()+*%<>!]|\\s[-/]|\\b(?:and|or|not)\\b)).+$",
|
|
640
|
+
"name": "meta.expression.squiffy",
|
|
641
|
+
"captures": {
|
|
642
|
+
"0": {
|
|
643
|
+
"patterns": [
|
|
644
|
+
{
|
|
645
|
+
"include": "#handlebars-expression"
|
|
646
|
+
}
|
|
647
|
+
]
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
},
|
|
637
651
|
{
|
|
638
652
|
"match": "-?\\d+(?:\\.\\d+)?$",
|
|
639
653
|
"name": "constant.numeric.squiffy"
|
|
@@ -646,6 +660,10 @@
|
|
|
646
660
|
"match": "@\\w+$",
|
|
647
661
|
"name": "variable.parameter.attribute.squiffy"
|
|
648
662
|
},
|
|
663
|
+
{
|
|
664
|
+
"match": "(?:[\\w-]+|\\[[^\\]]*\\])$",
|
|
665
|
+
"name": "variable.parameter.attribute.squiffy"
|
|
666
|
+
},
|
|
649
667
|
{
|
|
650
668
|
"match": ".+$",
|
|
651
669
|
"name": "string.unquoted.squiffy"
|
|
@@ -720,8 +738,8 @@
|
|
|
720
738
|
]
|
|
721
739
|
},
|
|
722
740
|
{
|
|
723
|
-
"comment": "{{helper args}},
|
|
724
|
-
"begin": "(\\{\\{\\{?~?)\\s*(?:([\\w.-]+)(?=\\s)|([\\w.-]+)(?=\\s*~?\\}))?",
|
|
741
|
+
"comment": "{{helper args}}, {{attribute}} on its own, or {{= expression}}",
|
|
742
|
+
"begin": "(\\{\\{\\{?~?)\\s*(?:([\\w.-]+)(?=\\s)|([\\w.-]+)(?=\\s*~?\\})|(=))?",
|
|
725
743
|
"beginCaptures": {
|
|
726
744
|
"1": {
|
|
727
745
|
"name": "support.constant.handlebars.squiffy punctuation.section.embedded.begin.handlebars.squiffy"
|
|
@@ -731,6 +749,9 @@
|
|
|
731
749
|
},
|
|
732
750
|
"3": {
|
|
733
751
|
"name": "variable.parameter.attribute.handlebars.squiffy"
|
|
752
|
+
},
|
|
753
|
+
"4": {
|
|
754
|
+
"name": "keyword.operator.display.handlebars.squiffy"
|
|
734
755
|
}
|
|
735
756
|
},
|
|
736
757
|
"end": "~?\\}\\}\\}?",
|
|
@@ -798,6 +819,11 @@
|
|
|
798
819
|
"match": "!=|>=|<=|=(?!=)|>|<",
|
|
799
820
|
"name": "keyword.operator.comparison.handlebars.squiffy"
|
|
800
821
|
},
|
|
822
|
+
{
|
|
823
|
+
"comment": "- and / are operators only at the start of a word: a-b is an attribute name and a/b a path",
|
|
824
|
+
"match": "[+*%]|(?<![\\w.\\]-])[-/]",
|
|
825
|
+
"name": "keyword.operator.arithmetic.handlebars.squiffy"
|
|
826
|
+
},
|
|
801
827
|
{
|
|
802
828
|
"match": "([\\w-]+)(=)",
|
|
803
829
|
"captures": {
|