Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
obsidiansystems
GHC
Commits
609e7ddf
Commit
609e7ddf
authored
Nov 25, 2009
by
Ian Lynagh
Browse files
Tweak alternative layout rule
parent
259cb7dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/parser/Lexer.x
View file @
609e7ddf
...
...
@@ -1998,6 +1998,15 @@ alternativeLayoutRuleToken t
setALRContext (ALRLayout expectingOCurly thisCol : context)
setNextToken t
return (L thisLoc ITocurly)
-- We do the [] cases earlier than in the spec, as we
-- have an actual EOF token
(ITeof, ALRLayout _ _ : ls, _) ->
do setALRContext ls
setNextToken t
return (L thisLoc ITccurly)
(ITeof, _, _) ->
return t
-- the other ITeof case omitted; general case below covers it
(ITin, ALRLayout ALRLayoutLet _ : ls, _)
| newLine ->
do setPendingImplicitTokens [t]
...
...
@@ -2014,7 +2023,8 @@ alternativeLayoutRuleToken t
f ls' = ([], ls')
case f ls of
(t' : ts, ls') ->
do setPendingImplicitTokens ts
do setALRContext ls'
setPendingImplicitTokens ts
setNextToken t
return t'
_ -> panic "Layout rule: [] when considering newline"
...
...
@@ -2055,13 +2065,6 @@ alternativeLayoutRuleToken t
setPendingImplicitTokens [t]
return (L thisLoc ITccurly)
-- the other ITwhere case omitted; general case below covers it
-- The first [] case comes before the general case, as we
-- have an actual EOF token
(ITeof, ALRLayout _ _ : ls, _) ->
do setALRContext ls
setNextToken t
return (L thisLoc ITccurly)
-- the other ITeof case omitted; general case below covers it
(_, _, _) -> return t
isALRopen :: Token -> Bool
...
...
Write
Preview
Markdown
is supported
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