Skip to content

Commit

Permalink
[ #352 ] TokenText flag to cf2Layout is obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasabel committed Apr 24, 2021
1 parent febb6b4 commit 793e85d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/src/BNFC/Backend/Haskell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ makeHaskell opts cf = do
liftIO $ printf "Use Alex 3 to compile %s.\n" (alexFile opts)

Ctrl.when (hasLayout cf) $ mkfile (layoutFile opts) $
cf2Layout (tokenText opts) layMod lexMod cf
cf2Layout layMod lexMod cf

-- Generate Happy parser and matching test program.
do
Expand Down
8 changes: 3 additions & 5 deletions source/src/BNFC/Backend/Haskell/CFtoLayout.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

module BNFC.Backend.Haskell.CFtoLayout where

import Data.List ( sort )
import Data.Maybe ( fromMaybe )

import BNFC.CF
import BNFC.Options ( TokenText )
import BNFC.PrettyPrint
import BNFC.Backend.Haskell.Utils ( tokenTextImport, tokenTextPackParens, tokenTextUnpack )
import BNFC.Utils ( caseMaybe, for, whenJust )

data TokSymbol = TokSymbol String Int
Expand All @@ -22,8 +20,8 @@ data TokSymbol = TokSymbol String Int
data LayoutDelimiters = LayoutDelimiters TokSymbol (Maybe TokSymbol) (Maybe TokSymbol)
deriving Show

cf2Layout :: TokenText -> String -> String -> CF -> String
cf2Layout tokenText layName lexName cf = unlines $ concat
cf2Layout :: String -> String -> CF -> String
cf2Layout layName lexName cf = unlines $ concat
[ [ "-- Generated by the BNF Converter"
, ""
, "{-# OPTIONS_GHC -fno-warn-incomplete-patterns #-}"
Expand Down Expand Up @@ -55,7 +53,7 @@ cf2Layout tokenText layName lexName cf = unlines $ concat
, "layoutWords :: [(TokSymbol, LayoutDelimiters)]"
, render $ prettyList 2 "layoutWords =" "[" "]" "," $
for lay $ \ (kw, delims) ->
prettyList 2 "" "(" ")" "," $
prettyList 0 empty "(" ")" "," $
map text [ show kw, show delims ]
, ""
, "layoutStopWords :: [TokSymbol]"
Expand Down
2 changes: 1 addition & 1 deletion source/src/BNFC/Backend/HaskellGADT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ makeHaskellGadt opts cf = do
mkfile (templateFile opts) $ cf2Template (templateFileM opts) absMod cf
mkfile (printerFile opts) $ cf2Printer StringToken False True prMod absMod cf
when (hasLayout cf) $ mkfile (layoutFile opts) $
cf2Layout (tokenText opts) layMod lexMod cf
cf2Layout layMod lexMod cf
mkfile (tFile opts) $ Haskell.testfile opts cf
mkfile (errFile opts) $ mkErrM errMod
Makefile.mkMakefile opts $ Haskell.makefile opts cf
Expand Down

0 comments on commit 793e85d

Please sign in to comment.