Skip to content

Commit c68b653

Browse files
committed
🚸 Add ctx to atoms
1 parent dbb70a3 commit c68b653

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎src/spark/parse.gleam

+3-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ fn primary() -> Parser(ast.Expression) {
192192

193193
fn atom() -> Parser(ast.Expression) {
194194
use name <- do(atom_name())
195-
use payload <- do(
195+
use payload <- do_in(
196+
ctx.InAtom,
196197
chomp.one_of([
197198
{
198199
use _ <- do(chomp.token(token.LParen))
@@ -205,7 +206,7 @@ fn atom() -> Parser(ast.Expression) {
205206
return([payload])
206207
},
207208
])
208-
|> chomp.or([]),
209+
|> chomp.or([]),
209210
)
210211
return(ast.Atom(name, payload))
211212
}

‎src/spark/parse/ctx.gleam

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub type Ctx {
1111
InLet(String)
1212
InList
1313
InRecord
14+
InAtom
1415
InLambda
1516
InBackpass
1617
InCase
@@ -47,6 +48,7 @@ fn ctx_to_string(pair: #(lexer.Span, Ctx)) -> String {
4748
InLet(name) -> "in let `" <> ansi.blue(name) <> "`"
4849
InList -> "inside a list"
4950
InRecord -> "inside a record"
51+
InAtom -> "inside an atom"
5052
InLambda -> "inside a lambda"
5153
InBackpass -> "inside a backpass"
5254
InCase -> "inside a case expression"

0 commit comments

Comments
 (0)