2016-02-04 21:59:33 +03:00
|
|
|
module Category where
|
2015-11-18 22:23:35 +03:00
|
|
|
|
2016-05-26 19:58:04 +03:00
|
|
|
import Prologue
|
2016-06-23 16:55:48 +03:00
|
|
|
import Data.Hashable
|
2016-05-26 19:58:04 +03:00
|
|
|
import Data.String
|
2015-11-18 22:23:35 +03:00
|
|
|
|
2016-02-05 00:35:42 +03:00
|
|
|
-- | A standardized category of AST node. Used to determine the semantics for
|
|
|
|
-- | semantic diffing and define comparability of nodes.
|
2016-06-04 01:32:21 +03:00
|
|
|
data Category
|
2016-06-04 01:34:42 +03:00
|
|
|
-- | The top-level branch node.
|
|
|
|
= Program
|
2016-06-04 01:37:40 +03:00
|
|
|
-- | A node indicating syntax errors.
|
|
|
|
| Error
|
2016-02-06 00:59:38 +03:00
|
|
|
-- | An operator with 2 operands.
|
2016-06-04 01:34:42 +03:00
|
|
|
| BinaryOperator
|
2016-02-05 00:35:42 +03:00
|
|
|
-- | A literal key-value data structure.
|
2016-02-06 00:59:38 +03:00
|
|
|
| DictionaryLiteral
|
2016-02-14 05:01:52 +03:00
|
|
|
-- | A pair, e.g. of a key & value
|
|
|
|
| Pair
|
2016-02-06 00:54:08 +03:00
|
|
|
-- | A call to a function.
|
|
|
|
| FunctionCall
|
2016-02-24 23:47:53 +03:00
|
|
|
-- | A string literal.
|
|
|
|
| StringLiteral
|
|
|
|
-- | An integer literal.
|
|
|
|
| IntegerLiteral
|
|
|
|
-- | A symbol literal.
|
|
|
|
| SymbolLiteral
|
2016-03-03 07:01:46 +03:00
|
|
|
-- | An array literal.
|
|
|
|
| ArrayLiteral
|
2016-02-05 00:35:42 +03:00
|
|
|
-- | A non-standard category, which can be used for comparability.
|
|
|
|
| Other String
|
2016-06-23 16:55:43 +03:00
|
|
|
deriving (Eq, Generic, Ord, Show)
|
2016-06-23 16:55:48 +03:00
|
|
|
|
|
|
|
|
2016-06-23 23:25:49 +03:00
|
|
|
-- Instances
|
|
|
|
|
2016-06-23 16:55:48 +03:00
|
|
|
instance Hashable Category
|