Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Alex D
GHC
Commits
9e4bf486
Commit
9e4bf486
authored
May 29, 2001
by
sof
Browse files
[project @ 2001-05-29 01:07:00 by sof]
Deal with nested comments (HDirect sources showed up this bug)
parent
15a7e6ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/compiler/main/GetImports.hs
View file @
9e4bf486
-----------------------------------------------------------------------------
-- $Id: GetImports.hs,v 1.
6
2001/05/
01 16
:0
1
:0
6
s
imonmar
Exp $
-- $Id: GetImports.hs,v 1.
7
2001/05/
29 01
:0
7
:0
0
s
of
Exp $
--
-- GHC Driver program
--
...
...
@@ -82,7 +82,7 @@ clean s
keep
acc
(
'
\'
'
:
cs
)
=
cons
acc
(
squote
cs
)
keep
acc
(
'-'
:
'-'
:
cs
)
=
cons
acc
(
linecomment
cs
)
keep
acc
(
'{'
:
'-'
:
'#'
:
' '
:
cs
)
=
cons
acc
(
cons
"#-{"
(
keep
""
cs
))
keep
acc
(
'{'
:
'-'
:
cs
)
=
cons
acc
(
runcomment
cs
)
-- -}
keep
acc
(
'{'
:
'-'
:
cs
)
=
cons
acc
(
runcomment
(
0
::
Int
)
cs
)
-- -}
keep
acc
(
c
:
cs
)
=
keep
(
c
:
acc
)
cs
cons
[]
xs
=
xs
...
...
@@ -108,6 +108,9 @@ clean s
linecomment
(
c
:
cs
)
=
linecomment
cs
-- in a running comment
runcomment
[]
=
[]
runcomment
(
'-'
:
'}'
:
cs
)
=
keep
""
cs
runcomment
(
c
:
cs
)
=
runcomment
cs
runcomment
_
[]
=
[]
runcomment
n
(
'{'
:
'-'
:
cs
)
=
runcomment
(
n
+
1
)
cs
-- catches both nested comments and pragmas.
runcomment
n
(
'-'
:
'}'
:
cs
)
|
n
==
0
=
keep
""
cs
|
otherwise
=
runcomment
(
n
-
1
)
cs
runcomment
n
(
c
:
cs
)
=
runcomment
n
cs
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment