From 00e0fbc09dfe6d8817a3a4531b5944c5087a7417 Mon Sep 17 00:00:00 2001 From: Levent Erkok Date: Tue, 3 Dec 2024 19:05:24 -0800 Subject: [PATCH] Keep bars as part of the token --- Data/SBV/Utils/SExpr.hs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Data/SBV/Utils/SExpr.hs b/Data/SBV/Utils/SExpr.hs index dc5a9205f..fd87aa471 100644 --- a/Data/SBV/Utils/SExpr.hs +++ b/Data/SBV/Utils/SExpr.hs @@ -58,9 +58,10 @@ tokenize inp = go inp [] go (':':cs) sofar = case break (`elem` stopper) cs of (pre, rest) -> go rest ((':':pre) : sofar) - go ('|':r) sofar = case span (/= '|') r of - (pre, '|':rest) -> go rest (pre : sofar) - (pre, rest) -> go rest (pre : sofar) + go ('|':r) sofar = let wrap s = '|' : s ++ "|" + in case span (/= '|') r of + (pre, '|':rest) -> go rest (wrap pre : sofar) + (pre, rest) -> go rest (wrap pre : sofar) go ('"':r) sofar = go rest (finalStr : sofar) where grabString [] acc = (reverse acc, []) -- Strictly speaking, this is the unterminated string case; but let's ignore