Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- data Token
- prettyToken :: Dialect -> Token -> String
- lexToken :: Dialect -> Parser ((FilePath, Int, Int), Token)
- lexTokens :: Dialect -> FilePath -> Maybe (Int, Int) -> Text -> Either ParseError [((FilePath, Int, Int), Token)]
- data Dialect = Dialect {
- diName :: String
- diSyntaxFlavour :: SyntaxFlavour
- diCanonicalTypeNames :: [(Text, [Text])]
- diTextTypes :: [Text]
- diDatetimeTypes :: [Text]
- diNumberTypes :: [Text]
- namesForAnsiTypes :: [(Text, Text)]
- diDefaultCatalog :: Catalog
- ansiDialect :: Dialect
Documentation
Represents a lexed token
Symbol String | a symbol in postgresql dialect is one of the following:
things that are not lexed as symbols:
|
Identifier (Maybe (String, String)) String | This is an identifier or keyword. The 'Maybe (Char,Char)' selects the quoted style - '"' is used to quote identifiers in standard sql, sql server also uses [brackets] to quote identifiers. The identifier also includes the 'variable marker prefix' used in sql server (e.g. @identifier, #identifier), and oracle (e.g. :identifier) |
PrefixedVariable Char String | |
PositionalArg Int | a postgresql positional arg, e.g. $1 |
SqlString String String String | This is a string literal. The first field is the quotes used: single quote (') for normal strings, E' for escape supporting strings, and $$ delimiter for postgresql dollar quoted strings. The lexer doesn't process the escapes in strings, but passes on the literal source e.g. E'\n' parses to SqlString "E'" "\n" with the literal characters '\' and 'n' in the string, not a newline character. quotes within a string ('') or escaped string ('' or \') are passed through unchanged |
SqlNumber String | a number literal (integral or otherwise), stored in original format unchanged |
Whitespace String | non-significant whitespace (space, tab, newline) (strictly speaking, it is up to the client to decide whether the whitespace is significant or not) |
LineComment String | a commented line using --, contains every character starting with the '--' and including the terminating newline character if there is one - this will be missing if the last line in the source is a line comment with no trailing newline |
BlockComment String | a block comment, /* stuff */, includes the comment delimiters |
Splice Char String | an antiquotation splice, e.g. $x(stuff) |
CopyPayload String | the copy data in a copy from stdin |
prettyToken :: Dialect -> Token -> String Source #
Accurate pretty printing, if you lex a bunch of tokens, then pretty print them, should should get back exactly the same string
lexTokens :: Dialect -> FilePath -> Maybe (Int, Int) -> Text -> Either ParseError [((FilePath, Int, Int), Token)] Source #
Dialect | |
|