napkin-0.5.13
Copyright(c) Soostone Inc 2020
LicenseAllRightsReserved
Stabilityexperimental
PortabilityPOSIX
Safe HaskellNone
LanguageHaskell2010

Napkin.Parse.SimpleSqlParser.Dialect

Description

 
Synopsis

Documentation

data Dialect #

Used to set the dialect used for parsing and pretty printing, very unfinished at the moment.

The keyword handling works as follows:

There is a list of reserved keywords. These will never parse as anything other than as a keyword, unless they are in one of the other lists.

There is a list of 'identifier' keywords. These are reserved keywords, with an exception that they will parse as an identifier in a scalar expression. They won't parse as identifiers in other places, e.g. column names or aliases.

There is a list of 'app' keywords. These are reserved keywords, with an exception that they will also parse in an 'app-like' construct - a regular function call, or any of the aggregate and window variations.

There is a list of special type names. This list serves two purposes - it is a list of the reserved keywords which are also type names, and it is a list of all the multi word type names.

Every keyword should appear in the keywords lists, and then you can add them to the other lists if you want exceptions. Most things that refer to functions, types or variables that are keywords in the ansi standard, can be removed from the keywords lists completely with little effect. With most of the actual SQL keywords, removing them from the keyword list will result in lots of valid syntax no longer parsing (and probably bad parse error messages too).

In the code, all special syntax which looks identical to regular identifiers or function calls (apart from the name), is treated like a regular identifier or function call.

It's easy to break the parser by removing the wrong words from the keywords list or adding the wrong words to the other lists.

Instances

Instances details
Eq Dialect 
Instance details

Defined in Language.SQL.SimpleSQL.Dialect

Methods

(==) :: Dialect -> Dialect -> Bool #

(/=) :: Dialect -> Dialect -> Bool #

Data Dialect 
Instance details

Defined in Language.SQL.SimpleSQL.Dialect

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Dialect -> c Dialect #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Dialect #

toConstr :: Dialect -> Constr #

dataTypeOf :: Dialect -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Dialect) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Dialect) #

gmapT :: (forall b. Data b => b -> b) -> Dialect -> Dialect #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Dialect -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Dialect -> r #

gmapQ :: (forall d. Data d => d -> u) -> Dialect -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Dialect -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Dialect -> m Dialect #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Dialect -> m Dialect #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Dialect -> m Dialect #

Read Dialect 
Instance details

Defined in Language.SQL.SimpleSQL.Dialect

Show Dialect 
Instance details

Defined in Language.SQL.SimpleSQL.Dialect