aboutsummaryrefslogtreecommitdiff
path: root/haddock-api/src/Haddock
diff options
context:
space:
mode:
authorŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-04 19:27:34 +0200
committerŁukasz Hanuszczak <lukasz.hanuszczak@gmail.com>2015-06-30 22:37:48 +0200
commitce0237fa8f482a64dc8ea3ec409a1482ac89e6ac (patch)
treedd598e5c79d74462e3cac22c96c2f4d986ca3ff9 /haddock-api/src/Haddock
parent4343f6c86225b6e283c73afcd8adc007fafebeff (diff)
Create scaffolding for Haskell source parser module.
Diffstat (limited to 'haddock-api/src/Haddock')
-rw-r--r--haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs36
1 files changed, 36 insertions, 0 deletions
diff --git a/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
new file mode 100644
index 00000000..11a92b57
--- /dev/null
+++ b/haddock-api/src/Haddock/Backends/Hyperlinker/Parser.hs
@@ -0,0 +1,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