-
Notifications
You must be signed in to change notification settings - Fork 35
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
Remove dependency on pcre-light #12
Comments
I'm having a little trouble understanding the first group For reference here's the full regex re = compile "^([^?]+\\bvalues\\s*)\
\(\\(\\s*[?](?:\\s*,\\s*[?])*\\s*\\))\
\([^?]*)$"
[caseless] and my attoparsec implementation skipWhile1 f = satisfy f *> skipWhile f
parser :: Parser (ByteString, ByteString, ByteString)
parser = do
-- Skip VALUES keyword
skipWhile1 (/= '?') *> take 1 *> stringCI "values" *> skipSpace
-- Take (...?
before <- char '(' *> takeTill (== '?')
-- Skip ?,?,?,...
skipMany (skipSpace *> char ',' *> skipSpace *> char '?')
-- Take )
qbits <- takeWhile (== ' ') <* char ')'
after <- takeWhile (/= '?')
endOfInput
return ('(' `cons` before, qbits `snoc` ')', after) does that look ok? |
@paul-rouse hi! 👋 I'm packaging pcre2 for Arch Linux and we are currently working on moving from pcre (now unmaintained) to pcre2. |
Pcre-light is a bit of an annoyance when deploying code since it requires carrying along libpcre. It's only used in one place:
http://github.com/bos/mysql-simple/blob/e0c79e6c8a6874709565cca6de6c6ce6d1dcc8ce/Database/MySQL/Simple.hs#L165
I'm hoping to replace that regular expression with an attoparsec parser so that we can drop the dependency. Would that make sense @bos?
The text was updated successfully, but these errors were encountered: