From 2469a22708110e1a03dc48fc0b65c1541e099102 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Tue, 12 May 2020 17:36:00 -0700 Subject: [PATCH 1/3] improve performance of `string` --- src/Text/Parsing/Parser/String.purs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Text/Parsing/Parser/String.purs b/src/Text/Parsing/Parser/String.purs index e916399..a5deb01 100644 --- a/src/Text/Parsing/Parser/String.purs +++ b/src/Text/Parsing/Parser/String.purs @@ -9,7 +9,7 @@ import Data.Array (many) import Data.Foldable (elem, notElem) import Data.Maybe (Maybe(..)) import Data.Newtype (wrap) -import Data.String (Pattern, length) +import Data.String (Pattern) import Data.String as S import Data.String.CodeUnits as SCU import Text.Parsing.Parser (ParseState(..), ParserT, fail) @@ -20,14 +20,14 @@ import Text.Parsing.Parser.Pos (updatePosString) -- | operations which this modules needs. class StringLike s where drop :: Int -> s -> s - indexOf :: Pattern -> s -> Maybe Int + stripPrefix :: Pattern -> s -> Maybe s null :: s -> Boolean uncons :: s -> Maybe { head :: Char, tail :: s } instance stringLikeString :: StringLike String where uncons = SCU.uncons drop = S.drop - indexOf = S.indexOf + stripPrefix = S.stripPrefix null = S.null -- | Match end-of-file. @@ -40,10 +40,10 @@ eof = do string :: forall s m. StringLike s => Monad m => String -> ParserT s m String string str = do input <- gets \(ParseState input _ _) -> input - case indexOf (wrap str) input of - Just 0 -> do + case stripPrefix (wrap str) input of + Just remainder -> do modify_ \(ParseState _ position _) -> - ParseState (drop (length str) input) + ParseState remainder (updatePosString position str) true pure str From ea09f09ae92581573a766cbe4679f6db37714109 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Wed, 13 May 2020 13:41:22 -0700 Subject: [PATCH 2/3] bump purescript-strings --- bower.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bower.json b/bower.json index a98673c..4581c16 100644 --- a/bower.json +++ b/bower.json @@ -27,7 +27,7 @@ "purescript-integers": "^4.0.0", "purescript-lists": "^5.0.0", "purescript-maybe": "^4.0.0", - "purescript-strings": "^4.0.0", + "purescript-strings": "^4.0.2", "purescript-transformers": "^4.1.0", "purescript-unicode": "^4.0.0" }, From 721f15d36b2f6db9b8799353c7c565b1f98115ae Mon Sep 17 00:00:00 2001 From: Thomas Honeyman Date: Wed, 9 Dec 2020 16:16:31 -0800 Subject: [PATCH 3/3] Update bower.json --- bower.json | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bower.json b/bower.json index 4581c16..5d15ba6 100644 --- a/bower.json +++ b/bower.json @@ -8,7 +8,7 @@ "license": "BSD-3-Clause", "repository": { "type": "git", - "url": "git://github.com/purescript-contrib/purescript-parsing.git" + "url": "https://github.com/purescript-contrib/purescript-parsing.git" }, "ignore": [ "**/.*", @@ -20,20 +20,20 @@ "package.json" ], "dependencies": { - "purescript-arrays": "^5.0.0", - "purescript-either": "^4.0.0", - "purescript-foldable-traversable": "^4.0.0", - "purescript-identity": "^4.0.0", - "purescript-integers": "^4.0.0", - "purescript-lists": "^5.0.0", - "purescript-maybe": "^4.0.0", - "purescript-strings": "^4.0.2", - "purescript-transformers": "^4.1.0", - "purescript-unicode": "^4.0.0" + "purescript-arrays": "master", + "purescript-either": "master", + "purescript-foldable-traversable": "master", + "purescript-identity": "master", + "purescript-integers": "master", + "purescript-lists": "master", + "purescript-maybe": "master", + "purescript-strings": "master", + "purescript-transformers": "master", + "purescript-unicode": "master" }, "devDependencies": { - "purescript-assert": "^4.0.0", - "purescript-console": "^4.1.0", - "purescript-psci-support": "^4.0.0" + "purescript-assert": "master", + "purescript-console": "master", + "purescript-psci-support": "master" } }