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

Replace all tabs in Haskell with 8 spaces, add CI test for tabs. #76

Merged
merged 1 commit into from
Feb 25, 2020
Merged
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
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ jobs:
auth_header="$(git config --local --get http.https://github.com/.extraheader)"
git submodule sync --recursive
git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1
- name: Check trailing whitespace
- name: Check tabs and whitespace
shell: bash
run: ".github/workflows/check_trailing_whitespace.sh"
run: ".github/workflows/check_whitespace.sh"
- name: Install dependencies
shell: bash
run: ".github/workflows/install_dependencies_ubuntu.sh"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ set -e
if git ls-files | egrep '\.(lhs|hs|hsc)$' | xargs grep -n ' $'; then
echo "Trailing whitespace found!"
exit 1
else
exit 0
fi

if git ls-files | egrep '\.(lhs|hs|hsc)$' | xargs grep -n $'\t'; then
echo "Tabs found!"
exit 1
fi

exit 0
52 changes: 26 additions & 26 deletions src/Parsec/ParsecLanguage.hs
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,26 @@ haskellStyle= emptyDef
, commentLine = "--"
, nestedComments = True
, identStart = letter
, identLetter = alphaNum <|> oneOf "_'"
, opStart = opLetter haskellStyle
, opLetter = oneOf ":!#$%&*+./<=>?@\\^|-~"
, identLetter = alphaNum <|> oneOf "_'"
, opStart = opLetter haskellStyle
, opLetter = oneOf ":!#$%&*+./<=>?@\\^|-~"
, reservedOpNames= []
, reservedNames = []
, caseSensitive = True
}

javaStyle :: LanguageDef st
javaStyle = emptyDef
{ commentStart = "/*"
, commentEnd = "*/"
, commentLine = "//"
, nestedComments = True
, identStart = letter
, identLetter = alphaNum <|> oneOf "_'"
, reservedNames = []
, reservedOpNames= []
, caseSensitive = False
}
{ commentStart = "/*"
, commentEnd = "*/"
, commentLine = "//"
, nestedComments = True
, identStart = letter
, identLetter = alphaNum <|> oneOf "_'"
, reservedNames = []
, reservedOpNames= []
, caseSensitive = False
}

-----------------------------------------------------------
-- minimal language definition
Expand Down Expand Up @@ -85,14 +85,14 @@ haskell = makeTokenParser haskellDef

haskellDef :: LanguageDef st
haskellDef = haskell98Def
{ identLetter = identLetter haskell98Def <|> char '#'
, reservedNames = reservedNames haskell98Def ++
["foreign","import","export","primitive"
,"_ccall_","_casm_"
,"forall"
]
{ identLetter = identLetter haskell98Def <|> char '#'
, reservedNames = reservedNames haskell98Def ++
["foreign","import","export","primitive"
,"_ccall_","_casm_"
,"forall"
]
}

haskell98Def :: LanguageDef st
haskell98Def = haskellStyle
{ reservedOpNames= ["::","..","=","\\","|","<-","->","@","~","=>"]
Expand All @@ -115,10 +115,10 @@ mondrian = makeTokenParser mondrianDef

mondrianDef :: LanguageDef st
mondrianDef = javaStyle
{ reservedNames = [ "case", "class", "default", "extends"
, "import", "in", "let", "new", "of", "package"
]
, caseSensitive = True
}
{ reservedNames = [ "case", "class", "default", "extends"
, "import", "in", "let", "new", "of", "package"
]
, caseSensitive = True
}



2 changes: 1 addition & 1 deletion src/comp/AAddSchedAssumps.hs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ aAddSchedAssumps apkg schedule schedinfo = (apkg'', schedinfo')
instSchedMap :: OSchedMap
instSchedMap = M.fromList
[(n, methodConflictInfo (vSched vmi))
| AVInst { avi_vname = n, avi_vmi = vmi } <- insts ]
| AVInst { avi_vname = n, avi_vmi = vmi } <- insts ]
insts = apkg_state_instances apkg
apkg' = apkg
doCFAssumps = addCFAssumps pragmas ruleMethodMap instSchedMap cmpRule
Expand Down
4 changes: 2 additions & 2 deletions src/comp/AAddScheduleDefs.hs
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ aAddScheduleDefs flags pps pkg aschedinfo =
asched = asi_schedule aschedinfo
conflicts = concatMap getConflictList (asch_scheduler asched)
mumap = asi_method_uses_map aschedinfo
-- for error messages
pkgpos = getPosition (apkg_name pkg)
-- for error messages
pkgpos = getPosition (apkg_name pkg)

-- Build maps for ready and enable values and collect
-- proof obligations associated with always_ready, always_en, etc.
Expand Down
82 changes: 41 additions & 41 deletions src/comp/ABin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,21 @@ data ABinModInfo =
abmi_path :: String,
-- the name of the BSV package which defined this module
abmi_src_name :: String,
-- time when BSC was called to compile the .ba
--abmi_time :: ClockTime,
abmi_apkg :: APackage,
abmi_aschedinfo :: AScheduleInfo,
-- if this can be used prior to generating abin,
-- or put into APackage, then it's not needed here:
abmi_pps :: [PProp],
-- original type of the module
-- (this could go in APackage;
-- like pps, this is taken from GenWrap's WrapInfo)
-- (for now, the list of preds is empty, so CType would do)
abmi_oqt :: CQType,
abmi_method_dump :: MethodDumpInfo,
abmi_pathinfo :: VPathInfo,
abmi_flags :: Flags,
-- time when BSC was called to compile the .ba
--abmi_time :: ClockTime,
abmi_apkg :: APackage,
abmi_aschedinfo :: AScheduleInfo,
-- if this can be used prior to generating abin,
-- or put into APackage, then it's not needed here:
abmi_pps :: [PProp],
-- original type of the module
-- (this could go in APackage;
-- like pps, this is taken from GenWrap's WrapInfo)
-- (for now, the list of preds is empty, so CType would do)
abmi_oqt :: CQType,
abmi_method_dump :: MethodDumpInfo,
abmi_pathinfo :: VPathInfo,
abmi_flags :: Flags,
-- the generated Verilog
abmi_vprogram :: Maybe VProgram
}
Expand All @@ -81,47 +81,47 @@ data ABinModSchedErrInfo =
-- the name of the BSV package which defined this module
abmsei_src_name :: String,
-- the package prior to scheduling
abmsei_apkg :: APackage,
abmsei_apkg :: APackage,
-- the available schedule info
abmsei_aschederrinfo :: AScheduleErrInfo,
abmsei_aschederrinfo :: AScheduleErrInfo,
-- pragmas
abmsei_pps :: [PProp],
abmsei_pps :: [PProp],
-- original type of the module
abmsei_oqt :: CQType,
abmsei_oqt :: CQType,
-- flags
abmsei_flags :: Flags
abmsei_flags :: Flags
}

-- ---------------

instance PPrint ABin where
pPrint d p (ABinMod abmi ver) =
text "ABin Module" $+$
nest 2 (text "version:" <+> text ver $+$
pPrint d 0 abmi)
text "ABin Module" $+$
nest 2 (text "version:" <+> text ver $+$
pPrint d 0 abmi)

pPrint d p (ABinForeignFunc abffi ver) =
text "ABin Foreign Function" $+$
nest 2 (text "version:" <+> text ver $+$
pPrint d 0 abffi)
text "ABin Foreign Function" $+$
nest 2 (text "version:" <+> text ver $+$
pPrint d 0 abffi)

pPrint d p (ABinModSchedErr abmsei ver) =
text "ABin Module (Schedule Error)" $+$
nest 2 (text "version:" <+> text ver $+$
pPrint d 0 abmsei)
text "ABin Module (Schedule Error)" $+$
nest 2 (text "version:" <+> text ver $+$
pPrint d 0 abmsei)



instance PPrint ABinModInfo where
pPrint d p (ABinModInfo path srcName apkg aschedinfo pps oqt mi pathinfo flags vprog) =
text "path:" <+> text path $+$
text "package:" <+> text srcName $+$
pPrint d 0 apkg $+$
pPrint d 0 aschedinfo $+$
text "path:" <+> text path $+$
text "package:" <+> text srcName $+$
pPrint d 0 apkg $+$
pPrint d 0 aschedinfo $+$
text "pprop:" <+> pPrint d 0 pps $+$
text "oqt:" <+> pPrint d 0 oqt $+$
-- no dump of method info
text "pathinfo:" <+> pPrint d 0 pathinfo $+$
-- no dump of method info
text "pathinfo:" <+> pPrint d 0 pathinfo $+$
-- no dump of flags
text "vprog:" <+> (if (isNothing vprog)
then text "Nothing"
Expand All @@ -130,16 +130,16 @@ instance PPrint ABinModInfo where

instance PPrint ABinForeignFuncInfo where
pPrint d p (ABinForeignFuncInfo fid ff) =
text "src name:" <+> pPrint d 0 fid $+$
pPrint d 0 ff
text "src name:" <+> pPrint d 0 fid $+$
pPrint d 0 ff


instance PPrint ABinModSchedErrInfo where
pPrint d p (ABinModSchedErrInfo path srcName apkg aschederrinfo pps oqt flags) =
text "path:" <+> text path $+$
text "package:" <+> text srcName $+$
pPrint d 0 apkg $+$
pPrint d 0 aschederrinfo $+$
text "path:" <+> text path $+$
text "package:" <+> text srcName $+$
pPrint d 0 apkg $+$
pPrint d 0 aschederrinfo $+$
text "pprop:" <+> pPrint d 0 pps $+$
text "oqt:" <+> pPrint d 0 oqt
-- no dump of flags
Expand Down
Loading