From f4ae29e3f08cf06a0490bd9863e7a614116e30ac Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 2 Jun 2021 17:31:18 -0400 Subject: =?UTF-8?q?Support=20=F0=9D=95=A3=20as=20an=20ordinary=20subject?= =?UTF-8?q?=20special=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c.bqn | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/c.bqn b/src/c.bqn index dbb88662..3c8c219a 100644 --- a/src/c.bqn +++ b/src/c.bqn @@ -10,7 +10,7 @@ charSet‿cgl←(∾ ≍○< ≠¨)⟨ "‿" # Ligature "·" # nOthing # Use last character in case of UTF-16 (like dzaima/BQN) - ¯1⊏˘10‿∘⥊"𝕊𝕏𝕎𝔽𝔾𝕤𝕩𝕨𝕗𝕘" # Input (𝕣 pending; ℝ not allowed) + ¯1⊏˘11‿∘⥊"𝕊𝕏𝕎𝔽𝔾𝕤𝕩𝕨𝕣𝕗𝕘"# Input ".¯π∞" # Numeric '0'+↕10 # Digit "_"∾˜⥊"aA"+⌜↕na←26 # Alphabetic @@ -20,7 +20,7 @@ charSet‿cgl←(∾ ≍○< ≠¨)⟨ bF‿b1‿b2‿bS‿bG‿bB‿bL‿bO‿bX‿bN‿bD‿bA‿bW‿bP←≍¨˜⟜(0»+`)cgl M←1⊸⊑(0⊸≤∧>)-⟜⊑ # ∊ for an init,length pair 𝕩 as above sep←⊑bS -bI←5≍⟜-⊸+bX +bI←bX+≍⟜-5 Pl←∾⟜("s"/˜1<≠) # Pluralize _tmpl←{∾𝕗{𝕎𝕩}¨<𝕩} # Template # Convert characters to numbers, mostly the same as tokens @@ -31,7 +31,7 @@ CharCode←charSet{ } vd←1+vi←⊑bN # Start of identifier numbering (plus dot) -charRole←4∾˜∾⥊¨˜⟜(≠↑cgl˙)⟨1,2,3,¯1,¯3,¯1‿0,¯2,0,5/⌽↕2⟩ # For first vd chars +charRole←4∾˜∾⥊¨˜⟜(≠↑cgl˙)⟨1,2,3,¯1,¯3,¯1‿0,¯2,0,¬/5‿6⟩ # For first vd chars T←⌈`× ⋄ IT←↕∘≠⊸T ⋄ I1T←(1+↕∘≠)⊸T # Source to ⟨tokens, roles, number of identifiers, literals⟩ @@ -83,7 +83,7 @@ Tokenize←{System‿vars←𝕨 sk←sb/˜p>∨⟜«(p+(sb-p)⊏t)∊3‿5+⊑bB # Keep the first of each group that's not just inside a bracket t{ie/˜↩𝕨⋄𝕨Fs𝕩}˜↩1¨⌾(sk⊸⊏)t≠sep # Remove the rest r←ir⌾((t M vd≍+´2↑kk)⊸/)(vd⌊t)⊏charRole∾0 # Role - t+↩5×t M⟨⊑bX,5⟩ # Case-insensitive special names + t+↩(⊑bX)((⊢M≍⟜5)×5+3⊸+⊸≤)t # Case-insensitive special names t-↩vi(<+10×=)t # Shift . to bX and variables back one ⟨t,r,k,is,ie⟩ } @@ -146,7 +146,7 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn # Block properties PN←1(∾/∾˜)(∨/⊣)⋄H←b¬∘PN= # Which blocks have a property - sn←(0‿3‿4‿5+⊑bI)⍋𝕩⋄sp←/𝕩 M bI # Special name index + sn←(0‿3‿5‿6+⊑bI)⍋𝕩⋄sp←/𝕩 M bI # Special name index fx←1 H sn⋄fr←(fx∨0⊸<)⊸+ft←(2⊸H⌈2×3⊸H)sn # Block immediacy ¬fx and type ft "Special name outside of any block"_err_(/{(0=fi)∧𝕩 M bI}∘𝕩) 0<⊑fr fsc←(ft⊏0‿2‿3)+3×fx # Special name count @@ -185,7 +185,7 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn os←↕∘≠⊸(⊣-T)⌾⌽¬ro∨ma # Operator skip: distance rightward to derived function start at←1+⊏⟜os⊸+ai←/a⋄af←¯4≠ai⊏r⋄ar←at⊏r # Assignment target; af for actual (non-export) assignment "Role of the two sides in assignment must match"_err_(at⊏G) af∧ar≠0⌈at⊏er - aid←(¯5⊸≤∧<⟜nv)𝕩-vi # Assignable identifer + aid←(¯6⊸≤∧<⟜nv)𝕩-vi # Assignable identifer ak←af+(0≤ar)+(⊑bG)-˜ai⊏𝕩 # Class of assignment: 1⇐ 2⇐? 3←? 4↩? aa←×g⊏ac←»+`(»⊸∨0=+`)⊸×gi⊏«⊸-ak⌾(at⊸⊏)0¨𝕩 # ac broadcasts it to the entire target nf←b¬∘PN ac)ia∾sa # Opcode -- cgit v1.2.3