From 2a95b07d3c6ce62d6c3e92d1a2e54a2a1799a79c Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 6 Sep 2020 10:47:42 -0400 Subject: Create character sets as ranges --- md.bqn | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/md.bqn b/md.bqn index 6de6b2d8..1698bf22 100644 --- a/md.bqn +++ b/md.bqn @@ -95,6 +95,13 @@ Trace ← { # Join lines with newline characters. Include a trailing newline. JoinLines ← ∾ ∾⟜lf¨ +# Given a list of begin-end pairs run together, return a list +Ranges ← { + R ← {𝕨+↕𝕩¬𝕨} # Single range + 𝕩 ↩ ∘‿2 ⥊ 𝕩 # Reshape into pairs + ∾ R¨˝˘ 𝕩 +} + # Create an html node from a tag name and interior text. Html ← {open 𝕊 contents: close ← (⊑open⊐" ") ↑ open @@ -120,7 +127,7 @@ UTF32 ← { }⍟(2=≠"𝕩")∘-⟜@ UTF8 ← ∾ (2⋆7) (⊣+(2⋆6){𝕨 ≤◶⟨⥊⊢-2×-⟜𝕗 ⋄ 𝕗(|∾˜(2÷˜⌊⟜𝕨)𝕊⌊∘÷˜)⊢⟩ 𝕩}¨) UTF32 Base64 ← { - b64←"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + b64 ← Ranges "AZaz09++//" b←3|↕l←≠u←UTF8 𝕩 M←((0<↕4)⥊˜≠)⊸× (1+0=b)⊸/ v←(4⋆1+b) ((⌊∘÷˜) 1⊸⌽⊸+○M (64÷⊣)×|) u @@ -295,7 +302,7 @@ Markdown ← {filename𝕊𝕩: # Inline elements ProcInline ← { I2M ← (≠𝕩) ↑ /⁼ # Index to mask - punc ← 𝕩 ∊ "!""#$%&'()*+,-./:;<=>?@[\]^_`{|}~" + punc ← 𝕩 ∊ Ranges "!/:@[`{~" actual ← ¬ punc ∧ IsEscaped 𝕩 # backtick or *actual* backtick? # Code spans -- cgit v1.2.3