Commit ffd6cfa0 authored by Camil Staps's avatar Camil Staps 🍃

Add ABC types for A and B stack offsets

parent e45bb044
......@@ -223,6 +223,8 @@ from Text.GenJSON import generic JSONEncode, generic JSONDecode, :: JSONNode
:: ABCArgumentType
= ABCTypeLabel
| ABCTypeAStackOffset
| ABCTypeBStackOffset
| ABCTypeBool
| ABCTypeChar
| ABCTypeInt
......
......@@ -34,12 +34,14 @@ derive gEq FunctionKind
JSONEncode{|ABCArgument|} _ (ABCArgument t r) = [JSONString (if r ("[" <+ type <+ "]") type)]
where
type = case t of
ABCTypeLabel -> "label"
ABCTypeBool -> "bool"
ABCTypeChar -> "char"
ABCTypeInt -> "int"
ABCTypeReal -> "real"
ABCTypeString -> "string"
ABCTypeLabel -> "label"
ABCTypeAStackOffset -> "A-offset"
ABCTypeBStackOffset -> "B-offset"
ABCTypeBool -> "bool"
ABCTypeChar -> "char"
ABCTypeInt -> "int"
ABCTypeReal -> "real"
ABCTypeString -> "string"
JSONDecode{|ABCArgument|} _ [JSONString s:r]
| size s > 0 && s.[0] == '[' && s.[size s-1] == ']'
......@@ -47,13 +49,15 @@ JSONDecode{|ABCArgument|} _ [JSONString s:r]
= (flip ABCArgument False <$> fromString s, r)
where
fromString s = case s of
"label" -> Just ABCTypeLabel
"bool" -> Just ABCTypeBool
"char" -> Just ABCTypeChar
"int" -> Just ABCTypeInt
"real" -> Just ABCTypeReal
"string" -> Just ABCTypeString
_ -> Nothing
"label" -> Just ABCTypeLabel
"A-offset" -> Just ABCTypeAStackOffset
"B-offset" -> Just ABCTypeBStackOffset
"bool" -> Just ABCTypeBool
"char" -> Just ABCTypeChar
"int" -> Just ABCTypeInt
"real" -> Just ABCTypeReal
"string" -> Just ABCTypeString
_ -> Nothing
JSONDecode{|ABCArgument|} _ json = (Nothing, json)
instance toInt CloogleError
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment