~jojo/Carth

ref: 2219ea535f4a0fd0afd9000ba5c6918c6b276210 Carth/src/Lexd.hs -rw-r--r-- 809 bytes
2219ea53JoJo remove no longer applicable TODOs 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
{-# LANGUAGE LambdaCase, TypeSynonymInstances, FlexibleInstances
           , MultiParamTypeClasses, KindSignatures, DataKinds
           , DeriveDataTypeable #-}

module Lexd where

import SrcPos

data Const
    = Int Int
    | F64 Double
    | Str String
    deriving (Show, Eq)

data Keyword
    = Kcolon | Kdot
    | Kforall | KFun | KBox
    | Kdefine | KdefineColon
    | Kimport | Kextern | Kdata
    | Kfmatch | Kmatch | Kcase
    | Kif | Kfun
    | Klet1 | Klet | Kletrec
    | Ksizeof
    | KidAt | KIdAt
    | Kdefmacro
    deriving (Eq, Show)

data TokenTree'
    = Lit Const
    | Small String
    | Big String
    | Keyword Keyword
    | Parens [TokenTree]
    | Brackets [TokenTree]
    | Braces [TokenTree]
    | Ellipsis TokenTree
    deriving (Eq, Show)

type TokenTree = WithPos TokenTree'