aboutsummaryrefslogtreecommitdiff
path: root/src/Haddock/Lex.x
diff options
context:
space:
mode:
authorsimon.hengel <simon.hengel@wiktory.org>2010-04-02 14:08:40 +0000
committersimon.hengel <simon.hengel@wiktory.org>2010-04-02 14:08:40 +0000
commit28bd97759174c9169b7633ee45d39c82fd069dd9 (patch)
tree676af721ca72c1058d3e7e4c2c27c90d37b4d095 /src/Haddock/Lex.x
parent0ff11e2b1d741e05d0fdb457ab104c8fc438d40b (diff)
Add markup support for interactive examples
Diffstat (limited to 'src/Haddock/Lex.x')
-rw-r--r--src/Haddock/Lex.x14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/Haddock/Lex.x b/src/Haddock/Lex.x
index 04b9f0c3..40ffbe92 100644
--- a/src/Haddock/Lex.x
+++ b/src/Haddock/Lex.x
@@ -45,6 +45,7 @@ $ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~]
<0,para> {
$ws* \n ;
$ws* \> { begin birdtrack }
+ $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr }
$ws* [\*\-] { token TokBullet `andBegin` string }
$ws* \[ { token TokDefStart `andBegin` def }
$ws* \( $digit+ \) { token TokNumber `andBegin` string }
@@ -66,6 +67,16 @@ $ident = [$alphanum \'\_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~]
<birdtrack> .* \n? { strtokenNL TokBirdTrack `andBegin` line }
+<example> {
+ $ws* \n { token TokPara `andBegin` para }
+ $ws* ghci \> { strtoken TokExamplePrompt `andBegin` exampleexpr }
+ () { begin exampleresult }
+}
+
+<exampleexpr> .* \n { strtokenNL TokExampleExpression `andBegin` example }
+
+<exampleresult> .* \n { strtokenNL TokExampleResult `andBegin` example }
+
<string,def> {
$special { strtoken $ \s -> TokSpecial (head s) }
\<\<.*\>\> { strtoken $ \s -> TokPic (init $ init $ tail $ tail s) }
@@ -108,6 +119,9 @@ data Token
| TokEmphasis String
| TokAName String
| TokBirdTrack String
+ | TokExamplePrompt String
+ | TokExampleExpression String
+ | TokExampleResult String
-- deriving Show
-- -----------------------------------------------------------------------------