Skip to content

Commit

Permalink
[ fix ] filter out spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
pigworker committed Oct 1, 2024
1 parent 5b3f078 commit 20326a1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Language/Ask/ChkRaw.hs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import Language.Ask.HardwiredRules
import Language.Ask.Progging

tracy = const id
tripe = trace
tripe = const id

type Anno =
( Status
Expand Down Expand Up @@ -765,6 +765,9 @@ chkParse :: Make () ParseThing -> AM (Make Anno ParseThing)
chkParse (Make Pse (ParseProb c sm) m () ss (ls, rs)) = do
let prods (Gram c' ps) | c == c' = ps
prods _ = []
visi (Spc, _, _) = []
visi (Ret, _, _) = []
visi t = [t]
subs :: [GramBit] -> Bloc (SubMake () ParseThing)
-> AM (Maybe [String],Bloc (SubMake Anno ParseThing))
subs [] (ns :-/ Stop) = pure (Just [], ns :-/ Stop)
Expand All @@ -777,7 +780,7 @@ chkParse (Make Pse (ParseProb c sm) m () ss (ls, rs)) = do
Make Pse (ParseProb c' qm) m a _ _
| c == c' -> case ((lexAll . read) <$> qm, m, a) of
(Just (_ :-/ ys :-\ _), By _, (Keep, True)) ->
(Just (fmap txt (ys >>= unLay)), x)
(Just (fmap txt (ys >>= unLay >>= visi)), x)
_ -> (Nothing, x)
Make z g m _ ss subs ->
(Nothing, Make z g m (Junk (ParseNotTheWanted c), False) ss subs)
Expand All @@ -804,7 +807,7 @@ chkParse (Make Pse (ParseProb c sm) m () ss (ls, rs)) = do
_ :-/ ys :-\ _ -> do
(qsm, ss) <- subs p ss
pure $ case qsm of
Just qs -> if fmap txt (ys >>= unLay) == qs
Just qs -> if fmap txt (ys >>= unLay >>= visi) == qs
then Make Pse (ParseProb c sm) m (Keep, True) ss (ls, rs)
else Make Pse (ParseProb c sm) m (Junk (ParseNoMake s), True) ss (ls, rs)
_ -> Make Pse (ParseProb c sm) m (Keep, False) ss (ls, rs)
Expand Down

0 comments on commit 20326a1

Please sign in to comment.