on master help sign in
Test a cast after an open paren, and reword the rest's example

lex-body-rest-bad-16 covers the plain case of a bracket opened earlier on the line: (^- @ud above x at the same depth stays an error. The example sentence in The rest of a body no longer opens with "So", which the next sentence uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01U4FzmThon6Q3x1uL8yUKEY

commit6b9ce23a0de42cbb33f81280f2936c95c3a8b72c authorClaude <noreply@anthropic.com> dateTue 3 Nov 2026, 03:08 (4 hours ago) parent138acf9
5 files changed+25−1
docs/spec/grammar.md+1−1 tests/golden/lex-body-rest-bad-16/about.txt+3 tests/golden/lex-body-rest-bad-16/source.jibb+3 tests/golden/lex-body-rest-bad-16/tokens.txt+15 tests/golden/lex-body-rest-bad-16/tree.txt+3
docs/spec/grammar.md+1−1
@@ -70,7 +70,7 @@ A rune's first children sit on its line, the last taking the rest of it; the oth
7070- a tall `|=`, `^-` or `~&`, or a chain of them such as `^- @ud ~& x`, when the line ends where the innermost rune's last child goes. That child is the rest, a body of its own: first its local `++` and `+$`, then its expression, whose own final line may do the same;
7171- a `?-` that begins the line and ends it with its subject. Its arms are the rest, one per line, so nothing follows them.
7272
73−So a gate's body can be `~& msg`, then `?- msg`, then its arms, all at one depth, and adding or removing the `~&` line moves no other line. This doesn't apply on a `?-` arm's line, on a line of an open bracket, after a bracket opened earlier on the line (the subject's included), at the top level, or to a definition's own expression. So `++ inner |= y=@ud` above `(inner x)`, `[a b] ?- a` above `%.y 1`, `^- @ud ?- x` above `%.y 1` and `++ g ?- x` above `%.y 1` stay errors.
73+A gate's body can then be `~& msg`, then `?- msg`, then its arms, all at one depth, and adding or removing the `~&` line moves no other line. This doesn't apply on a `?-` arm's line, on a line of an open bracket, after a bracket opened earlier on the line (the subject's included), at the top level, or to a definition's own expression. So `++ inner |= y=@ud` above `(inner x)`, `[a b] ?- a` above `%.y 1`, `^- @ud ?- x` above `%.y 1` and `++ g ?- x` above `%.y 1` stay errors.
7474
7575Only `|=` and `$-` have wide forms: `|=(sample expr)` and `$-(mold mold)`. Their children are operands, so calls inside need parentheses.
7676
tests/golden/lex-body-rest-bad-16/about.txtnew file+3
@@ -0,0 +1,3 @@
1+source: Grammar tab, Runes, The rest of a body: "This doesn't apply on a `?-` arm's line, on a line of an open bracket, after a bracket opened earlier on the line (the subject's included), at the top level, or to a definition's own expression."
2+tests: a cast after a `(` opened earlier on its line, alone there, with its expression on the next line at the same depth
3+expect: error at 3:3 — inside the ( no rune takes the lines after it, so the cast needs its expression on its line or deeper
tests/golden/lex-body-rest-bad-16/source.jibbnew file+3
@@ -0,0 +1,3 @@
1+++ f |= x=@ud
2+ (^- @ud
3+ x)
tests/golden/lex-body-rest-bad-16/tokens.txtnew file+15
@@ -0,0 +1,15 @@
1+1:1 glyph ++
2+1:4 name f
3+1:6 glyph |=
4+1:9 name x
5+1:10 tight glyph =
6+1:11 tight aura @ud
7+2:3 INDENT
8+2:3 glyph (
9+2:4 tight glyph ^-
10+2:7 aura @ud
11+3:3 NEWLINE
12+3:3 name x
13+3:4 tight glyph )
14+3:5 DEDENT
15+3:5 NEWLINE
tests/golden/lex-body-rest-bad-16/tree.txtnew file+3
@@ -0,0 +1,3 @@
1+/tests/golden/lex-body-rest-bad-16/source.jibb:3:3: expected an expression, or a body on deeper lines, found a line at the same depth
2+ x)
3+ ^