Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1 (again) with proper test #45

Merged
merged 2 commits into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
For the package version policy (PVP), see http://pvp.haskell.org/faq .

### 1.3.1.5

_2022-07-18, Andreas Abel_

- Allow dash (`-`) as start of a range, e.g. `[--z]`
([#1](https://github.com/haskell-hvr/regex-tdfa/issues/1),
[#45](https://github.com/haskell-hvr/regex-tdfa/pull/45))
- Tested with GHC 7.4 - 9.4

### 1.3.1.4

_2022-07-17, Andreas Abel_
Expand Down
3 changes: 3 additions & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
packages: .

write-ghc-environment-files: always
3 changes: 3 additions & 0 deletions lib/Text/Regex/TDFA.hs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ a '=~' b :: (String, String, String, [String])
>>> getAllTextMatches ("john anne yifan" =~ "[a-z]+") :: [String]
["john","anne","yifan"]

>>> getAllTextMatches ("* - . a + z" =~ "[--z]+") :: [String]
["-",".","a","z"]

@

= Feature support
Expand Down
4 changes: 2 additions & 2 deletions lib/Text/Regex/TDFA/ReadRegex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ p_bracket :: P Pattern
p_bracket = (char '[') >> ( (char '^' >> p_set True) <|> (p_set False) )

p_set :: Bool -> P Pattern
p_set invert = do initial <- (option "" ((char ']' >> return "]") <|> (char '-' >> return "-")))
p_set invert = do initial <- option "" (char ']' >> return "]")
values <- if null initial then many1 p_set_elem else many p_set_elem
_ <- char ']'
ci <- char_index
Expand Down Expand Up @@ -161,7 +161,7 @@ p_set_elem_coll = liftM BEColl $

p_set_elem_range :: P BracketElement
p_set_elem_range = try $ do
start <- noneOf "]-"
start <- noneOf "]"
_ <- char '-'
end <- noneOf "]"
return $ BERange start end
Expand Down
4 changes: 2 additions & 2 deletions regex-tdfa.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 1.12
name: regex-tdfa
version: 1.3.1.4
version: 1.3.1.5

build-Type: Simple
license: BSD3
Expand Down Expand Up @@ -46,7 +46,7 @@ source-repository head
source-repository this
type: git
location: https://github.com/haskell-hvr/regex-tdfa.git
tag: v1.3.1.4
tag: v1.3.1.5

flag force-O2
default: False
Expand Down