Skip to content

Commit beac8ed

Browse files
committed
Reader: commenting support.
1 parent 6b1b846 commit beac8ed

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

ngc/Reader.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type SExp =
3636
| List of SExp list
3737

3838
let ws parser = parser .>> spaces
39+
let commented parser = ws parser .>> (opt ((skipChar ';') .>> (skipRestOfLine true)))
3940
let list,listRef = createParserForwardedToRef()
4041

4142
let numberOptions =
@@ -77,7 +78,7 @@ let symbol = (many1Chars (letter <|> digit <|> symChars)) |>> Symbol
7778
let atom = (pnumber <|> string <|> symbol) |>> Atom
7879

7980
let listElement = choice [atom;list]
80-
let sexp = ws (pstring "(") >>. many (ws listElement) .>> ws (pstring ")") |>> List
81+
let sexp = commented (pstring "(") >>. many (commented listElement) .>> commented (pstring ")") |>> List
8182
let parser = many1 (choice [atom;sexp])
8283
do listRef := sexp
8384

0 commit comments

Comments
 (0)