1
Fork 0

fix error message quoting

This commit is contained in:
Jake Wheat 2024-02-02 17:20:20 +00:00
parent 1f51e630d3
commit 7f4fda7ce7
5 changed files with 16 additions and 17 deletions

View file

@ -898,8 +898,9 @@ instance VisualStream SQLStream where
tokensLength Proxy xs = sum (tokenLength <$> xs)
instance TraversableStream SQLStream where
reachOffset o M.PosState {..} =
( Just (prefix ++ restOfLine)
-- I have no idea what all this is doing
reachOffset o _x@(M.PosState {..}) =
( Just $ actualLine
, PosState
{ pstateInput = SQLStream
{ sqlStreamInput = postStr
@ -912,6 +913,11 @@ instance TraversableStream SQLStream where
}
)
where
maybeitsthefullsource = sqlStreamInput pstateInput
targetLineNo = M.unPos $ sourceLine newSourcePos
actualLine = case drop (targetLineNo - 1) $ lines maybeitsthefullsource of
(x:_) -> x
[] -> "<empty line>"
prefix =
if sameLine
then pstateLinePrefix ++ preLine
@ -930,7 +936,6 @@ instance TraversableStream SQLStream where
case NE.nonEmpty pre of
Nothing -> 0
Just nePre -> tokensLength pxy nePre
restOfLine = takeWhile (/= '\n') postStr
pxy :: Proxy SQLStream
pxy = Proxy

View file

@ -1,5 +1,5 @@
0.7.0
support autoincrement for sqlite
0.7.1 fix error message source quoting
0.7.0 support autoincrement for sqlite
support table constraints without separating comma for sqlite
switch source from literate to regular haskell
use prettyprinter lib instead of pretty

View file

@ -1,12 +1,10 @@
cabal-version: 2.2
name: simple-sql-parser
version: 0.7.0
version: 0.7.1
synopsis: A parser for SQL.
description:
A parser for SQL. Parses most SQL:2011
description: A parser for SQL. Parses most SQL:2011
queries, non-query DML, DDL, access control and
transaction management syntax. Please see the
homepage for more information
@ -23,10 +21,6 @@ build-type: Simple
extra-doc-files: README,LICENSE,changelog
bug-reports: https://github.com/JakeWheat/simple-sql-parser/issues
source-repository head
type: git
location: https://github.com/JakeWheat/simple-sql-parser.git
Flag parserexe
Description: Build SimpleSQLParserTool exe
Default: False

View file

@ -212,10 +212,10 @@ make test
When you add support for new syntax: add some tests. If you modify or
fix something, and it doesn't have tests, add some. If the syntax
isn't in ANSI SQL, guard it behind a dialect flag. If you write
support for a dialect that isn't mention, add a new dialect.
isn't in ANSI SQL, guard it behind a dialect flag. If you add
support for something from a new dialect, add that dialect.
Make sure all the tests still pass, then send a pull request on Github.
Check all the tests still pass, then send a pull request on Github.
# Links

View file

@ -1,7 +1,7 @@
cabal-version: 2.2
name: simple-sql-parser
version: 0.7.0
version: 0.7.1
executable RenderTestCases
main-is: RenderTestCases.hs