rewrite parser

previously it backtracked too much, so instead of giving a useful
parse error, it just said "expected end of input" at the beginning of
the problem toplevel. which, if it's a namespace, could be way off.
This commit is contained in:
rhiannon morris 2023-04-24 22:25:00 +02:00
parent 6c3b82ca64
commit b74ffa0077
6 changed files with 498 additions and 374 deletions

View file

@ -245,8 +245,8 @@ globalPQty pi = case choose $ isGlobal pi of
export
fromPNameNS : Has (StateL NS Mods) fs => PName -> Eff fs Name
fromPNameNS name = pure $ addMods !(getAt NS) $ fromPName name
fromPBaseNameNS : Has (StateL NS Mods) fs => PBaseName -> Eff fs Name
fromPBaseNameNS name = pure $ addMods !(getAt NS) $ fromPBaseName name
private
injTC : (Has (StateL DEFS Definitions) fs, Has (Except Error) fs) =>
@ -259,7 +259,7 @@ fromPDef : (Has (StateL DEFS Definitions) fs,
Has (Except Error) fs) =>
PDefinition -> Eff fs NDefinition
fromPDef (MkPDef qty pname ptype pterm) = do
name <- fromPNameNS pname
name <- fromPBaseNameNS pname
qtyGlobal <- globalPQty qty
let gqty = Element qty qtyGlobal
let sqty = globalToSubj gqty