@nitro-bolt/scratchblocks 1.1.0 → 1.1.1
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/README.md +21 -22
- package/build/scratchblocks.min.es.js +2 -2
- package/build/scratchblocks.min.es.js.map +1 -1
- package/build/scratchblocks.min.js +2 -2
- package/build/scratchblocks.min.js.map +1 -1
- package/build/translations-all-es.js +1 -1
- package/build/translations-all.js +1 -1
- package/build/translations-es.js +1 -1
- package/build/translations.js +1 -1
- package/package.json +1 -1
- package/syntax/blocks.js +1 -0
- package/syntax/syntax.js +1 -38
package/build/translations-es.js
CHANGED
package/build/translations.js
CHANGED
package/package.json
CHANGED
package/syntax/blocks.js
CHANGED
package/syntax/syntax.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
function assert(bool, message) {
|
|
2
|
-
if (!bool) {
|
|
3
|
-
throw new Error(`Assertion failed! ${message || ""}`)
|
|
4
|
-
}
|
|
5
|
-
}
|
|
6
|
-
|
|
7
1
|
import {
|
|
8
2
|
Label,
|
|
9
3
|
Icon,
|
|
@@ -216,7 +210,6 @@ function parseLines(code, languages) {
|
|
|
216
210
|
}
|
|
217
211
|
}
|
|
218
212
|
}
|
|
219
|
-
let sawNL
|
|
220
213
|
|
|
221
214
|
let define = []
|
|
222
215
|
languages.map(lang => {
|
|
@@ -286,7 +279,7 @@ function parseLines(code, languages) {
|
|
|
286
279
|
case "{":
|
|
287
280
|
label = null
|
|
288
281
|
children.push(
|
|
289
|
-
peek() === "}" ? pEmptyTypedInput("object") :
|
|
282
|
+
peek() === "}" ? pEmptyTypedInput("object") : pWrappedBlock("object"),
|
|
290
283
|
)
|
|
291
284
|
break
|
|
292
285
|
case " ":
|
|
@@ -390,7 +383,6 @@ function parseLines(code, languages) {
|
|
|
390
383
|
}
|
|
391
384
|
const children = pParts(end)
|
|
392
385
|
if (tok && tok === "\n") {
|
|
393
|
-
sawNL = true
|
|
394
386
|
next()
|
|
395
387
|
}
|
|
396
388
|
if (children.length === 0) {
|
|
@@ -432,7 +424,6 @@ function parseLines(code, languages) {
|
|
|
432
424
|
next()
|
|
433
425
|
}
|
|
434
426
|
if (tok === "\n") {
|
|
435
|
-
sawNL = true
|
|
436
427
|
next()
|
|
437
428
|
}
|
|
438
429
|
return makeBlock(shape, children)
|
|
@@ -517,34 +508,6 @@ function parseLines(code, languages) {
|
|
|
517
508
|
return makeBlock("boolean", children)
|
|
518
509
|
}
|
|
519
510
|
|
|
520
|
-
function pEmbedded() {
|
|
521
|
-
next() // '{'
|
|
522
|
-
|
|
523
|
-
sawNL = false
|
|
524
|
-
const f = function () {
|
|
525
|
-
while (tok && tok !== "}") {
|
|
526
|
-
const block = pBlock("}")
|
|
527
|
-
if (block) {
|
|
528
|
-
return block
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
}
|
|
532
|
-
const scripts = parseScripts(f)
|
|
533
|
-
let blocks = []
|
|
534
|
-
scripts.forEach(script => {
|
|
535
|
-
blocks = blocks.concat(script.blocks)
|
|
536
|
-
})
|
|
537
|
-
|
|
538
|
-
if (tok === "}") {
|
|
539
|
-
next()
|
|
540
|
-
}
|
|
541
|
-
if (!sawNL) {
|
|
542
|
-
assert(blocks.length <= 1)
|
|
543
|
-
return blocks.length ? blocks[0] : makeBlock("stack", [])
|
|
544
|
-
}
|
|
545
|
-
return new Script(blocks)
|
|
546
|
-
}
|
|
547
|
-
|
|
548
511
|
function pIcon() {
|
|
549
512
|
const c = tok
|
|
550
513
|
next()
|