1
Fork 0

move limit to only be reserved word in mysql dialect

This commit is contained in:
Jake Wheat 2014-06-28 15:43:30 +03:00
parent c1c514af35
commit ba331af24b

View file

@ -303,9 +303,10 @@ u&"example quoted"
> name :: Parser Name > name :: Parser Name
> name = do > name = do
> d <- getState
> choice [QName <$> quotedIdentifier > choice [QName <$> quotedIdentifier
> ,UQName <$> uquotedIdentifier > ,UQName <$> uquotedIdentifier
> ,Name <$> identifierBlacklist blacklist > ,Name <$> identifierBlacklist (blacklist d)
> ,dqName] > ,dqName]
> where > where
> dqName = guardDialect [MySQL] *> > dqName = guardDialect [MySQL] *>
@ -1639,7 +1640,7 @@ helper function to improve error messages
> pure i) > pure i)
> <?> "identifier" > <?> "identifier"
> blacklist :: [String] > blacklist :: Dialect -> [String]
> blacklist = reservedWord > blacklist = reservedWord
These blacklisted names are mostly needed when we parse something with These blacklisted names are mostly needed when we parse something with
@ -1656,8 +1657,8 @@ The standard has a weird mix of reserved keywords and unreserved
keywords (I'm not sure what exactly being an unreserved keyword keywords (I'm not sure what exactly being an unreserved keyword
means). means).
> reservedWord :: [String] > reservedWord :: Dialect -> [String]
> reservedWord = > reservedWord SQL2011 =
> ["abs" > ["abs"
> --,"all" > --,"all"
> ,"allocate" > ,"allocate"
@ -1982,10 +1983,13 @@ means).
> ,"within" > ,"within"
> ,"without" > ,"without"
> --,"year" > --,"year"
> -- added for mysql dialect, todo: make dialect specific lists
> ,"limit"
> ] > ]
TODO: create this list properly
> reservedWord MySQL = reservedWord SQL2011 ++ ["limit"]
----------- -----------
bit hacky, used to make the dialect available during parsing so bit hacky, used to make the dialect available during parsing so