From 6add955f34aaabc5a60dcb6578538387846a08a3 Mon Sep 17 00:00:00 2001 From: simonmar Date: Wed, 8 May 2002 13:37:25 +0000 Subject: [haddock @ 2002-05-08 13:37:25 by simonmar] Change the markup for typewriter-font from [...] to @...@. The reasoning is that the '@' symbol is much less likely to be needed than square brackets, and we don't want to have to escape square brackets in code fragments. This will be mildly painful in the short term, but it's better to get the change out of the way as early as possible. --- src/HaddockLex.hs | 2 +- src/HaddockParse.y | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/HaddockLex.hs b/src/HaddockLex.hs index 237d13a3..c7506ed3 100644 --- a/src/HaddockLex.hs +++ b/src/HaddockLex.hs @@ -11,7 +11,7 @@ module HaddockLex ( import Char -special = "\'\"/[]" +special = '`' : '\'' : '\"' : '@' : [] data Token = TokPara diff --git a/src/HaddockParse.y b/src/HaddockParse.y index 87fb1af6..dfb1a116 100644 --- a/src/HaddockParse.y +++ b/src/HaddockParse.y @@ -8,10 +8,10 @@ import HaddockTypes %tokentype { Token } %token SQUO { TokSpecial '\'' } + BQUO { TokSpecial '`' } DQUO { TokSpecial '\"' } '/' { TokSpecial '/' } - '[' { TokSpecial '[' } - ']' { TokSpecial ']' } + '@' { TokSpecial '@' } URL { TokURL $$ } '*' { TokBullet } '(n)' { TokNumber } @@ -60,8 +60,21 @@ elem :: { ParsedDoc } | '/' STRING '/' { DocEmphasis (DocString $2) } | URL { DocURL $1 } | SQUO STRING SQUO { DocIdentifier $2 } + | BQUO STRING SQUO { DocIdentifier $2 } + | DQUO STRING DQUO { DocModule $2 } + | '@' seq1 '@' { DocMonospaced $2 } + +seq1 :: { ParsedDoc } + : elem1 seq1 { docAppend $1 $2 } + | elem1 { $1 } + +elem1 :: { ParsedDoc } + : STRING { DocString $1 } + | '/' STRING '/' { DocEmphasis (DocString $2) } + | URL { DocURL $1 } + | SQUO STRING SQUO { DocIdentifier $2 } + | BQUO STRING SQUO { DocIdentifier $2 } | DQUO STRING DQUO { DocModule $2 } - | '[' seq ']' { DocMonospaced $2 } { happyError :: [Token] -> Either String a -- cgit v1.2.3