Drop unreachable cases of updateDepth
This commit is contained in:
parent
51b1eb070f
commit
42fce0ae43
@ -61,7 +61,7 @@ exampleOne = flatLOT [("1")
|
||||
[("2") [("4") t t] t]
|
||||
[("3") [("5") t t] [("6") t t]]]
|
||||
|
||||
exampleTwo = flatLOT [[("1")
|
||||
exampleTwo = flatLOT [("1")
|
||||
[("2") [("4") [("8") t t] [("9") t t]] [("6") [("10") t t] [("12") t t]]]
|
||||
[("3") [("5") [("11") t t] t] [("7") t t]]]
|
||||
|
||||
|
@ -25,14 +25,10 @@ satisfyM f = do
|
||||
return token
|
||||
|
||||
updateDepth :: LToken -> PState -> PState
|
||||
updateDepth LOpenParen st = st { parenDepth = parenDepth st + 1 }
|
||||
updateDepth LCloseParen st
|
||||
| parenDepth st > 0 = st { parenDepth = parenDepth st - 1 }
|
||||
| otherwise = errorWithoutStackTrace "Unmatched closing parentheses"
|
||||
updateDepth LOpenBracket st = st { bracketDepth = bracketDepth st + 1 }
|
||||
updateDepth LCloseBracket st
|
||||
| bracketDepth st > 0 = st { bracketDepth = bracketDepth st - 1 }
|
||||
| otherwise = errorWithoutStackTrace "Unmatched closing bracket"
|
||||
updateDepth LOpenParen st = st { parenDepth = parenDepth st + 1 }
|
||||
updateDepth LOpenBracket st = st { bracketDepth = bracketDepth st + 1 }
|
||||
updateDepth LCloseParen st = st { parenDepth = parenDepth st - 1 }
|
||||
updateDepth LCloseBracket st = st { bracketDepth = bracketDepth st - 1 }
|
||||
updateDepth _ st = st
|
||||
|
||||
topLevelNewline :: ParserM ()
|
||||
|
Loading…
x
Reference in New Issue
Block a user