@hyperfixi/core 2.10.0 → 2.11.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.
- package/dist/ast-utils/index.js +109 -8
- package/dist/ast-utils/index.mjs +109 -8
- package/dist/behaviors/index.js +2 -1
- package/dist/behaviors/index.mjs +2 -1
- package/dist/chunks/{bridge-CPNAPYAo.js → bridge-De7lnU_9.js} +2 -2
- package/dist/chunks/browser-modular-DpHHlmJ0.js +2 -0
- package/dist/chunks/{index-BQkkNlzO.js → index-D6-8bcsy.js} +2 -2
- package/dist/commands/helpers/dom-mutation.d.ts +3 -2
- package/dist/commands/helpers/index.d.ts +1 -1
- package/dist/commands/index.js +74 -8
- package/dist/commands/index.mjs +74 -8
- package/dist/hyperfixi-browser-classic-i18n.js +1 -1
- package/dist/hyperfixi-browser-minimal.js +1 -1
- package/dist/hyperfixi-browser-standard.js +1 -1
- package/dist/hyperfixi-browser.js +1 -1
- package/dist/hyperfixi-classic-i18n.js +1 -1
- package/dist/hyperfixi-hx-v4.js +1 -1
- package/dist/hyperfixi-minimal.js +1 -1
- package/dist/hyperfixi-multilingual.js +1 -1
- package/dist/hyperfixi-standard.js +1 -1
- package/dist/hyperfixi.js +1 -1
- package/dist/hyperfixi.mjs +1 -1
- package/dist/index.js +224 -33
- package/dist/index.min.js +1 -1
- package/dist/index.mjs +224 -33
- package/dist/lokascript-browser-classic-i18n.js +1 -1
- package/dist/lokascript-browser-minimal.js +1 -1
- package/dist/lokascript-browser-standard.js +1 -1
- package/dist/lokascript-browser.js +1 -1
- package/dist/lokascript-multilingual.js +1 -1
- package/dist/lsp-metadata.js +2 -2
- package/dist/lsp-metadata.mjs +2 -2
- package/dist/metadata.d.ts +1 -1
- package/dist/metadata.js +13 -11
- package/dist/metadata.mjs +13 -11
- package/dist/reference/index.js +7 -2
- package/dist/reference/index.mjs +7 -2
- package/dist/registry/index.js +6 -4
- package/dist/registry/index.mjs +6 -4
- package/dist/utils/element-check.d.ts +1 -0
- package/dist/version.d.ts +2 -0
- package/package.json +5 -5
- package/dist/chunks/browser-modular-B0lGdcoP.js +0 -2
package/dist/index.mjs
CHANGED
|
@@ -8783,6 +8783,12 @@ function isHTMLElement$2(value) {
|
|
|
8783
8783
|
typeof value.tagName === 'string' &&
|
|
8784
8784
|
'classList' in value);
|
|
8785
8785
|
}
|
|
8786
|
+
function isInsertableNode(value) {
|
|
8787
|
+
if (value === null || typeof value !== 'object')
|
|
8788
|
+
return false;
|
|
8789
|
+
const nodeType = value.nodeType;
|
|
8790
|
+
return nodeType === 1 || nodeType === 3 || nodeType === 11;
|
|
8791
|
+
}
|
|
8786
8792
|
function isNodeList(value) {
|
|
8787
8793
|
return (value !== null &&
|
|
8788
8794
|
typeof value === 'object' &&
|
|
@@ -10655,6 +10661,12 @@ function evaluateLiteral(node) {
|
|
|
10655
10661
|
}
|
|
10656
10662
|
async function evaluateIdentifier(node, context) {
|
|
10657
10663
|
const name = node.name;
|
|
10664
|
+
if (name.startsWith('$')) {
|
|
10665
|
+
notifyGlobalRead(name.slice(1), context);
|
|
10666
|
+
}
|
|
10667
|
+
else if (node.scope === 'global') {
|
|
10668
|
+
notifyGlobalRead(name, context);
|
|
10669
|
+
}
|
|
10658
10670
|
if (name === 'me' || name === 'my' || name === 'I') {
|
|
10659
10671
|
return getExpr(context, 'me').evaluate(context);
|
|
10660
10672
|
}
|
|
@@ -10674,7 +10686,6 @@ async function evaluateIdentifier(node, context) {
|
|
|
10674
10686
|
return getExpr(context, 'document').evaluate(context);
|
|
10675
10687
|
}
|
|
10676
10688
|
if (node.scope === 'global' && context.globals?.has(name)) {
|
|
10677
|
-
notifyGlobalRead(name, context);
|
|
10678
10689
|
return context.globals.get(name);
|
|
10679
10690
|
}
|
|
10680
10691
|
if (node.scope === 'element') {
|
|
@@ -10685,12 +10696,9 @@ async function evaluateIdentifier(node, context) {
|
|
|
10685
10696
|
return context.locals.get(name);
|
|
10686
10697
|
}
|
|
10687
10698
|
if (context.globals && context.globals.has(name)) {
|
|
10688
|
-
if (name.startsWith('$'))
|
|
10689
|
-
notifyGlobalRead(name.slice(1), context);
|
|
10690
10699
|
return context.globals.get(name);
|
|
10691
10700
|
}
|
|
10692
10701
|
if (name.startsWith('$') && context.globals && context.globals.has(name.slice(1))) {
|
|
10693
|
-
notifyGlobalRead(name.slice(1), context);
|
|
10694
10702
|
return context.globals.get(name.slice(1));
|
|
10695
10703
|
}
|
|
10696
10704
|
if (context[name] !== undefined) {
|
|
@@ -17820,7 +17828,7 @@ function insertContent(target, content, position) {
|
|
|
17820
17828
|
insertReplace(target, content);
|
|
17821
17829
|
return;
|
|
17822
17830
|
}
|
|
17823
|
-
if (
|
|
17831
|
+
if (isInsertableNode(content)) {
|
|
17824
17832
|
insertElement(target, content, position);
|
|
17825
17833
|
}
|
|
17826
17834
|
else {
|
|
@@ -17831,7 +17839,7 @@ function insertContentSemantic(target, content, position) {
|
|
|
17831
17839
|
insertContent(target, content, toInsertPosition(position));
|
|
17832
17840
|
}
|
|
17833
17841
|
function insertReplace(target, content) {
|
|
17834
|
-
if (
|
|
17842
|
+
if (isInsertableNode(content)) {
|
|
17835
17843
|
target.innerHTML = '';
|
|
17836
17844
|
target.appendChild(content);
|
|
17837
17845
|
}
|
|
@@ -17878,6 +17886,53 @@ function insertText(target, content, position) {
|
|
|
17878
17886
|
target.insertAdjacentText(domPosition, content);
|
|
17879
17887
|
}
|
|
17880
17888
|
}
|
|
17889
|
+
function moveOrInsert(parent, element, ref) {
|
|
17890
|
+
const p = parent;
|
|
17891
|
+
if (typeof p.moveBefore === 'function' && element.isConnected && parent.isConnected) {
|
|
17892
|
+
try {
|
|
17893
|
+
p.moveBefore(element, ref);
|
|
17894
|
+
return;
|
|
17895
|
+
}
|
|
17896
|
+
catch {
|
|
17897
|
+
}
|
|
17898
|
+
}
|
|
17899
|
+
parent.insertBefore(element, ref);
|
|
17900
|
+
}
|
|
17901
|
+
function insertElementsInOrder(target, elements, position) {
|
|
17902
|
+
switch (position) {
|
|
17903
|
+
case 'beforeend':
|
|
17904
|
+
for (const el of elements)
|
|
17905
|
+
moveOrInsert(target, el, null);
|
|
17906
|
+
break;
|
|
17907
|
+
case 'afterbegin':
|
|
17908
|
+
for (let i = elements.length - 1; i >= 0; i--) {
|
|
17909
|
+
moveOrInsert(target, elements[i], target.firstChild);
|
|
17910
|
+
}
|
|
17911
|
+
break;
|
|
17912
|
+
case 'beforebegin': {
|
|
17913
|
+
const parent = target.parentElement;
|
|
17914
|
+
if (!parent)
|
|
17915
|
+
return;
|
|
17916
|
+
for (const el of elements)
|
|
17917
|
+
moveOrInsert(parent, el, target);
|
|
17918
|
+
break;
|
|
17919
|
+
}
|
|
17920
|
+
case 'afterend': {
|
|
17921
|
+
const parent = target.parentElement;
|
|
17922
|
+
if (!parent)
|
|
17923
|
+
return;
|
|
17924
|
+
for (let i = elements.length - 1; i >= 0; i--) {
|
|
17925
|
+
moveOrInsert(parent, elements[i], target.nextSibling);
|
|
17926
|
+
}
|
|
17927
|
+
break;
|
|
17928
|
+
}
|
|
17929
|
+
case 'replace':
|
|
17930
|
+
target.innerHTML = '';
|
|
17931
|
+
for (const el of elements)
|
|
17932
|
+
moveOrInsert(target, el, null);
|
|
17933
|
+
break;
|
|
17934
|
+
}
|
|
17935
|
+
}
|
|
17881
17936
|
function removeElement(element) {
|
|
17882
17937
|
if (element.parentNode) {
|
|
17883
17938
|
element.remove();
|
|
@@ -18968,7 +19023,12 @@ let PutCommand = (() => {
|
|
|
18968
19023
|
else {
|
|
18969
19024
|
for (const t of targets) {
|
|
18970
19025
|
const content = this.parseValue(value);
|
|
18971
|
-
|
|
19026
|
+
if (Array.isArray(content)) {
|
|
19027
|
+
insertElementsInOrder(t, content, toInsertPosition(position));
|
|
19028
|
+
}
|
|
19029
|
+
else {
|
|
19030
|
+
insertContentSemantic(t, content, position);
|
|
19031
|
+
}
|
|
18972
19032
|
}
|
|
18973
19033
|
}
|
|
18974
19034
|
return targets;
|
|
@@ -19000,6 +19060,11 @@ let PutCommand = (() => {
|
|
|
19000
19060
|
parseValue(v) {
|
|
19001
19061
|
if (isHTMLElement$2(v))
|
|
19002
19062
|
return v;
|
|
19063
|
+
if (Array.isArray(v) && v.length > 0 && v.every(isHTMLElement$2)) {
|
|
19064
|
+
return v;
|
|
19065
|
+
}
|
|
19066
|
+
if (isInsertableNode(v))
|
|
19067
|
+
return v;
|
|
19003
19068
|
return v == null ? '' : String(v);
|
|
19004
19069
|
}
|
|
19005
19070
|
looksLikeCss(s) {
|
|
@@ -20221,8 +20286,9 @@ const morphAdapter = {
|
|
|
20221
20286
|
function getStartViewTransition() {
|
|
20222
20287
|
if (typeof document === 'undefined')
|
|
20223
20288
|
return undefined;
|
|
20224
|
-
|
|
20289
|
+
const fn = document
|
|
20225
20290
|
.startViewTransition;
|
|
20291
|
+
return typeof fn === 'function' ? fn.bind(document) : undefined;
|
|
20226
20292
|
}
|
|
20227
20293
|
function isViewTransitionsSupported() {
|
|
20228
20294
|
return typeof getStartViewTransition() === 'function';
|
|
@@ -27321,6 +27387,8 @@ class Runtime extends RuntimeBase {
|
|
|
27321
27387
|
}
|
|
27322
27388
|
}
|
|
27323
27389
|
|
|
27390
|
+
const VERSION$1 = '2.10.0';
|
|
27391
|
+
|
|
27324
27392
|
// src/types.ts
|
|
27325
27393
|
function createLiteral$1(value, dataType) {
|
|
27326
27394
|
return dataType ? { type: "literal", value, dataType } : { type: "literal", value };
|
|
@@ -31662,14 +31730,26 @@ var MultilingualDSLImpl = class {
|
|
|
31662
31730
|
}
|
|
31663
31731
|
translate(input, fromLanguage, toLanguage) {
|
|
31664
31732
|
if (isExplicitSyntax$1(input)) return input;
|
|
31665
|
-
|
|
31666
|
-
|
|
31667
|
-
|
|
31668
|
-
|
|
31669
|
-
|
|
31733
|
+
let node;
|
|
31734
|
+
try {
|
|
31735
|
+
node = this.parseWithConfidence(input, fromLanguage).node;
|
|
31736
|
+
} catch (parseError) {
|
|
31737
|
+
if (this.hasGrammarProfile(fromLanguage) && this.hasGrammarProfile(toLanguage)) {
|
|
31738
|
+
return this.transformer.transform(input, fromLanguage, toLanguage);
|
|
31670
31739
|
}
|
|
31740
|
+
throw parseError;
|
|
31671
31741
|
}
|
|
31672
|
-
|
|
31742
|
+
const rendered = this.registry.getSupportedLanguages().includes(toLanguage) ? this.render(node, toLanguage) : null;
|
|
31743
|
+
if (rendered != null) return rendered;
|
|
31744
|
+
if (this.hasGrammarProfile(fromLanguage) && this.hasGrammarProfile(toLanguage)) {
|
|
31745
|
+
return this.transformer.transform(input, fromLanguage, toLanguage);
|
|
31746
|
+
}
|
|
31747
|
+
throw new Error(
|
|
31748
|
+
`translate() could not render action "${node.action}" in language "${toLanguage}": no custom renderer, domain renderer, or schema pattern covers it, and no grammar profile is configured for the transformer fallback. Either add "${toLanguage}" to the DSL's languages/renderer, or set 'grammarProfile' on its LanguageConfig in createMultilingualDSL() (parse/validate/compile do not need it).`
|
|
31749
|
+
);
|
|
31750
|
+
}
|
|
31751
|
+
hasGrammarProfile(language) {
|
|
31752
|
+
return this.profileProvider.getProfile(language) != null;
|
|
31673
31753
|
}
|
|
31674
31754
|
compile(input, language) {
|
|
31675
31755
|
if (!this.codeGenerator) {
|
|
@@ -35961,7 +36041,13 @@ var init_command_schemas = __esm({
|
|
|
35961
36041
|
expectedTypes: ["selector"],
|
|
35962
36042
|
selectorKinds: ["class", "attribute"],
|
|
35963
36043
|
svoPosition: 1,
|
|
35964
|
-
sovPosition: 2
|
|
36044
|
+
sovPosition: 2,
|
|
36045
|
+
// zh: the transformer emits `\u5207\u6362 \u628a .active` (the profile's \u628a patient
|
|
36046
|
+
// marker), but natural zh writes `\u5207\u6362 .active` bare \u2014 the handcrafted
|
|
36047
|
+
// patterns' form. Optional accepts both; without it the generated
|
|
36048
|
+
// pattern REQUIRED \u628a and the slim bundles could not parse the bare
|
|
36049
|
+
// form at all. Same treatment as go's destination.
|
|
36050
|
+
markerOptional: { zh: true }
|
|
35965
36051
|
},
|
|
35966
36052
|
{
|
|
35967
36053
|
role: "destination",
|
|
@@ -36299,6 +36385,8 @@ var init_command_schemas = __esm({
|
|
|
36299
36385
|
markerOverride: {
|
|
36300
36386
|
en: "",
|
|
36301
36387
|
// No marker before destination in English: "set :x to 5"
|
|
36388
|
+
es: "",
|
|
36389
|
+
// "establecer x a 5" - no marker before variable (profile default `en` matched nothing)
|
|
36302
36390
|
ja: "\u3092",
|
|
36303
36391
|
// "x \u3092 10 \u306b \u8a2d\u5b9a" - variable gets object marker
|
|
36304
36392
|
ko: "\uB97C",
|
|
@@ -36321,9 +36409,19 @@ var init_command_schemas = __esm({
|
|
|
36321
36409
|
// generated hi set patterns carried the swapped markers and matched no
|
|
36322
36410
|
// corpus, so the whole hi set-family (set-text/inner-html/style/attribute)
|
|
36323
36411
|
// fell to the bare-event fallback (S6 set-trio).
|
|
36324
|
-
hi: "\u0915\u094B"
|
|
36412
|
+
hi: "\u0915\u094B",
|
|
36325
36413
|
// target (destination) gets \u0915\u094b
|
|
36326
|
-
|
|
36414
|
+
// zh: the transformer emits the verb-first BA form `\u8bbe\u7f6e \u628a X \u5230 V`
|
|
36415
|
+
// (\u628a before the variable), while natural zh writes `\u8bbe\u7f6e X \u4e3a V`
|
|
36416
|
+
// (unmarked). \u628a as the marker, optional below, accepts both. The
|
|
36417
|
+
// profile default \u5728 matched neither form, so the generated zh set
|
|
36418
|
+
// patterns were dead weight and the slim bundles (schema-generated
|
|
36419
|
+
// patterns only) could not parse set at all.
|
|
36420
|
+
zh: "\u628A"
|
|
36421
|
+
},
|
|
36422
|
+
// Accept the unmarked natural form alongside the transformer's \u628a form
|
|
36423
|
+
// (same treatment as go's destination).
|
|
36424
|
+
markerOptional: { zh: true }
|
|
36327
36425
|
},
|
|
36328
36426
|
{
|
|
36329
36427
|
role: "patient",
|
|
@@ -36366,8 +36464,14 @@ var init_command_schemas = __esm({
|
|
|
36366
36464
|
// "x \u0995\u09c7 10 \u09a4\u09c7 \u09b8\u09c7\u099f" - destination marker on value
|
|
36367
36465
|
qu: "man",
|
|
36368
36466
|
// "x ta 10 man churay" - destination marker on value
|
|
36369
|
-
hi: "\u092E\u0947\u0902"
|
|
36467
|
+
hi: "\u092E\u0947\u0902",
|
|
36370
36468
|
// value (patient) gets \u092e\u0947\u0902 \u2014 see the destination note above
|
|
36469
|
+
// zh: the transformer/corpus form marks the value with \u5230 (`\u8bbe\u7f6e \u628a X
|
|
36470
|
+
// \u5230 V`); natural zh uses \u4e3a (`\u8bbe\u7f6e X \u4e3a V`). \u5230 is the override,
|
|
36471
|
+
// the \u4e3a-family rides along as variants (all merged as alternatives
|
|
36472
|
+
// by schemaMarkerAlternatives). Profile default \u628a was the PATIENT
|
|
36473
|
+
// marker, which never precedes set's value in either form.
|
|
36474
|
+
zh: "\u5230"
|
|
36371
36475
|
},
|
|
36372
36476
|
// Turkish dative is allomorphic under vowel harmony: the i18n transformer
|
|
36373
36477
|
// emits `e` for quoted-string values (`"red" e`) but `-ya` for a value
|
|
@@ -36380,7 +36484,11 @@ var init_command_schemas = __esm({
|
|
|
36380
36484
|
// not parse as a bare command while `t\u0131klama da @disabled i do\u011fru ya
|
|
36381
36485
|
// ayarla` did. See STRUCTURAL_ARCS_ROADMAP.md (tr set-attribute).
|
|
36382
36486
|
markerVariants: {
|
|
36383
|
-
tr: ["e", "a", "ye", "ya"]
|
|
36487
|
+
tr: ["e", "a", "ye", "ya"],
|
|
36488
|
+
// Natural zh value markers (`\u8bbe\u7f6e X \u4e3a V`), simplified + traditional +
|
|
36489
|
+
// resultative \u2014 the handcrafted set-zh-full alternatives, kept parseable
|
|
36490
|
+
// alongside the transformer's \u5230 override above.
|
|
36491
|
+
zh: ["\u4E3A", "\u70BA", "\u6210"]
|
|
36384
36492
|
}
|
|
36385
36493
|
},
|
|
36386
36494
|
{
|
|
@@ -60025,9 +60133,10 @@ function appendOptionalTailRole(tokens, extraction, commandSchema, languageCode,
|
|
|
60025
60133
|
type: "group",
|
|
60026
60134
|
optional: true,
|
|
60027
60135
|
tokens: [
|
|
60028
|
-
...(marker ? marker.split(/\s+/) : []).map(
|
|
60029
|
-
|
|
60030
|
-
|
|
60136
|
+
...(marker ? marker.split(/\s+/) : []).map((word) => ({
|
|
60137
|
+
type: "literal",
|
|
60138
|
+
value: word
|
|
60139
|
+
})),
|
|
60031
60140
|
{
|
|
60032
60141
|
type: "role",
|
|
60033
60142
|
role,
|
|
@@ -60158,6 +60267,70 @@ function generateSOVPatientFirstEventHandlerPattern(commandSchema, profile, keyw
|
|
|
60158
60267
|
extraction
|
|
60159
60268
|
};
|
|
60160
60269
|
}
|
|
60270
|
+
function generateSOVPatientFirstSourceFrontedEventHandlerPattern(commandSchema, profile, keyword, eventMarker, config) {
|
|
60271
|
+
const sourceSpec = commandSchema.roles.find((r) => r.role === "source");
|
|
60272
|
+
if (!sourceSpec) return null;
|
|
60273
|
+
const { marker: sourceMarker, alternatives: sourceAlts } = resolveRoleMarker(sourceSpec, profile);
|
|
60274
|
+
const patientMarker = profile.roleMarkers.patient;
|
|
60275
|
+
if (!sourceMarker) return null;
|
|
60276
|
+
if (sourceMarker === eventMarker.primary || sourceMarker === patientMarker?.primary) return null;
|
|
60277
|
+
const tokens = [];
|
|
60278
|
+
tokens.push({ type: "role", role: "patient", optional: false });
|
|
60279
|
+
if (patientMarker) {
|
|
60280
|
+
tokens.push(
|
|
60281
|
+
patientMarker.alternatives ? {
|
|
60282
|
+
type: "literal",
|
|
60283
|
+
value: patientMarker.primary,
|
|
60284
|
+
alternatives: patientMarker.alternatives
|
|
60285
|
+
} : { type: "literal", value: patientMarker.primary }
|
|
60286
|
+
);
|
|
60287
|
+
}
|
|
60288
|
+
tokens.push({
|
|
60289
|
+
type: "role",
|
|
60290
|
+
role: "source",
|
|
60291
|
+
optional: false,
|
|
60292
|
+
...sourceSpec.expectedTypes ? { expectedTypes: sourceSpec.expectedTypes } : {},
|
|
60293
|
+
...sourceSpec.valueShape !== void 0 ? { valueShape: sourceSpec.valueShape } : {}
|
|
60294
|
+
});
|
|
60295
|
+
for (const word of sourceMarker.split(/\s+/)) {
|
|
60296
|
+
tokens.push(
|
|
60297
|
+
sourceAlts && sourceMarker.split(/\s+/).length === 1 ? { type: "literal", value: word, alternatives: sourceAlts } : { type: "literal", value: word }
|
|
60298
|
+
);
|
|
60299
|
+
}
|
|
60300
|
+
tokens.push({ type: "role", role: "event", optional: false });
|
|
60301
|
+
if (eventMarker.position === "after") {
|
|
60302
|
+
const markerWords = eventMarker.primary.split(/\s+/);
|
|
60303
|
+
if (markerWords.length > 1) {
|
|
60304
|
+
for (const word of markerWords) tokens.push({ type: "literal", value: word });
|
|
60305
|
+
} else {
|
|
60306
|
+
tokens.push(
|
|
60307
|
+
eventMarker.alternatives ? { type: "literal", value: eventMarker.primary, alternatives: eventMarker.alternatives } : { type: "literal", value: eventMarker.primary }
|
|
60308
|
+
);
|
|
60309
|
+
}
|
|
60310
|
+
}
|
|
60311
|
+
tokens.push(
|
|
60312
|
+
keyword.alternatives ? { type: "literal", value: keyword.primary, alternatives: keyword.alternatives } : { type: "literal", value: keyword.primary }
|
|
60313
|
+
);
|
|
60314
|
+
const extraction = {
|
|
60315
|
+
action: { value: commandSchema.action },
|
|
60316
|
+
event: { fromRole: "event" },
|
|
60317
|
+
patient: { fromRole: "patient" },
|
|
60318
|
+
source: { fromRole: "source" }
|
|
60319
|
+
};
|
|
60320
|
+
appendOptionalRecipient(tokens, extraction, commandSchema, profile.code);
|
|
60321
|
+
appendOptionalViewTransition(tokens, extraction, commandSchema, profile.code);
|
|
60322
|
+
return {
|
|
60323
|
+
id: `${commandSchema.action}-event-${profile.code}-sov-source-fronted`,
|
|
60324
|
+
language: profile.code,
|
|
60325
|
+
command: "on",
|
|
60326
|
+
priority: (config.basePriority ?? 100) + 48,
|
|
60327
|
+
template: {
|
|
60328
|
+
format: `{patient} ${patientMarker?.primary || ""} {source} ${sourceMarker} {event} ${eventMarker.primary} ${keyword.primary}`,
|
|
60329
|
+
tokens
|
|
60330
|
+
},
|
|
60331
|
+
extraction
|
|
60332
|
+
};
|
|
60333
|
+
}
|
|
60161
60334
|
function generateSOVPatientFirstWithDestEventHandlerPattern(commandSchema, profile, keyword, eventMarker, config) {
|
|
60162
60335
|
const tokens = [];
|
|
60163
60336
|
tokens.push({ type: "role", role: "patient", optional: false });
|
|
@@ -61060,6 +61233,14 @@ function generateEventHandlerPatterns(commandSchema, profile, config = defaultCo
|
|
|
61060
61233
|
config
|
|
61061
61234
|
)
|
|
61062
61235
|
);
|
|
61236
|
+
const sourceFronted = generateSOVPatientFirstSourceFrontedEventHandlerPattern(
|
|
61237
|
+
commandSchema,
|
|
61238
|
+
profile,
|
|
61239
|
+
keyword,
|
|
61240
|
+
eventMarker,
|
|
61241
|
+
config
|
|
61242
|
+
);
|
|
61243
|
+
if (sourceFronted) patterns.push(sourceFronted);
|
|
61063
61244
|
const destMarkerCheck = profile.roleMarkers.destination;
|
|
61064
61245
|
if (destMarkerCheck && destMarkerCheck.primary !== eventMarker.primary) {
|
|
61065
61246
|
patterns.push(
|
|
@@ -66115,7 +66296,10 @@ var _PatternMatcher = class _PatternMatcher {
|
|
|
66115
66296
|
}
|
|
66116
66297
|
}
|
|
66117
66298
|
if (patternToken.valueShape === "keyword" && value.type === "expression") {
|
|
66118
|
-
captured.set(
|
|
66299
|
+
captured.set(
|
|
66300
|
+
patternToken.role,
|
|
66301
|
+
createLiteral(String(value.raw ?? ""))
|
|
66302
|
+
);
|
|
66119
66303
|
} else {
|
|
66120
66304
|
captured.set(patternToken.role, value);
|
|
66121
66305
|
}
|
|
@@ -67213,7 +67397,7 @@ var _PatternMatcher = class _PatternMatcher {
|
|
|
67213
67397
|
} else if (rule.value !== void 0) {
|
|
67214
67398
|
captured.set(role, { type: "literal", value: rule.value });
|
|
67215
67399
|
} else if (rule.default) {
|
|
67216
|
-
captured.set(role, rule.default);
|
|
67400
|
+
captured.set(role, { ...rule.default, implicit: true });
|
|
67217
67401
|
}
|
|
67218
67402
|
}
|
|
67219
67403
|
}
|
|
@@ -68167,14 +68351,20 @@ var SemanticRendererImpl = class {
|
|
|
68167
68351
|
return parts.join(" ");
|
|
68168
68352
|
}
|
|
68169
68353
|
/**
|
|
68170
|
-
* Join a statement list the way a block body reads:
|
|
68171
|
-
* but a single space immediately after a loop/tell block header
|
|
68172
|
-
* follows directly).
|
|
68173
|
-
* keeps its own copy because it also handles the multi-handler
|
|
68174
|
-
* cases.
|
|
68354
|
+
* Join a statement list the way a block body reads: the target language's `then`
|
|
68355
|
+
* between siblings, but a single space immediately after a loop/tell block header
|
|
68356
|
+
* (whose body follows directly). Used by renderConditional's branches;
|
|
68357
|
+
* renderCompound keeps its own copy because it also handles the multi-handler
|
|
68358
|
+
* and bind-feature cases.
|
|
68359
|
+
*
|
|
68360
|
+
* The chain word is localized (`this.keyword(language, 'then')`) for the same
|
|
68361
|
+
* reason renderCompound localizes it: a hardcoded English `then` leaks into every
|
|
68362
|
+
* non-en block body (`\u3082\u3057 \u2026 \u524a\u9664 then \u8ffd\u52a0`), which no target-language tokenizer
|
|
68363
|
+
* recognizes as a connector.
|
|
68175
68364
|
*/
|
|
68176
68365
|
joinStatements(statements, language) {
|
|
68177
68366
|
const rendered = statements.map((s) => this.render(s, language));
|
|
68367
|
+
const thenKw = this.keyword(language, "then");
|
|
68178
68368
|
let out = rendered[0] ?? "";
|
|
68179
68369
|
for (let i = 1; i < rendered.length; i++) {
|
|
68180
68370
|
const prev = statements[i - 1];
|
|
@@ -68182,7 +68372,7 @@ var SemanticRendererImpl = class {
|
|
|
68182
68372
|
if (prev.kind === "command" && BLOCK_NEEDS_TRAILING_END.has(prev.action)) {
|
|
68183
68373
|
out += ` ${this.keyword(language, "end")}`;
|
|
68184
68374
|
}
|
|
68185
|
-
out += (afterBlockHeader ? " " :
|
|
68375
|
+
out += (afterBlockHeader ? " " : ` ${thenKw} `) + rendered[i];
|
|
68186
68376
|
}
|
|
68187
68377
|
return out;
|
|
68188
68378
|
}
|
|
@@ -68355,6 +68545,7 @@ var SemanticRendererImpl = class {
|
|
|
68355
68545
|
if (!roleToken) continue;
|
|
68356
68546
|
const roleValue = node.roles.get(roleName);
|
|
68357
68547
|
if (roleValue?.type !== "reference" || roleValue.value !== "me") continue;
|
|
68548
|
+
if (!roleValue.implicit) continue;
|
|
68358
68549
|
if (roleName === "destination") {
|
|
68359
68550
|
const patient = node.roles.get("patient");
|
|
68360
68551
|
if (patient?.type === "literal" && patient.dataType === "string") continue;
|
|
@@ -68796,7 +68987,7 @@ function fillSchemaDefaults(node) {
|
|
|
68796
68987
|
const roles = node.roles;
|
|
68797
68988
|
for (const spec of schema.roles) {
|
|
68798
68989
|
if (spec.default !== void 0 && !roles.has(spec.role)) {
|
|
68799
|
-
roles.set(spec.role, { ...spec.default });
|
|
68990
|
+
roles.set(spec.role, { ...spec.default, implicit: true });
|
|
68800
68991
|
}
|
|
68801
68992
|
}
|
|
68802
68993
|
}
|
|
@@ -69401,7 +69592,7 @@ var _SemanticParserImpl = class _SemanticParserImpl {
|
|
|
69401
69592
|
}
|
|
69402
69593
|
let eventModifiers = patternMatcher.extractEventModifiers(tokens);
|
|
69403
69594
|
const sourceValue = match.captured.get("source");
|
|
69404
|
-
if (sourceValue && match.pattern.id.
|
|
69595
|
+
if (sourceValue && match.pattern.id.endsWith("source") && !(sourceValue.type === "reference" && sourceValue.value === "me")) {
|
|
69405
69596
|
eventModifiers = { ...eventModifiers ?? {}, from: sourceValue };
|
|
69406
69597
|
}
|
|
69407
69598
|
const additionalEvents = this.extractOrConjunctionEvents(tokens, language);
|
|
@@ -80984,7 +81175,7 @@ function createRuntimeInstance(options) {
|
|
|
80984
81175
|
return new Runtime(options);
|
|
80985
81176
|
}
|
|
80986
81177
|
function getVersion() {
|
|
80987
|
-
return
|
|
81178
|
+
return VERSION$1;
|
|
80988
81179
|
}
|
|
80989
81180
|
function toCompileError(error) {
|
|
80990
81181
|
return {
|