aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
blob: 11a92b57315ac16d5de854cc749b9b3aa8555285 (plain) (blame)
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
module Haddock.Backends.Hyperlinker.Parser (parse) where

data Token = Token
    { tkType :: TokenType
    , tkValue :: String
    , tkSpan :: Span
    }

data Position = Position
    { posRow :: !Int
    , posCol :: !Int
    }

data Span = Span
    { spStart :: Position
    , spEnd :: Position
    }

data TokenType
    = Identifier
    | Comment
    | Whitespace
    | Operator
    | Symbol

parse :: String -> [Token]
parse = tokenize . tag . chunk

chunk :: String -> [String]
chunk = undefined

tag :: [String] -> [(Span, String)]
tag = undefined

tokenize :: [(Span, String)] -> [Token]
tokenize = undefined