diff --git a/source/src/BNFC/Backend/Common/Makefile.hs b/source/src/BNFC/Backend/Common/Makefile.hs index 33dc9fa1..fb6a7e34 100644 --- a/source/src/BNFC/Backend/Common/Makefile.hs +++ b/source/src/BNFC/Backend/Common/Makefile.hs @@ -12,7 +12,7 @@ import BNFC.PrettyPrint -- -- >>> mkRule "main" ["file1","file2"] ["do something"] -- main : file1 file2 --- do something +-- do something -- -- -- >>> mkRule "main" ["program.exe"] [] diff --git a/source/src/BNFC/Backend/FSharp.hs b/source/src/BNFC/Backend/FSharp.hs index 443bdc60..30b9f334 100644 --- a/source/src/BNFC/Backend/FSharp.hs +++ b/source/src/BNFC/Backend/FSharp.hs @@ -72,7 +72,7 @@ showFile = mkFile withLang "Show" "fs" showFileM = mkMod withLang "Show" tFileM = mkMod withLang "Test" tFile = mkFile withLang "Test" "fs" -utilFileM = mkMod noLang "BnfcUtil" +utilFileM = mkMod noLang "BnfcUtil" utilFile = mkFile noLang "BnfcUtil" "fs" fsprojFile = mkFile withLang "" "fsproj" @@ -105,7 +105,7 @@ makefile :: SharedOptions -> String -> Doc makefile opts basename = vcat [ mkRule "clean" [] - [ "-rm -fr bin obj "] + [ "-rm -fr bin obj "] ,mkRule "distclean" ["clean"] [ "-rm -f " ++ unwords [ mkFile withLang "Lex" "*" opts, mkFile withLang "Par" "*" opts, @@ -169,4 +169,4 @@ fsprojM opts = unlines ," " ,"" - ] \ No newline at end of file + ] diff --git a/source/src/BNFC/Backend/FSharp/CFtoFSharpPrinter.hs b/source/src/BNFC/Backend/FSharp/CFtoFSharpPrinter.hs index 50e893d5..33b20021 100644 --- a/source/src/BNFC/Backend/FSharp/CFtoFSharpPrinter.hs +++ b/source/src/BNFC/Backend/FSharp/CFtoFSharpPrinter.hs @@ -227,4 +227,3 @@ mkRhs args its = mk _ _ = [] prt c = prtFun c +++ show (precCat c) - diff --git a/source/src/BNFC/Backend/FSharp/CFtoFSharpShow.hs b/source/src/BNFC/Backend/FSharp/CFtoFSharpShow.hs index de92ecf7..356ad082 100644 --- a/source/src/BNFC/Backend/FSharp/CFtoFSharpShow.hs +++ b/source/src/BNFC/Backend/FSharp/CFtoFSharpShow.hs @@ -1,6 +1,6 @@ {- TODO: Check if printing fot native fsharp objects like choice types or algebraic types can handle this (it would allow to remove most of the code here) - BNF Converter: Non-pretty-printer generator + BNF Converter: Non-pretty-printer generator Copyright (C) 2021 Author: Grzegorz Dziadkiewicz -} @@ -131,4 +131,3 @@ mkRhs args its = mk args (Right _ : items) = mk args items mk _ _ = [] - diff --git a/source/src/BNFC/Backend/FSharp/CFtoFSharpTemplate.hs b/source/src/BNFC/Backend/FSharp/CFtoFSharpTemplate.hs index a460a39b..5b9005ba 100644 --- a/source/src/BNFC/Backend/FSharp/CFtoFSharpTemplate.hs +++ b/source/src/BNFC/Backend/FSharp/CFtoFSharpTemplate.hs @@ -61,6 +61,6 @@ case_fun cat xs = unlines $ [ "trans" ++ show cat +++ "(x : " ++ fixType cat ++ ") : Result =", indent 1 "match x with" - ] ++ + ] ++ (map (indent 1) . insertBar . map (++ " -> failure x")) xs - + diff --git a/source/src/BNFC/Backend/FSharp/CFtoFSharpTest.hs b/source/src/BNFC/Backend/FSharp/CFtoFSharpTest.hs index dd8e62a2..e9f885db 100644 --- a/source/src/BNFC/Backend/FSharp/CFtoFSharpTest.hs +++ b/source/src/BNFC/Backend/FSharp/CFtoFSharpTest.hs @@ -40,7 +40,7 @@ fsharpTestfile absM lexM parM printM showM moduleName cf = topType2 = text $ fixType $ normCat $ firstEntry cf in vcat [ comment "automatically generated by the BNF Converter" - , text ("module" +++ moduleName) + , text ("module" +++ moduleName) , "open System" , "open System.IO" , "open FSharp.Text.Lexing" @@ -54,9 +54,9 @@ fsharpTestfile absM lexM parM printM showM moduleName cf = , nest 4 ("c |> LexBuffer.FromTextReader |>" <+> parserName <+> lexerName ) , "" , "let showTree (t:" <> topType2 <> ") : string =" - , nest 4 (vcat ( punctuate " +" + , nest 4 (vcat ( punctuate " +" [ doubleQuotes "[Abstract syntax]\\n\\n" - , showFun <+> "t" + , showFun <+> "t" , doubleQuotes "\\n\\n" , doubleQuotes "[Linearized tree]\\n\\n" , printerName <+> "t" diff --git a/source/src/BNFC/Backend/FSharp/CFtoFsLex.hs b/source/src/BNFC/Backend/FSharp/CFtoFsLex.hs index 154d168d..db87bb98 100644 --- a/source/src/BNFC/Backend/FSharp/CFtoFsLex.hs +++ b/source/src/BNFC/Backend/FSharp/CFtoFsLex.hs @@ -168,7 +168,7 @@ rules cf = mkRule "token" $ ++ -- reserved keywords [ ( "rsyms" - , vcat + , vcat [ "let x = lexeme lexbuf" , "match Map.tryFind x symbol_table with" , "| Some result -> result" @@ -204,7 +204,7 @@ rules cf = mkRule "token" $ (multilineC, singleLineC) = comments cf tokenAction pos t = case asciiKeywords cf of [] -> "TOK_" <> t <+> arg "(lexeme lexbuf)" - _ -> vcat + _ -> vcat [ "let l = lexeme lexbuf" , "Map.tryFind l resword_table" , "|> Option.defaultValue (TOK_" <> t <+> arg "l)" diff --git a/source/src/BNFC/Backend/FSharp/FSharpUtil.hs b/source/src/BNFC/Backend/FSharp/FSharpUtil.hs index 03b33147..a83b9e40 100644 --- a/source/src/BNFC/Backend/FSharp/FSharpUtil.hs +++ b/source/src/BNFC/Backend/FSharp/FSharpUtil.hs @@ -104,8 +104,8 @@ reservedFsLex = , "refill" , "rule" , "shortest" - - ,"letter" + + ,"letter" ,"upper" ,"lower" ,"digit" @@ -139,4 +139,4 @@ showsFunQual :: (String -> String) -> Cat -> String showsFunQual qual = loop where loop = \case ListCat c -> qual "showList" +++ loop c - c -> qual "show" ++ fixType (normCat c) \ No newline at end of file + c -> qual "show" ++ fixType (normCat c)