@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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @nitro-bolt/scratchblocks v1.0.9
2
+ * @nitro-bolt/scratchblocks v1.1.0
3
3
  *
4
4
  * Make pictures of Scratch blocks from text.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @nitro-bolt/scratchblocks v1.0.9
2
+ * @nitro-bolt/scratchblocks v1.1.0
3
3
  *
4
4
  * Make pictures of Scratch blocks from text.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @nitro-bolt/scratchblocks v1.0.9
2
+ * @nitro-bolt/scratchblocks v1.1.0
3
3
  *
4
4
  * Make pictures of Scratch blocks from text.
5
5
  *
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @nitro-bolt/scratchblocks v1.0.9
2
+ * @nitro-bolt/scratchblocks v1.1.0
3
3
  *
4
4
  * Make pictures of Scratch blocks from text.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitro-bolt/scratchblocks",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Make pictures of Scratch blocks from text.",
5
5
  "license": "MIT",
6
6
  "author": "Tim Radvan",
package/syntax/blocks.js CHANGED
@@ -25,6 +25,7 @@ const overrideShapes = [
25
25
  "hat",
26
26
  "cap",
27
27
  "stack",
28
+ "c-block",
28
29
  "boolean",
29
30
  "reporter",
30
31
  "object",
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") : pEmbedded(),
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()