aboutsummaryrefslogtreecommitdiff
path: root/src/HaddockParse.y
diff options
context:
space:
mode:
authordavve <davve@dtek.chalmers.se>2006-07-10 19:09:23 +0000
committerdavve <davve@dtek.chalmers.se>2006-07-10 19:09:23 +0000
commit912edf6502ca514eb60e7210addb0f55a43a1c3d (patch)
treefc3c6f1101ed8cfa2f9410bf076b0b65887c1105 /src/HaddockParse.y
parentb79272f54d67bfecc2cfeed0d1b8171c790f63c6 (diff)
Initial modifications -- doesn't compile
Diffstat (limited to 'src/HaddockParse.y')
-rw-r--r--src/HaddockParse.y96
1 files changed, 0 insertions, 96 deletions
diff --git a/src/HaddockParse.y b/src/HaddockParse.y
deleted file mode 100644
index dbc97446..00000000
--- a/src/HaddockParse.y
+++ /dev/null
@@ -1,96 +0,0 @@
-{
-module HaddockParse (parseParas, parseString) where
-
-import HaddockLex
-import HsSyn
-}
-
-%tokentype { Token }
-
-%token '/' { TokSpecial '/' }
- '@' { TokSpecial '@' }
- '[' { TokDefStart }
- ']' { TokDefEnd }
- DQUO { TokSpecial '\"' }
- URL { TokURL $$ }
- ANAME { TokAName $$ }
- '-' { TokBullet }
- '(n)' { TokNumber }
- '>..' { TokBirdTrack $$ }
- IDENT { TokIdent $$ }
- PARA { TokPara }
- STRING { TokString $$ }
-
-%monad { Either String }
-
-%name parseParas doc
-%name parseString seq
-
-%%
-
-doc :: { Doc }
- : apara PARA doc { docAppend $1 $3 }
- | PARA doc { $2 }
- | apara { $1 }
- | {- empty -} { DocEmpty }
-
-apara :: { Doc }
- : ulpara { DocUnorderedList [$1] }
- | olpara { DocOrderedList [$1] }
- | defpara { DocDefList [$1] }
- | para { $1 }
-
-ulpara :: { Doc }
- : '-' para { $2 }
-
-olpara :: { Doc }
- : '(n)' para { $2 }
-
-defpara :: { (Doc,Doc) }
- : '[' seq ']' seq { ($2, $4) }
-
-para :: { Doc }
- : seq { docParagraph $1 }
- | codepara { DocCodeBlock $1 }
-
-codepara :: { Doc }
- : '>..' codepara { docAppend (DocString $1) $2 }
- | '>..' { DocString $1 }
-
-seq :: { Doc }
- : elem seq { docAppend $1 $2 }
- | elem { $1 }
-
-elem :: { Doc }
- : elem1 { $1 }
- | '@' seq1 '@' { DocMonospaced $2 }
-
-seq1 :: { Doc }
- : elem1 seq1 { docAppend $1 $2 }
- | elem1 { $1 }
-
-elem1 :: { Doc }
- : STRING { DocString $1 }
- | '/' strings '/' { DocEmphasis (DocString $2) }
- | URL { DocURL $1 }
- | ANAME { DocAName $1 }
- | IDENT { DocIdentifier $1 }
- | DQUO strings DQUO { DocModule $2 }
-
-strings :: { String }
- : STRING { $1 }
- | STRING strings { $1 ++ $2 }
-
-{
-happyError :: [Token] -> Either String a
-happyError toks =
- Left ("parse error in doc string: " ++ show (take 3 toks))
-
--- Either monad (we can't use MonadError because GHC < 5.00 has
--- an older incompatible version).
-instance Monad (Either String) where
- return = Right
- Left l >>= _ = Left l
- Right r >>= k = k r
- fail msg = Left msg
-}