Drop unreachable cases of updateDepth
All checks were successful
Test and Build / test (push) Successful in 2m27s
Test and Build / build (push) Successful in 1m39s

This commit is contained in:
James Eversole 2025-01-21 16:16:04 -06:00
parent 51b1eb070f
commit 42fce0ae43
2 changed files with 5 additions and 9 deletions

View File

@ -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]]]

View File

@ -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 ()