Skip to content

Commit 23e55cd

Browse files
committed
Fix up capture
1 parent b555080 commit 23e55cd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

parser-typechecker/src/Unison/Util/Text/Pattern.hs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,11 @@ compile Eof !err !success = go
118118
compile (Literal txt) !err !success = go
119119
where
120120
go acc oc t =
121-
let next = Text.take (Text.size txt) t
122-
in if next == txt
121+
let candidate = Text.take (Text.size txt) t
122+
in if candidate == txt
123123
then
124124
let t' = Text.drop (Text.size txt) t
125-
in case Text.unsnoc next of
125+
in case Text.unsnoc candidate of
126126
Just (_, c) -> success acc (Just c) t'
127127
Nothing -> success acc oc t'
128128
else
@@ -135,7 +135,7 @@ compile (Char Any) !err !success = go
135135
compile (CaptureAs t p) !err !success = go
136136
where
137137
err' _ _ _ acc0 c0 t0 = err acc0 c0 t0
138-
success' _ _ rem acc0 c0 _ = success (pushCapture t acc0) c0 rem
138+
success' _ cr rem acc0 _ _ = success (pushCapture t acc0) cr rem
139139
compiled = compile p err' success'
140140
go acc c t = compiled acc c t acc c t
141141
compile (Capture (Many _ (Char Any))) !_ !success = \acc c t ->
@@ -145,7 +145,7 @@ compile (Capture (Many _ (Char Any))) !_ !success = \acc c t ->
145145
compile (Capture c) !err !success = go
146146
where
147147
err' _ _ _ acc0 c0 t0 = err acc0 c0 t0
148-
success' _ _ rem acc0 c0 t0 = success (pushCapture (Text.take (Text.size t0 - Text.size rem) t0) acc0) c0 rem
148+
success' _ cr rem acc0 _ t0 = success (pushCapture (Text.take (Text.size t0 - Text.size rem) t0) acc0) cr rem
149149
compiled = compile c err' success'
150150
go acc c t = compiled acc c t acc c t
151151
compile (Or p1 p2) err success = cp1

0 commit comments

Comments
 (0)