mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-05-21 09:02:50 -06:00
Added readJSON error messages
This commit is contained in:
@@ -9,14 +9,24 @@ instance JSON Grammar where
|
|||||||
showJSON (Grammar name extends abstract concretes) =
|
showJSON (Grammar name extends abstract concretes) =
|
||||||
makeObj ["basename".=name, "extends".=extends,
|
makeObj ["basename".=name, "extends".=extends,
|
||||||
"abstract".=abstract, "concretes".=concretes]
|
"abstract".=abstract, "concretes".=concretes]
|
||||||
|
readJSON = error "Grammar.readJSON intentionally not defined"
|
||||||
|
|
||||||
instance JSON Abstract where
|
instance JSON Abstract where
|
||||||
showJSON (Abstract startcat cats funs) =
|
showJSON (Abstract startcat cats funs) =
|
||||||
makeObj ["startcat".=startcat, "cats".=cats, "funs".=funs]
|
makeObj ["startcat".=startcat, "cats".=cats, "funs".=funs]
|
||||||
|
readJSON = error "Abstract.readJSON intentionally not defined"
|
||||||
|
|
||||||
instance JSON Fun where showJSON (Fun name typ) = signature name typ
|
instance JSON Fun where
|
||||||
instance JSON Param where showJSON (Param name rhs) = definition name rhs
|
showJSON (Fun name typ) = signature name typ
|
||||||
instance JSON Oper where showJSON (Oper name rhs) = definition name rhs
|
readJSON = error "Fun.readJSON intentionally not defined"
|
||||||
|
|
||||||
|
instance JSON Param where
|
||||||
|
showJSON (Param name rhs) = definition name rhs
|
||||||
|
readJSON = error "Param.readJSON intentionally not defined"
|
||||||
|
|
||||||
|
instance JSON Oper where
|
||||||
|
showJSON (Oper name rhs) = definition name rhs
|
||||||
|
readJSON = error "Oper.readJSON intentionally not defined"
|
||||||
|
|
||||||
signature name typ = makeObj ["name".=name,"type".=typ]
|
signature name typ = makeObj ["name".=name,"type".=typ]
|
||||||
definition name rhs = makeObj ["name".=name,"rhs".=rhs]
|
definition name rhs = makeObj ["name".=name,"rhs".=rhs]
|
||||||
@@ -26,12 +36,15 @@ instance JSON Concrete where
|
|||||||
makeObj ["langcode".=langcode, "opens".=opens,
|
makeObj ["langcode".=langcode, "opens".=opens,
|
||||||
"params".=params, "opers".=opers,
|
"params".=params, "opers".=opers,
|
||||||
"lincats".=lincats, "lins".=lins]
|
"lincats".=lincats, "lins".=lins]
|
||||||
|
readJSON = error "Concrete.readJSON intentionally not defined"
|
||||||
|
|
||||||
instance JSON Lincat where
|
instance JSON Lincat where
|
||||||
showJSON (Lincat cat lintype) = makeObj ["cat".=cat, "type".=lintype]
|
showJSON (Lincat cat lintype) = makeObj ["cat".=cat, "type".=lintype]
|
||||||
|
readJSON = error "Lincat.readJSON intentionally not defined"
|
||||||
|
|
||||||
instance JSON Lin where
|
instance JSON Lin where
|
||||||
showJSON (Lin fun args lin) = makeObj ["fun".=fun, "args".=args, "lin".=lin]
|
showJSON (Lin fun args lin) = makeObj ["fun".=fun, "args".=args, "lin".=lin]
|
||||||
|
readJSON = error "Lin.readJSON intentionally not defined"
|
||||||
|
|
||||||
infix 1 .=
|
infix 1 .=
|
||||||
name .= v = (name,showJSON v)
|
name .= v = (name,showJSON v)
|
||||||
|
|||||||
Reference in New Issue
Block a user