Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Haskell ] Name created test parser as file, not Main #317

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions source/src/BNFC/Backend/Haskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ makefile opts makeFile = vcat

-- | Rule to build Haskell test parser.
testParserRule :: Doc
testParserRule = Makefile.mkRule tgt deps [ "ghc --make $< -o $@" ]
testParserRule = Makefile.mkRule tgt deps
[ unwords [ "ghc --make $<", "-main-is", tFileM opts, "-o $@" ] ]
where
tgt :: String
tgt = tFileExe opts
Expand Down Expand Up @@ -288,7 +289,7 @@ testfile :: Options -> CF -> String
testfile opts cf = unlines $ concat $
[ [ "-- Program to test parser, automatically generated by BNF Converter."
, ""
, "module Main where"
, unwords [ "module", tFileM opts, "where" ]
, ""
]
, case tokenText opts of
Expand Down
4 changes: 3 additions & 1 deletion source/src/BNFC/Backend/Haskell/HsOpts.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ absFile, absFileM,
templateFile, templateFileM,
printerFile, printerFileM,
layoutFile, layoutFileM,
tFile, tFileExe :: Options -> String
tFile, tFileM, tFileExe
:: Options -> String
absFile = mkFile withLang "Abs" "hs"
absFileM = mkMod withLang "Abs"
alexFile = mkFile withLang "Lex" "x"
Expand All @@ -31,6 +32,7 @@ templateFileM = mkMod withLang "Skel"
printerFile = mkFile withLang "Print" "hs"
printerFileM = mkMod withLang "Print"
tFile = mkFile withLang "Test" "hs"
tFileM = mkMod withLang "Test"
tFileExe = mkFile withLang "Test" ""
errFile = mkFile noLang "ErrM" "hs"
errFileM = mkMod noLang "ErrM"
Expand Down