From f2453d619b259992163cfe3c42c62c331b62f1ad Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Thu, 26 Nov 2020 21:23:29 -0500 Subject: Swap names b and c to match begin and close comment --- src/c.bqn | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src') diff --git a/src/c.bqn b/src/c.bqn index 49abd62e..ee2d1e8d 100644 --- a/src/c.bqn +++ b/src/c.bqn @@ -129,10 +129,10 @@ Parse ← {r‿vn‿i‿e←𝕨⋄nv←≠vn gf←⍋fd←+`br←rev⊏p×𝕩M⟨2+⊑bB,2⟩ # Order by brace depth fd to de-nest blocks rev⊏˜↩gf⋄fd⊏˜↩gf⋄br⊏˜↩gf 𝕩⊏˜↩rev⋄p⊏˜↩rev⋄i⊏˜↩rev⋄e⊏˜↩rev - b←/br<0⋄fi←+`c←br>0 # Block Begin (index) and Close (mask), in matching order + fi←+`b←br>0⋄c←/br<0 # Block Begin (mask) and Close (index), in matching order # Block properties - H←¬1(∾/∾˜)c(∨/⊣)= # Which blocks have a property + H←¬1(∾/∾˜)b(∨/⊣)= # Which blocks have a property sn←(0‿3‿4‿5+5+⊑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 @@ -142,7 +142,7 @@ Parse ← {r‿vn‿i‿e←𝕨⋄nv←≠vn # Propagate roles through parentheses # ir is the role of the expression ending at each position (truncated to the right) - r↩sl-˜ns×(1↓fr)⌾((b⊏rev)⊸⊏)r # Add block roles; make strand elements ¯1 + r↩sl-˜ns×(1↓fr)⌾((c⊏rev)⊸⊏)r # Add block roles; make strand elements ¯1 pt←cp∧ns # Pass-through parentheses: not in strands pp←pt∧»es←1⊸»⌾(g⊸⊏)r<0 # Parens enclosing one object (maybe with assignment) don't change roles ir←((»⌾(g⊸⊏)(1+es)×3=⊢)⌈⊢-es<2≤⊢)r+pp×(IT¬pp)⊏r # Propagate modifier roles @@ -156,11 +156,11 @@ Parse ← {r‿vn‿i‿e←𝕨⋄nv←≠vn # Parsing part 1 p-↩br⋄g↩⍋+`p⋄gr←g⊏rev # Order by non-brace bracket depth sll←1+2÷˜0(<-○/>)gr⊏sr-sl⋄l←/g⊏𝕩=5+⊑bB # Strand length; list starts - bp←⟨b,/c⟩∾¨0(>≍○()g⊏p # Bracket pairs + {i↩(𝕨⊏i)⌾(𝕩⊸⊏)i⋄e↩(𝕩⊏e)⌾(𝕨⊸⊏)e}´bp # Highlight all contents of a pair when error reporting g⊏˜↩gs←⍋gr⊏sl⋄gr↩g⊏rev⋄gi←⍋g # Send strand prefixes *‿ to the end 𝕩⊏˜↩g⋄r⊏˜↩gr⋄ir⊏˜↩gr⋄l↩(l⊏⍋gs)∾/gr⊏sr>sl - ni←1+(1↓nf)/bk←b⊏gi # Indices of module assignment (import) arrows + ni←1+(1↓nf)/bk←c⊏gi # Indices of module assignment (import) arrows "Modules must be immediately assigned"_err_(ni⊏G)∘(∨˝¯3‿0‿¯1≠r∾⟜¯1‿1⊸(⊏˜)(↕3)+⌜⊢)⍟(0<≠)ni "Modules must be destructured"_err_(ni⊏G) (⊏⟜idm>⊏⟜rev⊏sr˙)(ni+1)⊏g a←r≤¯3⋄ps←a