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
Gesh
GHC
Commits
0c305dca
Commit
0c305dca
authored
28 years ago
by
sof
Browse files
Options
Downloads
Patches
Plain Diff
[project @ 1997-03-19 09:09:33 by sof]
Fixed to gracefully handle decl delims (;;) inside strings
parent
e060123a
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ghc/compiler/reader/Lex.lhs
+19
-8
19 additions, 8 deletions
ghc/compiler/reader/Lex.lhs
with
19 additions
and
8 deletions
ghc/compiler/reader/Lex.lhs
+
19
−
8
View file @
0c305dca
...
@@ -438,9 +438,9 @@ lex_keyword buf =
...
@@ -438,9 +438,9 @@ lex_keyword buf =
Just xx -> xx : lexIface (stepOverLexeme buf')
Just xx -> xx : lexIface (stepOverLexeme buf')
lex_decl buf =
lex_decl buf =
case
expandUntilMatch buf ";;" of
case
doDiscard False buf of -- spin until ;; is found
buf' ->
buf' ->
--
_trace (show (lexemeToString buf')) $
{-
_trace (show (lexemeToString buf')) $
-}
case currentChar# buf' of
case currentChar# buf' of
'\n'# -> -- newline, no id info.
'\n'# -> -- newline, no id info.
ITtysig (lexIface (lexemeToBuffer (decLexeme buf'))) :
ITtysig (lexIface (lexemeToBuffer (decLexeme buf'))) :
...
@@ -452,7 +452,7 @@ lex_decl buf =
...
@@ -452,7 +452,7 @@ lex_decl buf =
ITtysig (lexIface (lexemeToBuffer (decLexeme buf'))) :
ITtysig (lexIface (lexemeToBuffer (decLexeme buf'))) :
lexIface (stepOverLexeme buf')
lexIface (stepOverLexeme buf')
c -> -- run all over the id info
c -> -- run all over the id info
case
expandUntilMatch
(stepOverLexeme buf')
";;" of
case
doDiscard False
(stepOverLexeme buf')
of -- spin until ;; is found (outside a string!)
buf'' ->
buf'' ->
--_trace ((C# c):show (lexemeToString (decLexeme buf'))) $
--_trace ((C# c):show (lexemeToString (decLexeme buf'))) $
--_trace (show (lexemeToString (decLexeme buf''))) $
--_trace (show (lexemeToString (decLexeme buf''))) $
...
@@ -763,13 +763,24 @@ haskellKeywordsFM = listToUFM $
...
@@ -763,13 +763,24 @@ haskellKeywordsFM = listToUFM $
-- doDiscard rips along really fast looking for a double semicolon,
-- doDiscard rips along really fast looking for a double semicolon,
-- indicating the end of the pragma we're skipping
-- indicating the end of the pragma we're skipping
doDiscard buf =
doDiscard inStr buf =
-- _trace (show (C# (currentChar# buf))) $
case currentChar# buf of
case currentChar# buf of
';'# ->
';'# ->
case lookAhead# buf 1# of
if not inStr then
';'# -> stepOnBy# buf 2#
case lookAhead# buf 1# of
_ -> doDiscard (stepOn buf)
';'# -> incLexeme (incLexeme buf)
_ -> doDiscard (stepOn buf)
_ -> doDiscard inStr (incLexeme buf)
else
doDiscard inStr (incLexeme buf)
'"'# ->
case lookAhead# buf (negateInt# 1#) of --backwards, actually
'\\'# -> -- false alarm, escaped.
doDiscard inStr (incLexeme buf)
_ -> case inStr of -- forced to avoid build-up
True -> doDiscard False (incLexeme buf)
False -> doDiscard True (incLexeme buf)
_ -> doDiscard inStr (incLexeme buf)
\end{code}
\end{code}
...
...
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