@cilix/lightjs 0.0.17 → 0.0.18
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/core.js +20 -4
- package/package.json +1 -1
package/core.js
CHANGED
|
@@ -392,7 +392,8 @@ module.exports = (config, fs, path) => {
|
|
|
392
392
|
"as",
|
|
393
393
|
"global",
|
|
394
394
|
"when",
|
|
395
|
-
"catch"
|
|
395
|
+
"catch",
|
|
396
|
+
"state"
|
|
396
397
|
];
|
|
397
398
|
|
|
398
399
|
const symbols = [
|
|
@@ -700,6 +701,12 @@ module.exports = (config, fs, path) => {
|
|
|
700
701
|
tok.type = c;
|
|
701
702
|
tok.data = c;
|
|
702
703
|
cursor++;
|
|
704
|
+
if (c === ':') {
|
|
705
|
+
if (prog[cursor] === '=') {
|
|
706
|
+
tok.type = tok.data = ':=';
|
|
707
|
+
cursor++;
|
|
708
|
+
}
|
|
709
|
+
}
|
|
703
710
|
} else {
|
|
704
711
|
tok.type = tok.data = c;
|
|
705
712
|
cursor++;
|
|
@@ -1240,8 +1247,16 @@ module.exports = (config, fs, path) => {
|
|
|
1240
1247
|
parent = current;
|
|
1241
1248
|
}
|
|
1242
1249
|
|
|
1250
|
+
function assignmentTok(ahead = 0) {
|
|
1251
|
+
return peek(':', ahead) || peek(':=', ahead) || peek('=', ahead);
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
function assignmentStart() {
|
|
1255
|
+
return peek('let') || peek('state');
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1243
1258
|
function isAssignment() {
|
|
1244
|
-
return
|
|
1259
|
+
return assignmentStart() || (peek('ident') && assignmentTok(1));
|
|
1245
1260
|
}
|
|
1246
1261
|
|
|
1247
1262
|
function parse_tag_list() {
|
|
@@ -1360,18 +1375,19 @@ module.exports = (config, fs, path) => {
|
|
|
1360
1375
|
|
|
1361
1376
|
function parse_assignment () {
|
|
1362
1377
|
const global = tok.data === 'global';
|
|
1363
|
-
if (peek('global') ||
|
|
1378
|
+
if (peek('global') || assignmentStart()) {
|
|
1364
1379
|
next();
|
|
1365
1380
|
}
|
|
1366
1381
|
let dst = { data: tok.data, pos: tok.pos, file: tok.file };
|
|
1367
1382
|
expect('ident');
|
|
1368
|
-
if (!
|
|
1383
|
+
if (!assignmentTok()) {
|
|
1369
1384
|
throw_error({
|
|
1370
1385
|
msg: 'expected assignment',
|
|
1371
1386
|
pos: tok.pos,
|
|
1372
1387
|
file: tok.file
|
|
1373
1388
|
});
|
|
1374
1389
|
}
|
|
1390
|
+
next();
|
|
1375
1391
|
let val = parse_rhs();
|
|
1376
1392
|
ast_node('set', {
|
|
1377
1393
|
global,
|