1
Fork 0

lexer tweaks

combine hostparam with prefixed variable
refactor some of the lexing code slightly
fix error in tests where it was using the ansi dialect instead of
  postgres for testing :::, etc.
This commit is contained in:
Jake Wheat 2016-02-15 20:35:38 +02:00
parent 31f9912faa
commit ee4098e189
5 changed files with 24 additions and 41 deletions
tools/Language/SQL/SimpleSQL

View file

@ -33,7 +33,7 @@ Test for the lexer
> -- preserve the case of the u
> ++ map (\i -> ("u&\"" ++ i ++ "\"", [Identifier (Just ("u&\"","\"")) i])) idens
> -- host param
> ++ map (\i -> (':':i, [HostParam i])) idens
> ++ map (\i -> (':':i, [PrefixedVariable ':' i])) idens
> )
> -- quoted identifiers with embedded double quotes
> -- the lexer doesn't unescape the quotes
@ -154,7 +154,7 @@ also: do the testing for the ansi compatibility special cases
> -- preserve the case of the u
> ++ map (\i -> ("u&\"" ++ i ++ "\"", [Identifier (Just ("u&\"","\"")) i])) idens
> -- host param
> ++ map (\i -> (':':i, [HostParam i])) idens
> ++ map (\i -> (':':i, [PrefixedVariable ':' i])) idens
> )
> -- positional var
> ++ [("$1", [PositionalArg 1])]
@ -246,9 +246,9 @@ the + or -.
> -- need more tests for */ to make sure it is caught if it is in the middle of a
> -- sequence of symbol letters
> [LexFails postgres "*/"
> ,LexFails ansi2011 ":::"
> ,LexFails ansi2011 "::::"
> ,LexFails ansi2011 ":::::"
> ,LexFails postgres ":::"
> ,LexFails postgres "::::"
> ,LexFails postgres ":::::"
> ,LexFails postgres "@*/"
> ,LexFails postgres "-*/"
> ,LexFails postgres "12e3e4"

View file

@ -1384,11 +1384,11 @@ TODO: add the missing bits
> parameterSpecification :: TestItem
> parameterSpecification = Group "parameter specification"
> $ map (uncurry (TestValueExpr ansi2011))
> [(":hostparam", HostParameter "hostparam" Nothing)
> [(":hostparam", HostParameter ":hostparam" Nothing)
> ,(":hostparam indicator :another_host_param"
> ,HostParameter "hostparam" $ Just "another_host_param")
> ,HostParameter ":hostparam" $ Just ":another_host_param")
> ,("?", Parameter)
> ,(":h[3]", Array (HostParameter "h" Nothing) [NumLit "3"])
> ,(":h[3]", Array (HostParameter ":h" Nothing) [NumLit "3"])
> ]
<current collation specification> ::=