1
Fork 0

fix parsing of quoted keywords

This commit is contained in:
Jake Wheat 2019-08-31 09:13:09 +01:00
parent c5b8df7e2f
commit ce0eeb392a
4 changed files with 38 additions and 0 deletions

View file

@ -2118,6 +2118,7 @@ It is only allowed when all the strings are quoted with ' atm.
> identifierTok :: [String] -> Parser (Maybe (String,String), String) > identifierTok :: [String] -> Parser (Maybe (String,String), String)
> identifierTok blackList = mytoken (\tok -> > identifierTok blackList = mytoken (\tok ->
> case tok of > case tok of
> L.Identifier q@(Just {}) p -> Just (q,p)
> L.Identifier q p | map toLower p `notElem` blackList -> Just (q,p) > L.Identifier q p | map toLower p `notElem` blackList -> Just (q,p)
> _ -> Nothing) > _ -> Nothing)

32
TODO
View file

@ -4,6 +4,38 @@ review alters, and think about adding rename versions
which are really common and useful, but not in ansi which are really common and useful, but not in ansi
https://github.com/JakeWheat/simple-sql-parser/issues/20 https://github.com/JakeWheat/simple-sql-parser/issues/20
do more examples
what are the use cases?
sql generator - queries
sql generator - ddl
parsing some sql - for what purpose
generating documentation of ddl
write some sort of trivial sql engine or wrapper around something?
write something that takes sql, modifies it, and outputs the result
lint checker?
do an example of adding some new syntax
-> seems quite a few people are using this
and there are some feature requests
try to give people a path to implement features themselves
goals:
1. if someone might want to use this, give them some toy examples to
help bootstrap them
2. see if can encourage people who want some missing sql to add it
themselves
review main missing sql bits - focus on more mainstream things
could also review main dialects
review the dialect support implementation
syntax from hssqlppp: syntax from hssqlppp:
query hints, join hints query hints, join hints

View file

@ -50,6 +50,7 @@ Tests for parsing scalar expressions
> [("iden1", Iden [Name Nothing "iden1"]) > [("iden1", Iden [Name Nothing "iden1"])
> --,("t.a", Iden2 "t" "a") > --,("t.a", Iden2 "t" "a")
> ,("\"quoted identifier\"", Iden [Name (Just ("\"","\"")) "quoted identifier"]) > ,("\"quoted identifier\"", Iden [Name (Just ("\"","\"")) "quoted identifier"])
> ,("\"period\"", Iden [Name (Just ("\"","\"")) "period"])
> ] > ]
> star :: TestItem > star :: TestItem
@ -413,3 +414,4 @@ target_string
> ] > ]
> where > where
> t fn = TestScalarExpr ansi2011 (fn ++ "(a)") $ App [Name Nothing fn] [Iden [Name Nothing "a"]] > t fn = TestScalarExpr ansi2011 (fn ++ "(a)") $ App [Name Nothing fn] [Iden [Name Nothing "a"]]

View file

@ -401,4 +401,7 @@ generally available to work on these, so you should either make a pull
request, or find someone willing to write the fixes and make a pull request, or find someone willing to write the fixes and make a pull
request. request.
I wrote a tutorial on parsing SQL here:
http://jakewheat.github.io/intro_to_parsing/