Also parse whole programs
Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
This commit is contained in:
parent
295c93e38a
commit
95c30b6891
|
@ -1,7 +1,7 @@
|
||||||
module Bergamot.Parser exposing (..)
|
module Bergamot.Parser exposing (..)
|
||||||
|
|
||||||
import Bergamot.Syntax exposing (Term(..), Metavariable)
|
import Bergamot.Syntax exposing (Term(..), Metavariable)
|
||||||
import Bergamot.Rules exposing (Rule)
|
import Bergamot.Rules exposing (Rule, RuleEnv)
|
||||||
|
|
||||||
import Parser exposing (Parser, Trailing(..), (|.), (|=))
|
import Parser exposing (Parser, Trailing(..), (|.), (|=))
|
||||||
import Set
|
import Set
|
||||||
|
@ -57,3 +57,16 @@ rule =
|
||||||
, item = term
|
, item = term
|
||||||
, trailing = Forbidden
|
, 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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user