Skip to content

Commit a7b022a

Browse files
committed
1 parent 0bcfeb4 commit a7b022a

File tree

9 files changed

+733
-19
lines changed

9 files changed

+733
-19
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ Breaking changes:
4646
New features:
4747

4848
- Add the `anyTill` primitive `String` combinator. (#186 by @jamesdbrock)
49+
- Add the `Parsing.String.Replace` module, copied from
50+
https://github.com/jamesdbrock/purescript-parsing-replace (#188 by @jamesdbrock)
4951

5052
Bugfixes:
5153

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ There are lots of other great monadic parsing tutorials on the internet.
130130
## Related Packages
131131

132132
- [__`parsing-dataview`__](https://pursuit.purescript.org/packages/purescript-parsing-dataview) primitive parsers for binary parsing of `ArrayBuffer`.
133-
- [__`parsing-replace`__](https://pursuit.purescript.org/packages/purescript-parsing-replace) for finding text patterns, and also replacing or splitting on the found patterns.
134133
- [__`datetime-parsing`__](https://pursuit.purescript.org/packages/purescript-datetime-parsing) for parsing dates and times.
135134

136135
## Documentation

bower.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"purescript-maybe": "master",
2525
"purescript-newtype": "master",
2626
"purescript-numbers": "master",
27+
"purescript-nullable": "main",
2728
"purescript-prelude": "master",
2829
"purescript-record": "master",
2930
"purescript-strings": "master",
@@ -35,6 +36,8 @@
3536
"purescript-unsafe-coerce": "master"
3637
},
3738
"devDependencies": {
38-
"purescript-assert": "master"
39+
"purescript-assert": "master",
40+
"purescript-effect": "master",
41+
"purescript-node-process": "master"
3942
}
4043
}

packages.dhall

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
let upstream =
22
https://raw.githubusercontent.com/purescript/package-sets/prepare-0.15/src/packages.dhall
3-
sha256:b1c6d06132b7cbf1e93b1e5343044fba1604b50bfbe02d8f80a3002e71569c59
43

54
in upstream

spago-dev.dhall

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ in conf //
1111
{ sources = [ "src/**/*.purs", "test/**/*.purs", "bench/**/*.purs" ]
1212
, dependencies = conf.dependencies #
1313
[ "assert"
14+
, "bifunctors"
1415
, "console"
1516
, "enums"
1617
, "effect"
1718
, "psci-support"
1819
, "minibench"
20+
, "node-process"
21+
, "nonempty"
1922
, "exceptions"
2023
, "string-parsers"
2124
, "partial"

spago.dhall

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
, dependencies =
55
[ "arrays"
66
, "control"
7+
, "effect"
78
, "either"
89
, "enums"
910
, "foldable-traversable"
@@ -15,14 +16,17 @@
1516
, "maybe"
1617
, "newtype"
1718
, "numbers"
19+
, "nullable"
1820
, "partial"
1921
, "prelude"
22+
, "st"
2023
, "strings"
2124
, "tailrec"
2225
, "transformers"
2326
, "tuples"
2427
, "unfoldable"
2528
, "unicode"
29+
, "unsafe-coerce"
2630
]
2731
, packages = ./packages.dhall
2832
, sources = [ "src/**/*.purs" ]

src/Parsing/String.purs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ anyChar :: forall m. ParserT String m Char
9898
anyChar = satisfy (const true)
9999

100100
-- | Match any Unicode character.
101-
-- | Always succeeds.
101+
-- | Always succeeds when any input remains.
102102
anyCodePoint :: forall m. ParserT String m CodePoint
103103
anyCodePoint = satisfyCodePoint (const true)
104104

@@ -290,9 +290,19 @@ consumeWith f = ParserT
290290
-- | Will fail if no section of the input is parseable. To backtrack the input
291291
-- | stream on failure, combine with `tryRethrow`.
292292
-- |
293+
-- | This combinator works like
294+
-- | [Data.String.takeWhile](https://pursuit.purescript.org/packages/purescript-strings/docs/Data.String#v:takeWhile)
295+
-- | or
296+
-- | [Data.String.Regex.search](https://pursuit.purescript.org/packages/purescript-strings/docs/Data.String.Regex#v:search)
297+
-- | and it allows using a parser for the pattern search.
298+
-- |
293299
-- | This combinator is equivalent to `manyTill_ anyCodePoint`, but it will be
294300
-- | faster because it returns a slice of the input `String` for the
295301
-- | section preceding the parse instead of a `List CodePoint`.
302+
-- |
303+
-- | Be careful not to look too far
304+
-- | ahead; if the phrase parser looks to the end of the input then `anyTill`
305+
-- | could be *O(n²)*.
296306
anyTill
297307
:: forall m a
298308
. Monad m

0 commit comments

Comments
 (0)