diff options
author | simonmar <unknown> | 2003-08-19 09:09:03 +0000 |
---|---|---|
committer | simonmar <unknown> | 2003-08-19 09:09:03 +0000 |
commit | d5f6a4b53fdd82b8ff89687672a5e91a082b635d (patch) | |
tree | e29c28178d05894afd4b0b850b4edc00028e7317 /src | |
parent | ea54ebc01fc0a448ed523530a3a52271191337f1 (diff) |
[haddock @ 2003-08-19 09:09:03 by simonmar]
Further wibbles to the syntax.
Diffstat (limited to 'src')
-rw-r--r-- | src/HaddockLex.x | 12 | ||||
-rw-r--r-- | src/HaddockParse.y | 10 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/HaddockLex.x b/src/HaddockLex.x index 0c606bdf..feac18ab 100644 --- a/src/HaddockLex.x +++ b/src/HaddockLex.x @@ -34,12 +34,11 @@ $ident = [$alphanum \_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] $ws* { begin string } } --- beginning of a line: don't ignore whitespace, unless this is the start --- of a new paragraph. +-- beginning of a line <line> { $ws* \> { begin birdtrack } $ws* \n { token TokPara `andBegin` para } - () { begin string } + $ws* { begin string } } <birdtrack> .* \n? { strtoken TokBirdTrack `andBegin` line } @@ -50,8 +49,9 @@ $ident = [$alphanum \_\.\!\#\$\%\&\*\+\/\<\=\>\?\@\\\\\^\|\-\~] \#.*\# { strtoken $ \s -> TokAName (init (tail s)) } [\'\`] $ident+ [\'\`] { ident } \\ . { strtoken (TokString . tail) } - -- allow single-quotes to be literal if they don't surround identifiers - [\'\`] { strtoken TokString } + -- allow special characters through if they don't fit one of the previous + -- patterns. + [\'\`\<\#\\] { strtoken TokString } [^ $special \< \# \n \'\` \\]* \n { strtoken TokString `andBegin` line } [^ $special \< \# \n \'\` \\]+ { strtoken TokString } } @@ -83,7 +83,7 @@ alexGetChar (_, c:cs) = Just (c, (c,cs)) alexInputPrevChar (c,_) = c tokenise :: String -> [Token] -tokenise str = let toks = go ('\n',str) para in {- trace (show toks) -} toks +tokenise str = let toks = go ('\n',str) para in {-trace (show toks)-} toks where go inp@(_,str) sc = case alexScan inp sc of AlexEOF -> [] diff --git a/src/HaddockParse.y b/src/HaddockParse.y index e1a1cb8c..29b3b70a 100644 --- a/src/HaddockParse.y +++ b/src/HaddockParse.y @@ -65,15 +65,15 @@ seq1 :: { Doc } elem1 :: { Doc } : STRING { DocString $1 } - | '/' strings '/' { DocEmphasis $2 } + | '/' strings '/' { DocEmphasis (DocString $2) } | URL { DocURL $1 } | ANAME { DocAName $1 } | IDENT { DocIdentifier $1 } - | DQUO STRING DQUO { DocModule $2 } + | DQUO strings DQUO { DocModule $2 } -strings :: { Doc } - : STRING { DocString $1 } - | STRING strings { docAppend (DocString $1) $2 } +strings :: { String } + : STRING { $1 } + | STRING strings { $1 ++ $2 } { happyError :: [Token] -> Either String a |