From 081237c27b912723438f498ffaa53a079a597b1b Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 22 Apr 2021 13:53:11 -0400 Subject: Move glyph list to src/glyphs.bqn --- md.bqn | 7 ++++--- src/glyphs.bqn | 6 ++++++ src/pr.bqn | 6 +----- test/ref.bqn | 6 +----- 4 files changed, 12 insertions(+), 13 deletions(-) create mode 100644 src/glyphs.bqn diff --git a/md.bqn b/md.bqn index dd24f240..bc0a65d7 100644 --- a/md.bqn +++ b/md.bqn @@ -542,12 +542,13 @@ idChars ← ⟨ # (include will be all 1s). GetHighlights ← { # Characters used by BQN, and the HTML class they are associated with. + func‿mod1‿mod2 ← •Import "src/glyphs.bqn" classes‿chars ← <˘ ⍉ ∘‿2⥊⟨ 0 , " "∾@+9‿10 # Should never be highlighted "Value" , ¯1⊏˘5‿2⥊"𝕨𝕩𝕗𝕘𝕤"# Hack around UTF-16 - "Function" , "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!"∾¯1⊏˘5‿2⥊"𝕎𝕏𝔽𝔾𝕊" - "Modifier" , "˙˜˘¨⌜⁼´˝`" - "Modifier2" , "∘○⊸⟜⌾⊘◶⎉⚇⍟⎊" + "Function" , func∾¯1⊏˘5‿2⥊"𝕎𝕏𝔽𝔾𝕊" + "Modifier" , mod1 + "Modifier2" , mod2 "Number" , ∾idChars # Will be classified among ↑↑ later "Gets" , "←⇐↩→" "Paren" , "()" diff --git a/src/glyphs.bqn b/src/glyphs.bqn new file mode 100644 index 00000000..f252b8c4 --- /dev/null +++ b/src/glyphs.bqn @@ -0,0 +1,6 @@ +# BQN primitive glyphs: functions, 1-modifiers, 2-modifiers +⟨ + "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!" + "˙˜˘¨⌜⁼´˝`" + "∘○⊸⟜⌾⊘◶⎉⚇⍟⎊" +⟩ diff --git a/src/pr.bqn b/src/pr.bqn index 239f5674..e918518e 100755 --- a/src/pr.bqn +++ b/src/pr.bqn @@ -3,11 +3,7 @@ # Process BQN runtime # All primitives -chrs←⟨ - "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!" - "˙˜˘¨⌜⁼´˝`" - "∘○⊸⟜⌾⊘◶⎉⚇⍟⎊" -⟩ +chrs←•Import "glyphs.bqn" glyphs ⇐ ∾chrs # Provided values, to be passed in through the constants array diff --git a/test/ref.bqn b/test/ref.bqn index 2eb79d5d..b7fb8c3a 100644 --- a/test/ref.bqn +++ b/test/ref.bqn @@ -13,11 +13,7 @@ defTok ← (¯1+`·¬·»⊸∧∊⟜idChars)⊸⊔¨ defs depend ← <∘/˘ range ∧ > (names∊LC¨)¨ (0=·+`·-˝"{"‿"}"≡⌜⊢)⊸/¨defTok order ← {{(𝕨⊸∨𝕊⍟(𝕩<○≠⊢)𝕩∾/)(0»∨`)⊸<𝕨<∧´∘⊏⟜𝕨¨l}⟜/0¨l←𝕩} depend -chrs←⟨ - "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!" - "˙˜˘¨⌜⁼´˝`" - "∘○⊸⟜⌾⊘◶⎉⚇⍟⎊" -⟩ +chrs ← •Import "../src/glyphs.bqn" def‿keep ← ⊑¨⌾(1⊸⊑) (1=≠)¨⊸⊔ anames keep∾↩"⌾⎊" -- cgit v1.2.3