Also parse whole programs

Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
Danila Fedorin 2023-11-26 11:42:46 -08:00
parent 295c93e38a
commit 95c30b6891

View File

@ -1,7 +1,7 @@
module Bergamot.Parser exposing (..)
import Bergamot.Syntax exposing (Term(..), Metavariable)
import Bergamot.Rules exposing (Rule)
import Bergamot.Rules exposing (Rule, RuleEnv)
import Parser exposing (Parser, Trailing(..), (|.), (|=))
import Set
@ -57,3 +57,16 @@ rule =
, item = term
, trailing = Forbidden
}
program : Parser RuleEnv
program =
Parser.succeed (\rs -> { rules = rs })
|= Parser.sequence
{ start = ""
, separator = ";"
, end = ""
, spaces = Parser.spaces
, item = rule
, trailing = Mandatory
}
|. Parser.end