Merge branch 'dev' into indentpolicyleft

pull/66/head
Lennart Spitzner 2017-11-30 23:47:18 +01:00
commit 127299b442
5 changed files with 36 additions and 27 deletions
src/Language/Haskell/Brittany/Internal

View File

@ -467,7 +467,6 @@ func = (1+)
func = (+ 1)
#test left inf
## TODO: this could be improved..
func = (1 `abc`)
#test right inf

View File

@ -502,3 +502,10 @@ func
-> Proxy (str :: [*])
-> m (Tagged str String)
#test issue 67
fmapuv :: U.Unbox a => (a -> b) -> U.Vector a -> V.Vector b
fmapuv f xs = G.generate (G.length xs) (f . (xs G.!))
#test parallellistcomp-workaround
cs0 = 0 : [ c / Interval n | c <- cs | n <- [1..] ]

View File

@ -82,6 +82,8 @@ import ApiAnnotation ( AnnKeywordId(..) )
import Data.Data
import Data.Generics.Schemes
import qualified Data.Char as Char
import DataTreePrint
import Data.HList.HList
@ -154,19 +156,20 @@ briDocByExactInlineOnly infoStr ast = do
let exactPrinted = Text.pack $ ExactPrint.exactPrint ast anns
fallbackMode <-
mAsk <&> _conf_errorHandling .> _econf_ExactPrintFallback .> confUnpack
let exactPrintNode = allocateNode $ BDFExternal
let exactPrintNode t = allocateNode $ BDFExternal
(ExactPrint.Types.mkAnnKey ast)
(foldedAnnKeys ast)
False
exactPrinted
let
errorAction = do
t
let errorAction = do
mTell $ [ErrorUnknownNode infoStr ast]
docLit $ Text.pack "{- BRITTANY ERROR UNHANDLED SYNTACTICAL CONSTRUCT -}"
docLit
$ Text.pack "{- BRITTANY ERROR UNHANDLED SYNTACTICAL CONSTRUCT -}"
case (fallbackMode, Text.lines exactPrinted) of
(ExactPrintFallbackModeNever, _ ) -> errorAction
(_ , [_]) -> exactPrintNode
(ExactPrintFallbackModeRisky, _ ) -> exactPrintNode
(_ , [t]) -> exactPrintNode
(Text.dropWhile Char.isSpace . Text.dropWhileEnd Char.isSpace $ t)
(ExactPrintFallbackModeRisky, _) -> exactPrintNode exactPrinted
_ -> errorAction
rdrNameToText :: RdrName -> Text

View File

@ -336,11 +336,11 @@ layoutExpr lexpr@(L _ expr) = do
SectionL left op -> do -- TODO: add to testsuite
leftDoc <- docSharedWrapper layoutExpr left
opDoc <- docSharedWrapper layoutExpr op
docSeq [leftDoc, opDoc]
docSeq [leftDoc, docSeparator, opDoc]
SectionR op right -> do -- TODO: add to testsuite
opDoc <- docSharedWrapper layoutExpr op
rightDoc <- docSharedWrapper layoutExpr right
docSeq [opDoc, rightDoc]
docSeq [opDoc, docSeparator, rightDoc]
ExplicitTuple args boxity
| Just argExprs <- args `forM` (\case (L _ (Present e)) -> Just e; _ -> Nothing) -> do
argDocs <- docSharedWrapper layoutExpr `mapM` argExprs