Add syntax sugar for lists
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
a8f07dd422
commit
3232d80376
|
@ -74,6 +74,16 @@ term = Parser.lazy (\() -> Parser.oneOf
|
|||
, item = term
|
||||
, trailing = Forbidden
|
||||
}
|
||||
, Parser.backtrackable
|
||||
<| Parser.map (List.foldr (\x xs -> Call "cons" [x, xs]) (Call "nil" []))
|
||||
<| Parser.sequence
|
||||
{ start = "["
|
||||
, separator = ","
|
||||
, end = "]"
|
||||
, spaces = Parser.spaces
|
||||
, item = term
|
||||
, trailing = Forbidden
|
||||
}
|
||||
, Parser.backtrackable <|
|
||||
Parser.succeed (\n -> Call n [])
|
||||
|= name
|
||||
|
|
Loading…
Reference in New Issue
Block a user