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