Workaround for #68: trim exactprinted text for unknown nodes
parent
6a97379b33
commit
8a401d291e
|
@ -490,3 +490,6 @@ func
|
|||
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..] ]
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue