Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Reinier Maas
GHC
Commits
adc81078
Commit
adc81078
authored
22 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
[haddock @ 2002-05-07 15:37:15 by simonmar]
Allow code blocks to be denoted with bird-tracks in addition to [...].
parent
65fc31db
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/HaddockLex.hs
+8
-2
8 additions, 2 deletions
src/HaddockLex.hs
src/HaddockParse.y
+7
-1
7 additions, 1 deletion
src/HaddockParse.y
with
15 additions
and
3 deletions
src/HaddockLex.hs
+
8
−
2
View file @
adc81078
...
...
@@ -20,6 +20,7 @@ data Token
|
TokSpecial
Char
|
TokString
String
|
TokURL
String
|
TokBirdTrack
deriving
Show
-- simple finite-state machine for tokenising the doc string
...
...
@@ -41,7 +42,8 @@ tokenise_url cs =
tokenise_newline
cs
=
case
dropWhile
nonNewlineSpace
cs
of
'
\n
'
:
cs
->
TokPara
:
tokenise_para
cs
-- paragraph break
_other
->
tokenise_string
"
\n
"
cs
'>'
:
cs
->
TokBirdTrack
:
tokenise
cs
-- bird track
_other
->
tokenise_string
"
\n
"
cs
tokenise_para
cs
=
case
dropWhile
nonNewlineSpace
cs
of
...
...
@@ -50,6 +52,8 @@ tokenise_para cs =
-- bullet: '-'
'-'
:
cs
->
TokBullet
:
tokenise
cs
-- enumerated item: '1.'
'>'
:
cs
->
TokBirdTrack
:
tokenise
cs
-- bird track
str
|
(
ds
,
'.'
:
cs
)
<-
span
isDigit
str
,
not
(
null
ds
)
->
TokNumber
:
tokenise
cs
-- enumerated item: '(1)'
...
...
@@ -72,5 +76,7 @@ tokenise_string str cs =
tokenise_string_newline
str
cs
=
case
dropWhile
nonNewlineSpace
cs
of
'
\n
'
:
cs
->
TokString
(
reverse
str
)
:
TokPara
:
tokenise_para
cs
_other
->
tokenise_string
(
'
\n
'
:
str
)
cs
-- don't throw away whitespace
'>'
:
cs
->
TokString
(
reverse
(
'
\n
'
:
str
))
:
TokBirdTrack
:
tokenise
cs
-- bird track
_other
->
tokenise_string
(
'
\n
'
:
str
)
cs
-- don't throw away whitespace
This diff is collapsed.
Click to expand it.
src/HaddockParse.y
+
7
−
1
View file @
adc81078
...
...
@@ -15,6 +15,7 @@ import HaddockTypes
URL { TokURL $$ }
'*' { TokBullet }
'(n)' { TokNumber }
'>' { TokBirdTrack }
PARA { TokPara }
STRING { TokString $$ }
...
...
@@ -44,9 +45,14 @@ olpara :: { ParsedDoc }
para :: { ParsedDoc }
: seq { docParagraph $1 }
| codepara { DocCodeBlock $1 }
codepara :: { ParsedDoc }
: '>' seq codepara { docAppend $2 $3 }
| '>' seq { $2 }
seq :: { ParsedDoc }
: elem seq {
D
ocAppend $1 $2 }
: elem seq {
d
ocAppend $1 $2 }
| elem { $1 }
elem :: { ParsedDoc }
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment