Skip to content

Commit

Permalink
fix-whitespace (BNFC#404)
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Mar 3, 2022
1 parent 5e22c1c commit def954d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion source/src/BNFC/Backend/Common/Makefile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import BNFC.PrettyPrint
--
-- >>> mkRule "main" ["file1","file2"] ["do something"]
-- main : file1 file2
-- do something
-- do something
-- <BLANKLINE>
--
-- >>> mkRule "main" ["program.exe"] []
Expand Down
6 changes: 3 additions & 3 deletions source/src/BNFC/Backend/FSharp.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -169,4 +169,4 @@ fsprojM opts = unlines
," </ItemGroup>"

,"</Project>"
]
]
1 change: 0 additions & 1 deletion source/src/BNFC/Backend/FSharp/CFtoFSharpPrinter.hs
Original file line number Diff line number Diff line change
Expand Up @@ -227,4 +227,3 @@ mkRhs args its =
mk _ _ = []
prt c = prtFun c +++ show (precCat c)


3 changes: 1 addition & 2 deletions source/src/BNFC/Backend/FSharp/CFtoFSharpShow.hs
Original file line number Diff line number Diff line change
@@ -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
-}
Expand Down Expand Up @@ -131,4 +131,3 @@ mkRhs args its =
mk args (Right _ : items) = mk args items
mk _ _ = []


4 changes: 2 additions & 2 deletions source/src/BNFC/Backend/FSharp/CFtoFSharpTemplate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

6 changes: 3 additions & 3 deletions source/src/BNFC/Backend/FSharp/CFtoFSharpTest.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -54,9 +54,9 @@ fsharpTestfile absM lexM parM printM showM moduleName cf =
, nest 4 ("c |> LexBuffer<char>.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"
Expand Down
4 changes: 2 additions & 2 deletions source/src/BNFC/Backend/FSharp/CFtoFsLex.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)"
Expand Down
6 changes: 3 additions & 3 deletions source/src/BNFC/Backend/FSharp/FSharpUtil.hs
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ reservedFsLex =
, "refill"
, "rule"
, "shortest"
,"letter"

,"letter"
,"upper"
,"lower"
,"digit"
Expand Down Expand Up @@ -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)
c -> qual "show" ++ fixType (normCat c)

0 comments on commit def954d

Please sign in to comment.