Skip to content

Commit

Permalink
Tighten tradfn-related error conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
xelxebar committed Mar 9, 2024
1 parent 979c516 commit db2e905
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 3 additions & 3 deletions cmp/PS.apl
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ PS←{
'Non-Z top-level node'assert t[p=p]=Z:

Wrap all function expression bodies as Z nodes
_p[i]{end[]end[] gz¨1,¯1t[]=Z}i(t[p]T F)~t=L
'Non-Z/L dfns body node'assert t[t[p]=F]Z L:
_p[i]{end[]end[] gz¨1,¯1t[]=Z}i(t=L)<t[p]T F
'Non-Z/L fn body node'assert t[t[p]T F]Z L:

Parse the first line of a trad-fn as an H node
t[(p)t[p]=T]H
Expand All @@ -34,7 +34,7 @@ PS←{
0=i:0
nt'←(){};V'['←(){};'¨sym[|n[]]] k[nt'V']¯1
k[]0 n[]0
~msk(ntxnt';')'V;':'BAD LOCAL DECLARATION'SIGNAL SELECT mskx
msk2=0';V'ntxnt';':'BAD LOCAL DECLARATION'SIGNAL SELECT mskx
+('('=nt)-')'=ntxnt:'UNBALANCED HEADER'SIGNAL SELECT (nt)
tip[] kiti,,(nt) zt st¯2(''),''()nt
0=st:'EMPTY SIGNATURE'SIGNAL SELECT (nt)
Expand Down
3 changes: 3 additions & 0 deletions tests/t0099_parsing.apln
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,9 @@ ERRS←{⍺←⊢ ⋄ ⍵⍵::1 ⋄ 0⊣⍺ ⍺⍺ ⍵}
TAP t=CD.(F B V C F G A A F G A A)
⎕←''

TAP PARSE ERRS 2 NS '∇FN;' '∇'
TAP PARSE ERRS 2 NS '∇FN;A B' '∇'


:EndNamespace

0 comments on commit db2e905

Please sign in to comment.