add support for '' in string literals
This commit is contained in:
parent
72b67166d9
commit
8adc169b38
5 changed files with 18 additions and 3 deletions
Language/SQL/SimpleSQL
|
@ -724,7 +724,13 @@ String literals: limited at the moment, no escaping \' or other
|
|||
variations.
|
||||
|
||||
> stringLiteral :: P String
|
||||
> stringLiteral = char '\'' *> manyTill anyChar (symbol_ "'")
|
||||
> stringLiteral = (char '\'' *> manyTill anyChar (char '\'')
|
||||
> >>= optionSuffix moreString) <* whiteSpace
|
||||
> where
|
||||
> moreString s0 = try $ do
|
||||
> void $ char '\''
|
||||
> s <- manyTill anyChar (char '\'')
|
||||
> optionSuffix moreString (s0 ++ "'" ++ s)
|
||||
|
||||
number literals
|
||||
|
||||
|
|
|
@ -28,7 +28,11 @@
|
|||
= scalar expressions
|
||||
|
||||
> scalarExpr :: ScalarExpr -> Doc
|
||||
> scalarExpr (StringLit s) = quotes $ text s
|
||||
> scalarExpr (StringLit s) = quotes $ text $ doubleUpQuotes s
|
||||
> where doubleUpQuotes [] = []
|
||||
> doubleUpQuotes ('\'':cs) = '\'':'\'':doubleUpQuotes cs
|
||||
> doubleUpQuotes (c:cs) = c:doubleUpQuotes cs
|
||||
|
||||
> scalarExpr (NumLit s) = text s
|
||||
> scalarExpr (IntervalLit v u p) =
|
||||
> text "interval" <+> quotes (text v)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue