add tests for + - followed by comment edge cases
This commit is contained in:
parent
fc2119be02
commit
47198c78c1
|
@ -370,7 +370,6 @@ which allows the last character of a multi character symbol to be + or
|
||||||
> -- special case for parsing a single + or - symbol
|
> -- special case for parsing a single + or - symbol
|
||||||
> singlePlusMinus = try $ do
|
> singlePlusMinus = try $ do
|
||||||
> c <- oneOf "+-"
|
> c <- oneOf "+-"
|
||||||
> -- todo: make sure it deals with e.g. --- +-- +/* -/*?
|
|
||||||
> notFollowedBy $ oneOf allOpSymbols
|
> notFollowedBy $ oneOf allOpSymbols
|
||||||
> return [c]
|
> return [c]
|
||||||
|
|
||||||
|
|
|
@ -284,7 +284,9 @@ the + or -.
|
||||||
> [LexerTest postgres s t | (s,t) <- postgresLexerTable]
|
> [LexerTest postgres s t | (s,t) <- postgresLexerTable]
|
||||||
> ,Group "adhoc lexer tests" $
|
> ,Group "adhoc lexer tests" $
|
||||||
> [LexerTest postgres s t
|
> [LexerTest postgres s t
|
||||||
> | (s,t) <- edgeCaseCommentOps ++ edgeCasePlusMinusOps ]
|
> | (s,t) <- edgeCaseCommentOps
|
||||||
|
> ++ edgeCasePlusMinusOps
|
||||||
|
> ++ edgeCasePlusMinusComments]
|
||||||
> ]
|
> ]
|
||||||
> where
|
> where
|
||||||
> edgeCaseCommentOps = concat
|
> edgeCaseCommentOps = concat
|
||||||
|
@ -298,6 +300,12 @@ the + or -.
|
||||||
> , (x ++ "-", [Symbol x, Symbol "-"]) ]
|
> , (x ++ "-", [Symbol x, Symbol "-"]) ]
|
||||||
> | x <- somePostgresOpsWhichWontAddTrailingPlusMinus 2
|
> | x <- somePostgresOpsWhichWontAddTrailingPlusMinus 2
|
||||||
> ]
|
> ]
|
||||||
|
> edgeCasePlusMinusComments =
|
||||||
|
> [("---", [LineComment "---"])
|
||||||
|
> ,("+--", [Symbol "+", LineComment "--"])
|
||||||
|
> ,("-/**/", [Symbol "-", BlockComment "/**/"])
|
||||||
|
> ,("+/**/", [Symbol "+", BlockComment "/**/"])
|
||||||
|
> ]
|
||||||
|
|
||||||
|
|
||||||
> combos :: [a] -> Int -> [[a]]
|
> combos :: [a] -> Int -> [[a]]
|
||||||
|
|
Loading…
Reference in a new issue