aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/c.bqn9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/c.bqn b/src/c.bqn
index 3504cf80..b4a08c6e 100644
--- a/src/c.bqn
+++ b/src/c.bqn
@@ -233,11 +233,10 @@ 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←(¯6⊸≤∧<⟜nv)𝕩-vi # Assignable identifer
ak←af+(0≤ar)+(⊑bG)-˜ai⊏𝕩 # Class of assignment: 1⇐ 2⇐? 3←? 4↩?
at∾↩hj⋄ac←«⊸-(ak∾5¨hj)⌾(at⊸⊏)0¨𝕩 # Header assignment is 5 temporarily
aa←×g⊏ac↩»+`(1⊸»⊸∨0=+`)⊸×gi⊏ac # Broadcast ac to the entire target
- ac-↩2×ah←5=ac # Assignment is header; 5→3
+ ac-↩2×ah←5=ac⋄ah⊏˜↩g # Assignment is header; 5→3
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
@@ -245,8 +244,10 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn
(∨´(1↓fv)⊸<)◶"Invalid use of 𝕨 in monadic case"‿"Unreachable body"_err_(/CB) 1↓fw∧cw=0
cw⌈↩2×fw
nn←fo+`⊸⊏2=cw⋄no(⊣-=)↩nn⋄ne(⊣-=)↩nn # 2=cw indicates 𝕨 is never Nothing
- hq←/hp←(g⊏ah)∧𝕩≥nv+vi # Header constant
- "Assignment target must be a name or list of targets"_err_(G) (a∨aid∨hp∨(ps>«𝕩=⊑bL)∨𝕩(=⟜(3+⊑)<M)bB)<aa
+ aid←(¯6⊸≤∧<⟜nv)𝕩-vi # Assignable identifer
+ hq←/hp←ah∧𝕩≥nv+vi # Header constant
+ atc←(ah<ps<«aa∧r≥0)<aid∨hp∨(ps>«𝕩=⊑bL)∨𝕩(=⟜(3+⊑)<M)bB
+ "Assignment target must be a name or list of targets"_err_(G) (a∨atc)<aa
"Can't nest assignments (write aliases with ⇐)"_err_(ai⊏G) (ak=2)<ai⊏aa
"Can't use result of function/modifier assignment without parentheses"_err_(G) hg<(0<er)∧(0≤r)∧»⊸>aa
af>↩alm←ai⊏aa⋄al←alm/ai # aliases al