diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-13 17:11:46 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-07-13 17:30:24 -0400 |
| commit | 5d3abc4bf6f6609cb452c669ddec89279d601113 (patch) | |
| tree | 9a4752f6b1ce67e5ddcaa412bffa9ebc862d8df9 | |
| parent | aaac31f1668fe5516902ee7d2034e5c0e41667a6 (diff) | |
Flatten computation of whether to show result
| -rw-r--r-- | md.bqn | 27 |
1 files changed, 14 insertions, 13 deletions
@@ -215,22 +215,23 @@ Markdown ← {filename𝕊𝕩: addRslt ← ∧´ ' ' = ∾ 4 (⌊⟜≠ ↑ ⊢)¨ 𝕩 r‿ri ← { ¬addRslt ? ⋈˜⟨⟩ ; - # Find the top-level separators sep + # Top-level separators are those not inside brackets m ← NotCommentOrString code depth ← +` m × "(){}⟨⟩[]" (⊣(≠⊸>×·¬⊸-2|⊢)⊐) code - sep ← (0=depth) ∧ m ∧ code∊"⋄,"∾lf - # Divide code - gr ← (1+´sl) ∾˜ (⊢-˜+`׬) sl←sep∧lf=code - # Don't show assignment results by default - ShowRslt ← { - c ← (¬ ∨`⌾⌽ 𝕨) / 𝕩 - g ← c∊"←↩" - (⊑g⊐1) (<⟜(≠g))◶⟨1,¬(" "∾∾idChars)∧´∘∊˜↑⟩ c - } + sep ← (0=depth) ∧ m ∧ code∊"⋄,"∾lf # Top-level separators + break ← sep∧lf=code # Mask of line breaks + # Grouping argument to split lines + ! 1=¯1⊑break + gr ← (⊢-˜+`׬) break + # Don't show assignment result + a ← code∊"←↩" ⋄ id ← code∊" "∾∾idChars + sa ← a ∧ ¬(¬sep) PrecedesGroup id∨a # Silent assignment + show ← ¬ break / sa PrecedesGroup ¬sa∨»sep + # Evaluate + E ← ⊣◶⟨"",(⥊∾⟜lf⎉1)∘Fmt⊢⟩⟜CodeExec ShowErr ← lf∾˜"span class='Error'"Html"Error: "∾(∧`lf⊸≠)⊸/⎊•Repr - E ← ShowRslt ⊣◶⟨"",(⥊∾⟜lf⎉1)∘Fmt∘⊢⟩ CodeExec∘⊢ - r ← (gr⊔sep) E⎊(ShowErr∘•CurrentError⊢)⍟(0<≠∘⊢)¨ gr⊔code - ⟨r, /sl∾1⟩ + r ← show E⎊(ShowErr∘•CurrentError⊢)⍟(0<≠∘⊢)¨ gr⊔code + ⟨r, /break⟩ } Link ← { |
