@@ -415,6 +415,31 @@ class SkipSpacesGo head tail result | head tail -> result
415415instance SkipSpaces tail result => SkipSpacesGo " " tail result
416416else instance Symbol.Cons head tail result => SkipSpacesGo head tail result
417417
418+-- Skip a string literal: consume chars until closing single quote
419+class SkipStringLiteral :: Symbol -> Symbol -> Constraint
420+class SkipStringLiteral sym rest | sym -> rest
421+
422+instance Fail (Text "Unclosed string literal in WHERE clause") => SkipStringLiteral "" rest
423+else instance
424+ ( Symbol.Cons h t sym
425+ , SkipStringLiteralGo h t rest
426+ ) =>
427+ SkipStringLiteral sym rest
428+
429+class SkipStringLiteralGo :: Symbol -> Symbol -> Symbol -> Constraint
430+class SkipStringLiteralGo head tail rest | head tail -> rest
431+
432+-- Closing quote: done
433+instance SkipStringLiteralGo "'" tail tail
434+-- End of string without closing quote
435+else instance Fail (Text "Unclosed string literal in WHERE clause") => SkipStringLiteralGo h "" rest
436+-- Any other char: skip and continue
437+else instance
438+ ( Symbol.Cons nextH nextT tail
439+ , SkipStringLiteralGo nextH nextT rest
440+ ) =>
441+ SkipStringLiteralGo h tail rest
442+
418443-- Extract the first word from a Symbol (up to space or end)
419444class ExtractWord :: Symbol -> Symbol -> Symbol -> Constraint
420445class ExtractWord sym word rest | sym -> word rest
@@ -1277,7 +1302,13 @@ else instance (FlushWhereWord acc currentType tables paramsIn currentType' param
12771302else instance (FlushWhereWord acc currentType tables paramsIn currentType' paramsOut', ParseWhereContinue tail currentType' tables paramsOut' paramsOut) => ParseWhereGo "!" tail acc currentType tables paramsIn paramsOut
12781303else instance (FlushWhereWord acc currentType tables paramsIn currentType' paramsOut', ParseWhereContinue tail currentType' tables paramsOut' paramsOut) => ParseWhereGo "(" tail acc currentType tables paramsIn paramsOut
12791304else instance (FlushWhereWord acc currentType tables paramsIn currentType' paramsOut', ParseWhereContinue tail currentType' tables paramsOut' paramsOut) => ParseWhereGo ")" tail acc currentType tables paramsIn paramsOut
1280−else instance (FlushWhereWord acc currentType tables paramsIn currentType' paramsOut', ParseWhereContinue tail currentType' tables paramsOut' paramsOut) => ParseWhereGo "'" tail acc currentType tables paramsIn paramsOut
1305+-- String literal: flush word, skip until closing quote
1306+else instance
1307+ ( FlushWhereWord acc currentType tables paramsIn currentType' paramsOut'
1308+ , SkipStringLiteral tail rest
1309+ , ParseWhereContinue rest currentType' tables paramsOut' paramsOut
1310+ ) =>
1311+ ParseWhereGo "'" tail acc currentType tables paramsIn paramsOut
12811312else instance (FlushWhereWord acc currentType tables paramsIn currentType' paramsOut', ParseWhereContinue tail currentType' tables paramsOut' paramsOut) => ParseWhereGo "@" tail acc currentType tables paramsIn paramsOut
12821313else instance (FlushWhereWord acc currentType tables paramsIn currentType' paramsOut', ParseWhereContinue tail currentType' tables paramsOut' paramsOut) => ParseWhereGo "?" tail acc currentType tables paramsIn paramsOut
12831314else instance (FlushWhereWord acc currentType tables paramsIn currentType' paramsOut', ParseWhereContinue tail currentType' tables paramsOut' paramsOut) => ParseWhereGo ":" tail acc currentType tables paramsIn paramsOut