bobe 0.0.48 → 0.0.49
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/bobe.cjs.js +145 -64
- package/dist/bobe.cjs.js.map +1 -1
- package/dist/bobe.compiler.cjs.js +153 -86
- package/dist/bobe.compiler.cjs.js.map +1 -1
- package/dist/bobe.compiler.esm.js +154 -87
- package/dist/bobe.compiler.esm.js.map +1 -1
- package/dist/bobe.esm.js +146 -65
- package/dist/bobe.esm.js.map +1 -1
- package/dist/index.d.ts +39 -18
- package/dist/index.umd.js +145 -64
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -3
package/dist/bobe.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Queue, isNum, matchIdStart2, matchId, escapeMap, jsVarRegexp, date32 } from 'bobe-shared';
|
|
2
|
-
import { Signal, Computed, getPulling, setPulling,
|
|
2
|
+
import { Signal, Computed, Keys, getPulling, setPulling, deepSignal, toRaw, ScheduleType, runWithPulling, Scope, Store, noopEffect, NoopEffect, Effect, effect as effect$1, shareSignal } from 'aoye';
|
|
3
3
|
export { Store } from 'aoye';
|
|
4
4
|
|
|
5
5
|
let TokenType = function (TokenType) {
|
|
@@ -105,10 +105,13 @@ class Tokenizer {
|
|
|
105
105
|
this.hook = hook;
|
|
106
106
|
this.useDedentAsEof = useDedentAsEof;
|
|
107
107
|
if (useDedentAsEof) {
|
|
108
|
-
this.
|
|
109
|
-
this.isFirstToken = true;
|
|
108
|
+
this.initIndentWhenUseDedentAsEof();
|
|
110
109
|
}
|
|
111
110
|
}
|
|
111
|
+
initIndentWhenUseDedentAsEof() {
|
|
112
|
+
this.setToken(TokenType.Indent, '');
|
|
113
|
+
this.isFirstToken = true;
|
|
114
|
+
}
|
|
112
115
|
next() {
|
|
113
116
|
this.i++;
|
|
114
117
|
}
|
|
@@ -138,16 +141,23 @@ class Tokenizer {
|
|
|
138
141
|
throwUnclosed(code, message, startOffset, startLine, startCol) {
|
|
139
142
|
throw new ParseSyntaxError(code, message, this.unclosedLoc(startOffset, startLine, startCol));
|
|
140
143
|
}
|
|
141
|
-
resume(
|
|
144
|
+
resume({
|
|
145
|
+
dentStack,
|
|
146
|
+
waitingTokens,
|
|
147
|
+
..._snapshot
|
|
148
|
+
}) {
|
|
142
149
|
this.token = undefined;
|
|
143
150
|
this.needIndent = false;
|
|
144
151
|
this.isFirstToken = true;
|
|
145
|
-
this.dentStack = [0];
|
|
152
|
+
this.dentStack = dentStack ? dentStack.slice() : [0];
|
|
153
|
+
if (waitingTokens) {
|
|
154
|
+
this.waitingTokens = waitingTokens.clone();
|
|
155
|
+
}
|
|
146
156
|
Object.assign(this, _snapshot);
|
|
147
157
|
}
|
|
148
|
-
snapshot(keys) {
|
|
158
|
+
snapshot(keys, dtI = 0) {
|
|
149
159
|
const snap = {
|
|
150
|
-
i: this.i,
|
|
160
|
+
i: this.i + dtI,
|
|
151
161
|
waitingTokens: this.waitingTokens.clone()
|
|
152
162
|
};
|
|
153
163
|
if (keys) {
|
|
@@ -160,8 +170,10 @@ class Tokenizer {
|
|
|
160
170
|
}
|
|
161
171
|
return snap;
|
|
162
172
|
}
|
|
163
|
-
skip() {
|
|
164
|
-
|
|
173
|
+
skip(targetDentLen) {
|
|
174
|
+
if (targetDentLen == undefined) {
|
|
175
|
+
targetDentLen = this.dentStack[this.dentStack.length - 1];
|
|
176
|
+
}
|
|
165
177
|
let needIndent = false;
|
|
166
178
|
let skipFragment = ``;
|
|
167
179
|
this.token = undefined;
|
|
@@ -184,7 +196,7 @@ class Tokenizer {
|
|
|
184
196
|
isEmptyLine = _this$getDentValue.isEmptyLine;
|
|
185
197
|
const currLen = value.length;
|
|
186
198
|
if (isEmptyLine) continue;
|
|
187
|
-
if (currLen >
|
|
199
|
+
if (currLen > targetDentLen) {
|
|
188
200
|
skipFragment += value;
|
|
189
201
|
} else {
|
|
190
202
|
for (let i = this.dentStack.length - 1; i >= 0; i--) {
|
|
@@ -197,6 +209,9 @@ class Tokenizer {
|
|
|
197
209
|
break;
|
|
198
210
|
}
|
|
199
211
|
this.dentStack.pop();
|
|
212
|
+
if (expLen > targetDentLen) {
|
|
213
|
+
continue;
|
|
214
|
+
}
|
|
200
215
|
if (!this.token) {
|
|
201
216
|
this.setToken(TokenType.Dedent, String(expLen));
|
|
202
217
|
} else {
|
|
@@ -251,29 +266,31 @@ class Tokenizer {
|
|
|
251
266
|
}
|
|
252
267
|
outer: while (1) {
|
|
253
268
|
if (this.needIndent) {
|
|
269
|
+
this.locStart();
|
|
254
270
|
this.dent();
|
|
271
|
+
this.locEnd();
|
|
255
272
|
} else {
|
|
256
273
|
const char = this.code[this.i];
|
|
257
274
|
switch (char) {
|
|
258
275
|
case '\t':
|
|
259
276
|
case ' ':
|
|
260
277
|
break;
|
|
261
|
-
case '\n':
|
|
262
|
-
this.newLine();
|
|
263
|
-
this.needIndent = true;
|
|
264
|
-
break;
|
|
265
|
-
case '=':
|
|
266
|
-
this.assignment();
|
|
267
|
-
break;
|
|
268
|
-
case '|':
|
|
269
|
-
this.pipe();
|
|
270
|
-
break;
|
|
271
|
-
case ';':
|
|
272
|
-
this.setToken(TokenType.Semicolon, ';');
|
|
273
|
-
break;
|
|
274
278
|
default:
|
|
275
|
-
|
|
279
|
+
this.locStart();
|
|
276
280
|
switch (char) {
|
|
281
|
+
case '\n':
|
|
282
|
+
this.newLine();
|
|
283
|
+
this.needIndent = true;
|
|
284
|
+
break;
|
|
285
|
+
case '=':
|
|
286
|
+
this.assignment();
|
|
287
|
+
break;
|
|
288
|
+
case '|':
|
|
289
|
+
this.pipe();
|
|
290
|
+
break;
|
|
291
|
+
case ';':
|
|
292
|
+
this.setToken(TokenType.Semicolon, ';');
|
|
293
|
+
break;
|
|
277
294
|
case '/':
|
|
278
295
|
this.comment();
|
|
279
296
|
break;
|
|
@@ -298,7 +315,7 @@ class Tokenizer {
|
|
|
298
315
|
}
|
|
299
316
|
break;
|
|
300
317
|
}
|
|
301
|
-
|
|
318
|
+
this.locEnd();
|
|
302
319
|
break;
|
|
303
320
|
}
|
|
304
321
|
this.next();
|
|
@@ -314,6 +331,10 @@ class Tokenizer {
|
|
|
314
331
|
this.handledTokens.push(this.token);
|
|
315
332
|
}
|
|
316
333
|
}
|
|
334
|
+
locStart() {
|
|
335
|
+
}
|
|
336
|
+
locEnd() {
|
|
337
|
+
}
|
|
317
338
|
getComment() {
|
|
318
339
|
let value = '/';
|
|
319
340
|
let nextC = this.code[this.i + 1];
|
|
@@ -330,6 +351,7 @@ class Tokenizer {
|
|
|
330
351
|
this.getComment();
|
|
331
352
|
}
|
|
332
353
|
condExp() {
|
|
354
|
+
this.locStart();
|
|
333
355
|
let value = '';
|
|
334
356
|
this.token = null;
|
|
335
357
|
let char = this.code[this.i];
|
|
@@ -344,12 +366,14 @@ class Tokenizer {
|
|
|
344
366
|
const trimmed = value.replace(/\/\/[\s\S]+/, '').trim();
|
|
345
367
|
this.setToken(TokenType.Identifier, trimmed ? trimmed : true, 0);
|
|
346
368
|
this.handledTokens.push(this.token);
|
|
369
|
+
this.locEnd();
|
|
347
370
|
return this.token;
|
|
348
371
|
}
|
|
349
372
|
isEol(i) {
|
|
350
373
|
return this.code[i] === '\n' || this.code[i] === '/';
|
|
351
374
|
}
|
|
352
375
|
jsExp() {
|
|
376
|
+
this.locStart();
|
|
353
377
|
this.token = null;
|
|
354
378
|
let value = '';
|
|
355
379
|
let char = this.code[this.i];
|
|
@@ -363,6 +387,7 @@ class Tokenizer {
|
|
|
363
387
|
}
|
|
364
388
|
this.setToken(TokenType.Identifier, value, 0);
|
|
365
389
|
this.handledTokens.push(this.token);
|
|
390
|
+
this.locEnd();
|
|
366
391
|
return this.token;
|
|
367
392
|
}
|
|
368
393
|
peekChar() {
|
|
@@ -550,7 +575,7 @@ class Tokenizer {
|
|
|
550
575
|
const prevLen = this.dentStack[this.dentStack.length - 1];
|
|
551
576
|
if (currLen > prevLen) {
|
|
552
577
|
this.dentStack.push(currLen);
|
|
553
|
-
this.setToken(TokenType.Indent, currLen);
|
|
578
|
+
this.setToken(TokenType.Indent, currLen, 0);
|
|
554
579
|
return indentHasLen;
|
|
555
580
|
}
|
|
556
581
|
if (currLen < prevLen) {
|
|
@@ -565,7 +590,7 @@ class Tokenizer {
|
|
|
565
590
|
}
|
|
566
591
|
this.dentStack.pop();
|
|
567
592
|
if (!this.token) {
|
|
568
|
-
this.setToken(TokenType.Dedent, String(expLen));
|
|
593
|
+
this.setToken(TokenType.Dedent, String(expLen), 0);
|
|
569
594
|
} else {
|
|
570
595
|
this.waitingTokens.push({
|
|
571
596
|
type: TokenType.Dedent,
|
|
@@ -974,7 +999,7 @@ var NodeType = function (NodeType) {
|
|
|
974
999
|
let _initProto;
|
|
975
1000
|
class Compiler {
|
|
976
1001
|
static {
|
|
977
|
-
var _applyDecs$e = _slicedToArray(_applyDecs2311(this, [], [[NodeHook, 2, "parseProgram"], [[NodeHook, NodeLoc], 2, "parseComponentNode"], [[NodeHook, NodeLoc], 2, "parseElementNode"], [[NodeHook, NodeLoc], 2, "parseConditionalNode"], [[NodeHook, NodeLoc], 2, "parseLoopNode"], [NodeHook, 2, "parseProperty"], [[NodeHook, TokenLoc], 2, "parsePropertyKey"], [[NodeHook, TokenLoc], 2, "parseJsExp"], [[NodeHook, TokenLoc], 2, "parsePropertyValue"], [[NodeHook, TokenLoc], 2, "parseName"]]).e, 1);
|
|
1002
|
+
var _applyDecs$e = _slicedToArray(_applyDecs2311(this, [], [[NodeHook, 2, "parseProgram"], [[NodeHook, NodeLoc], 2, "parseComponentNode"], [[NodeHook, NodeLoc], 2, "parseElementNode"], [[NodeHook, NodeLoc], 2, "parseConditionalNode"], [[NodeHook, NodeLoc], 2, "parseLoopNode"], [NodeHook, 2, "parseProperty"], [[NodeHook, TokenLoc], 2, "parsePropertyKey"], [[NodeHook, TokenLoc], 2, "parseJsExp"], [[NodeHook, TokenLoc], 2, "parsePropertyValue"], [[NodeHook, NodeLoc], 2, "parsePropertyInlineFragment"], [[NodeHook, TokenLoc], 2, "parseName"]]).e, 1);
|
|
978
1003
|
_initProto = _applyDecs$e[0];
|
|
979
1004
|
}
|
|
980
1005
|
errors = (_initProto(this), []);
|
|
@@ -1076,9 +1101,9 @@ class Compiler {
|
|
|
1076
1101
|
parseComponentNode(node) {
|
|
1077
1102
|
const name = this.parseName();
|
|
1078
1103
|
this.tokenizer.nextToken();
|
|
1079
|
-
const props = this.headerLineAndExtensions();
|
|
1080
1104
|
node.type = NodeType.Component;
|
|
1081
1105
|
node.componentName = name;
|
|
1106
|
+
const props = this.headerLineAndExtensions();
|
|
1082
1107
|
node.props = props;
|
|
1083
1108
|
this.hooks.parseComponentNode?.propsAdded?.call(this, node);
|
|
1084
1109
|
const children = this.handleChildren();
|
|
@@ -1096,9 +1121,9 @@ class Compiler {
|
|
|
1096
1121
|
}
|
|
1097
1122
|
const tagName = tagToken.value;
|
|
1098
1123
|
this.tokenizer.nextToken();
|
|
1099
|
-
const props = this.headerLineAndExtensions();
|
|
1100
1124
|
node.type = NodeType.Element;
|
|
1101
1125
|
node.tagName = tagName;
|
|
1126
|
+
const props = this.headerLineAndExtensions();
|
|
1102
1127
|
node.props = props;
|
|
1103
1128
|
this.hooks.parseElementNode?.propsAdded?.call(this, node);
|
|
1104
1129
|
const children = this.handleChildren();
|
|
@@ -1172,17 +1197,17 @@ class Compiler {
|
|
|
1172
1197
|
}
|
|
1173
1198
|
headerLineAndExtensions() {
|
|
1174
1199
|
const props = [];
|
|
1175
|
-
|
|
1176
|
-
if (this.tokenizer.token.type & TokenType.NewLine) {
|
|
1177
|
-
this.tokenizer.nextToken();
|
|
1178
|
-
}
|
|
1179
|
-
while (this.tokenizer.token.type & TokenType.Pipe) {
|
|
1180
|
-
this.tokenizer.nextToken();
|
|
1200
|
+
do {
|
|
1181
1201
|
props.push(...this.attributeList());
|
|
1182
1202
|
if (this.tokenizer.token.type & TokenType.NewLine) {
|
|
1183
1203
|
this.tokenizer.nextToken();
|
|
1184
1204
|
}
|
|
1185
|
-
|
|
1205
|
+
if ((this.tokenizer.token.type & TokenType.Pipe) === 0) {
|
|
1206
|
+
break;
|
|
1207
|
+
} else {
|
|
1208
|
+
this.tokenizer.nextToken();
|
|
1209
|
+
}
|
|
1210
|
+
} while (true);
|
|
1186
1211
|
return props;
|
|
1187
1212
|
}
|
|
1188
1213
|
attributeList() {
|
|
@@ -1206,25 +1231,35 @@ class Compiler {
|
|
|
1206
1231
|
const token = this.tokenizer.nextToken();
|
|
1207
1232
|
if (token.value !== '=') {
|
|
1208
1233
|
this.addError(ParseErrorCode.MISSING_ASSIGN, `属性 "${node.key.key}" 缺少 "=" 赋值符号`, node.key.loc ?? this.tokenizer.emptyLoc(), node);
|
|
1209
|
-
|
|
1210
|
-
node.loc.end = node.key.loc.end;
|
|
1211
|
-
node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
|
|
1234
|
+
this.handleOnlyKeyLoc(node);
|
|
1212
1235
|
return node;
|
|
1213
1236
|
}
|
|
1214
1237
|
const valueToken = this.tokenizer.nextToken();
|
|
1238
|
+
if (valueToken.type & TokenType.NewLine) {
|
|
1239
|
+
this.tokenizer.nextToken();
|
|
1240
|
+
node.value = this.parsePropertyInlineFragment();
|
|
1241
|
+
this.handleKeyValueLoc(node);
|
|
1242
|
+
return node;
|
|
1243
|
+
}
|
|
1215
1244
|
if ((valueToken.type & ValueTokenType) === 0) {
|
|
1216
1245
|
this.addError(ParseErrorCode.MISSING_PROP_ASSIGNMENT, `属性值不合法, "${valueToken.value}" 不合法`, valueToken.loc ?? this.tokenizer.emptyLoc(), node);
|
|
1217
|
-
|
|
1218
|
-
node.loc.end = node.key.loc.end;
|
|
1219
|
-
node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
|
|
1246
|
+
this.handleOnlyKeyLoc(node);
|
|
1220
1247
|
return node;
|
|
1221
1248
|
}
|
|
1222
1249
|
node.value = this.parsePropertyValue();
|
|
1223
1250
|
this.tokenizer.nextToken();
|
|
1251
|
+
this.handleKeyValueLoc(node);
|
|
1252
|
+
return node;
|
|
1253
|
+
}
|
|
1254
|
+
handleOnlyKeyLoc(node) {
|
|
1255
|
+
node.loc.start = node.key.loc.start;
|
|
1256
|
+
node.loc.end = node.key.loc.end;
|
|
1257
|
+
node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
|
|
1258
|
+
}
|
|
1259
|
+
handleKeyValueLoc(node) {
|
|
1224
1260
|
node.loc.start = node.key.loc.start;
|
|
1225
1261
|
node.loc.end = node.value.loc.end;
|
|
1226
1262
|
node.loc.source = this.tokenizer.code.slice(node.loc.start.offset, node.loc.end.offset);
|
|
1227
|
-
return node;
|
|
1228
1263
|
}
|
|
1229
1264
|
parsePropertyKey(node) {
|
|
1230
1265
|
node.type = NodeType.PropertyKey;
|
|
@@ -1249,6 +1284,12 @@ class Compiler {
|
|
|
1249
1284
|
node.value = value;
|
|
1250
1285
|
return node;
|
|
1251
1286
|
}
|
|
1287
|
+
parsePropertyInlineFragment(node) {
|
|
1288
|
+
const list = this.handleChildren();
|
|
1289
|
+
node.type = NodeType.StaticValue;
|
|
1290
|
+
node.value = list;
|
|
1291
|
+
return node;
|
|
1292
|
+
}
|
|
1252
1293
|
parseName(node) {
|
|
1253
1294
|
const _this$tokenizer$_hook7 = this.tokenizer._hook({}),
|
|
1254
1295
|
_this$tokenizer$_hook8 = _slicedToArray(_this$tokenizer$_hook7, 2),
|
|
@@ -1472,6 +1513,9 @@ class Interpreter {
|
|
|
1472
1513
|
}
|
|
1473
1514
|
if (sort & NodeSort.TokenizerSwitcher) {
|
|
1474
1515
|
const switcher = stack.peekByType(NodeSort.TokenizerSwitcher)?.node;
|
|
1516
|
+
if (parent.resumeSnapshot) {
|
|
1517
|
+
this.tokenizer.resume(parent.resumeSnapshot);
|
|
1518
|
+
}
|
|
1475
1519
|
this.tokenizer = switcher.tokenizer;
|
|
1476
1520
|
}
|
|
1477
1521
|
if (parent.__logicType === FakeType.ForItem) {
|
|
@@ -1566,7 +1610,7 @@ class Interpreter {
|
|
|
1566
1610
|
} else {
|
|
1567
1611
|
const valueIsMapKey = Reflect.has(data[Keys.Raw], value);
|
|
1568
1612
|
const val = data[Keys.Raw][value];
|
|
1569
|
-
if (typeof val === 'function') {
|
|
1613
|
+
if (typeof val === 'function' || val instanceof InlineFragment) {
|
|
1570
1614
|
_node = this.componentOrFragmentDeclaration(val, ctx);
|
|
1571
1615
|
} else {
|
|
1572
1616
|
const str = valueIsMapKey ? value : this.getFn(data, value);
|
|
@@ -1578,11 +1622,15 @@ class Interpreter {
|
|
|
1578
1622
|
_node = this.createNode(value);
|
|
1579
1623
|
}
|
|
1580
1624
|
this.tokenizer.nextToken();
|
|
1581
|
-
this.
|
|
1582
|
-
this.extensionLines(_node);
|
|
1625
|
+
this.headerLineAndExtensions(_node);
|
|
1583
1626
|
this.onePropParsed = this.oneRealPropParsed;
|
|
1584
1627
|
if (_node.__logicType & TokenizerSwitcherBit) {
|
|
1585
1628
|
this.tokenizer = _node.tokenizer;
|
|
1629
|
+
if (_node.fragmentSnapshot) {
|
|
1630
|
+
this.tokenizer.resume(_node.fragmentSnapshot);
|
|
1631
|
+
this.tokenizer.useDedentAsEof = true;
|
|
1632
|
+
this.tokenizer.initIndentWhenUseDedentAsEof();
|
|
1633
|
+
}
|
|
1586
1634
|
}
|
|
1587
1635
|
return _node;
|
|
1588
1636
|
}
|
|
@@ -1958,16 +2006,25 @@ class Interpreter {
|
|
|
1958
2006
|
}
|
|
1959
2007
|
oneRealPropParsed = this.onePropParsed.bind(this);
|
|
1960
2008
|
componentOrFragmentDeclaration(ComponentOrRender, ctx) {
|
|
1961
|
-
let Component,
|
|
2009
|
+
let Component, tokenizer, child, fragmentSnapshot, resumeSnapshot;
|
|
1962
2010
|
const isCC = ComponentOrRender.prototype instanceof Store;
|
|
1963
2011
|
if (isCC) {
|
|
1964
2012
|
Component = ComponentOrRender;
|
|
1965
2013
|
child = Component.new();
|
|
2014
|
+
tokenizer = child.ui(true);
|
|
2015
|
+
} else if (ComponentOrRender instanceof InlineFragment) {
|
|
2016
|
+
const conf = ComponentOrRender;
|
|
2017
|
+
child = deepSignal({}, getPulling(), true);
|
|
2018
|
+
Object.setPrototypeOf(child, conf.data);
|
|
2019
|
+
tokenizer = conf.tokenizer;
|
|
2020
|
+
fragmentSnapshot = conf.snapshot;
|
|
2021
|
+
resumeSnapshot = tokenizer.snapshot(['token', 'needIndent', 'isFirstToken', 'dentStack', 'isFirstToken', 'useDedentAsEof']);
|
|
1966
2022
|
} else {
|
|
1967
|
-
render = ComponentOrRender;
|
|
2023
|
+
const render = ComponentOrRender;
|
|
1968
2024
|
const boundStore = render.boundStore;
|
|
1969
2025
|
child = deepSignal({}, getPulling(), true);
|
|
1970
2026
|
Object.setPrototypeOf(child, boundStore);
|
|
2027
|
+
tokenizer = render(true);
|
|
1971
2028
|
}
|
|
1972
2029
|
const node = {
|
|
1973
2030
|
__logicType: isCC ? FakeType.Component : FakeType.Fragment,
|
|
@@ -1975,7 +2032,9 @@ class Interpreter {
|
|
|
1975
2032
|
realBefore: null,
|
|
1976
2033
|
realAfter: null,
|
|
1977
2034
|
data: child,
|
|
1978
|
-
tokenizer
|
|
2035
|
+
tokenizer,
|
|
2036
|
+
fragmentSnapshot,
|
|
2037
|
+
resumeSnapshot
|
|
1979
2038
|
};
|
|
1980
2039
|
this.onePropParsed = createStoreOnePropParsed(child);
|
|
1981
2040
|
node.realAfter = this.insertAfterAnchor('component-after');
|
|
@@ -2112,26 +2171,38 @@ class Interpreter {
|
|
|
2112
2171
|
point = next;
|
|
2113
2172
|
}
|
|
2114
2173
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2174
|
+
headerLineAndExtensions(_node) {
|
|
2175
|
+
const tokenizer = this.tokenizer;
|
|
2176
|
+
do {
|
|
2177
|
+
const isComponent = _node.__logicType & TokenizerSwitcherBit;
|
|
2178
|
+
let snapshot, dentLen;
|
|
2179
|
+
const data = this.getData();
|
|
2180
|
+
const unHandledKey = this.attributeList(_node, data);
|
|
2181
|
+
if (isComponent) {
|
|
2182
|
+
snapshot = tokenizer.snapshot(undefined, -1);
|
|
2183
|
+
dentLen = tokenizer.dentStack[tokenizer.dentStack.length - 1];
|
|
2119
2184
|
}
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2185
|
+
tokenizer.nextToken();
|
|
2186
|
+
if ((tokenizer.token.type & TokenType.Pipe) === 0) {
|
|
2187
|
+
if (isComponent && tokenizer.token.type & TokenType.Indent) {
|
|
2188
|
+
this.inlineFragment(_node, snapshot, data, unHandledKey);
|
|
2189
|
+
tokenizer.skip(dentLen);
|
|
2190
|
+
if ((tokenizer.token.type & TokenType.Pipe) === 0) {
|
|
2191
|
+
break;
|
|
2192
|
+
}
|
|
2193
|
+
} else {
|
|
2194
|
+
break;
|
|
2195
|
+
}
|
|
2124
2196
|
}
|
|
2125
|
-
|
|
2126
|
-
}
|
|
2197
|
+
tokenizer.nextToken();
|
|
2198
|
+
} while (true);
|
|
2127
2199
|
}
|
|
2128
|
-
|
|
2129
|
-
this.
|
|
2130
|
-
this.
|
|
2200
|
+
inlineFragment(_node, snapshot, data, key = 'children') {
|
|
2201
|
+
const value = new InlineFragment(snapshot, data, key, this.tokenizer);
|
|
2202
|
+
this.onePropParsed(data, _node, key, value, false, true);
|
|
2131
2203
|
}
|
|
2132
|
-
attributeList(_node) {
|
|
2204
|
+
attributeList(_node, data) {
|
|
2133
2205
|
let key, eq;
|
|
2134
|
-
const data = this.getData();
|
|
2135
2206
|
while ((this.tokenizer.token.type & TokenType.NewLine) === 0) {
|
|
2136
2207
|
if (key == null) {
|
|
2137
2208
|
key = this.tokenizer.token.value;
|
|
@@ -2179,6 +2250,7 @@ class Interpreter {
|
|
|
2179
2250
|
}
|
|
2180
2251
|
this.tokenizer.nextToken();
|
|
2181
2252
|
}
|
|
2253
|
+
return key;
|
|
2182
2254
|
}
|
|
2183
2255
|
config(opt) {
|
|
2184
2256
|
Object.assign(this, opt);
|
|
@@ -2262,6 +2334,15 @@ function createStoreOnePropParsed(child) {
|
|
|
2262
2334
|
};
|
|
2263
2335
|
return onePropParsed;
|
|
2264
2336
|
}
|
|
2337
|
+
class InlineFragment {
|
|
2338
|
+
[Keys.ProxyFreeObject] = true;
|
|
2339
|
+
constructor(snapshot, data, key, tokenizer) {
|
|
2340
|
+
this.snapshot = snapshot;
|
|
2341
|
+
this.data = data;
|
|
2342
|
+
this.key = key;
|
|
2343
|
+
this.tokenizer = tokenizer;
|
|
2344
|
+
}
|
|
2345
|
+
}
|
|
2265
2346
|
|
|
2266
2347
|
function bobe(fragments, ...values) {
|
|
2267
2348
|
const ui = function ui(isSub) {
|