Skip to content

Commit e59af69

Browse files
committed
fix: sexp parser
1 parent a4201d7 commit e59af69

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/utils/sexp.ml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ let num =
2222
let num = String.of_seq chars |> int_of_string in
2323
Int num
2424

25-
let atom = ident <|> num <|> operator <?> "atom"
25+
let atom = token (ident <|> num <|> operator) <?> "atom"
2626

2727
let parens p = surround (token (char '(')) (token (char ')')) p <?> "parentheses"
2828

2929
let sexp =
3030
let call sexp = let+ vals = many sexp in Cons vals in
31-
fix (fun sexp -> parens (call sexp) <|> atom <?> "fix") <?> "sexp"
31+
fix (fun sexp -> (parens (call sexp) <|> atom) <?> "fix") <?> "sexp"
3232

33-
let parser = many sexp <* eof
33+
let parser = many sexp
3434

3535
let of_string s = parse_string parser s
3636

0 commit comments

Comments
 (0)