aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-10 22:03:57 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-08-10 22:03:57 -0400
commitafe7ed08468408a48970b389c31312cdc4ef5a0e (patch)
tree95bc44fcc4b4a0a1c4079c20de87b3be2af97369 /src
parent266c373d5a81273e1b3172ad6478b1a745b940ba (diff)
Correctly determine which bodies can use 𝕨
Diffstat (limited to 'src')
-rw-r--r--src/c.bqn3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/c.bqn b/src/c.bqn
index e5381371..1093cf61 100644
--- a/src/c.bqn
+++ b/src/c.bqn
@@ -175,6 +175,7 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn
hm←¬ho∨ha←ho<(0=hr)∧1=hn # Mask for main name; header arguments
"Invalid header structure"_err_(hm//∘HF) 1⊸»⊸=hm/hc
hm>↩hc⋄hr/˜↩hm⋄hx←(1»hc)/ha # Header-derived role hr and immediacy ¬hx
+ cw←(hc/»ha)⌾(ch⊸/)1+-⟜«cm×1«cf # Body 𝕨: 0 no, 1 allowed, 2 required
hl/˜↩hm⋄hm↩hm⌾(hf⊸/)hf
"Header left argument without right"_err_(/HF) ha>hc+`⊸⊏hx∾0
hx∨↩1=hr
@@ -233,7 +234,7 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn
nf←H ac<xv=vi-˜⊑bG # Namespace bodies
fw←H gi⊏nx # Bodies where 𝕨 must be defined
{"Can't return Nothing (·)"_err_(𝕩⊏⍋∘Rev) 2=fw⌈↩nf¬⊸×𝕩⊏nr} 1-˜0∾cc⊏rev
- "Invalid use of 𝕨 in monadic case"_err_(/CB) 1↓fw∧cf∧cm
+ "Invalid use of 𝕨 in monadic case"_err_(/CB) 1↓fw∧cw=0
nn←fo+`⊸⊏fw⋄no(⊣-=)↩nn⋄ne(⊣-=)↩nn # fw indicates 𝕨 is never Nothing
"Assignment target must be a name or list of targets"_err_(G) (a∨aid∨ps∨𝕩(=⟜(3+⊑)<M)bB)<aa
"Can't nest assignments (write aliases with ⇐)"_err_(ai⊏G) (ak=2)<ai⊏aa