aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsimonmar <unknown>2002-05-08 13:37:25 +0000
committersimonmar <unknown>2002-05-08 13:37:25 +0000
commit6add955f34aaabc5a60dcb6578538387846a08a3 (patch)
treefff139c4f4cd50c05f2711f889a84bbb92ae572e
parenta2239cf5acf12f06d5e3c6b75ef80c9692344064 (diff)
[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.
-rw-r--r--src/HaddockLex.hs2
-rw-r--r--src/HaddockParse.y19
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