mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
Merge pull request #4790 from unisonweb/fix/pattern-many
Fix many pattern not backtracking
This commit is contained in:
commit
48f5a30854
@ -157,7 +157,7 @@ compile (Many p) !_ !success = case p of
|
||||
Char cp -> walker (charPatternPred cp)
|
||||
p -> go
|
||||
where
|
||||
go = compile p success success'
|
||||
go = try "Many" (compile p) success success'
|
||||
success' acc rem
|
||||
| Text.size rem == 0 = success acc rem
|
||||
| otherwise = go acc rem
|
||||
|
11
unison-src/transcripts/patterns.md
Normal file
11
unison-src/transcripts/patterns.md
Normal file
@ -0,0 +1,11 @@
|
||||
```ucm:hide
|
||||
.> builtins.merge
|
||||
```
|
||||
|
||||
Some tests of pattern behavior.
|
||||
|
||||
```unison
|
||||
p1 = join [literal "blue", literal "frog"]
|
||||
|
||||
> Pattern.run (many p1) "bluefrogbluegoat"
|
||||
```
|
28
unison-src/transcripts/patterns.output.md
Normal file
28
unison-src/transcripts/patterns.output.md
Normal file
@ -0,0 +1,28 @@
|
||||
Some tests of pattern behavior.
|
||||
|
||||
```unison
|
||||
p1 = join [literal "blue", literal "frog"]
|
||||
|
||||
> Pattern.run (many p1) "bluefrogbluegoat"
|
||||
```
|
||||
|
||||
```ucm
|
||||
|
||||
Loading changes detected in scratch.u.
|
||||
|
||||
I found and typechecked these definitions in scratch.u. If you
|
||||
do an `add` or `update`, here's how your codebase would
|
||||
change:
|
||||
|
||||
⍟ These new definitions are ok to `add`:
|
||||
|
||||
p1 : Pattern Text
|
||||
|
||||
Now evaluating any watch expressions (lines starting with
|
||||
`>`)... Ctrl+C cancels.
|
||||
|
||||
3 | > Pattern.run (many p1) "bluefrogbluegoat"
|
||||
⧩
|
||||
Some ([], "bluegoat")
|
||||
|
||||
```
|
Loading…
Reference in New Issue
Block a user