diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..66f318d --- /dev/null +++ b/Makefile @@ -0,0 +1,19 @@ +.PHONY: all install test clean clean-install clean-build + +all: + cabal build + +test: all + dist/build/hedit/hedit test + +clean: + rm -fR dist/ + +clean-install: clean + rm -fR .cabal-sandbox cabal.sandbox.config + cabal sandbox init + cabal update + cabal install -j --force-reinstalls + +clean-build: clean-install + cabal build diff --git a/src/App/Fontifier.hs b/src/App/Fontifier.hs index e46503c..3d773ed 100644 --- a/src/App/Fontifier.hs +++ b/src/App/Fontifier.hs @@ -54,7 +54,7 @@ f §. s = f . s fontMap :: [(AttrName, Vty.Attr)] fontMap = [ (attrName "assignment" , fg Vty.blue) - , (attrName "return" , fg Vty.green) + , (attrName "return" , Vty.withStyle (fg Vty.green) Vty.bold) , (attrName "guard" , fg Vty.yellow) , (attrName "comment" , fg Vty.magenta) , (attrName "string" , fg Vty.cyan) @@ -67,10 +67,10 @@ fontify :: CheckString -> Fontifications fontify = concatApply [ assignments, returns , strings, guards, comments , mismatchedBrackets - , mismatchedQuotes - , untermStrings - , untermAssignments - , untermReturns] + , mismatchedQuotes] +-- , untermStrings +-- , untermAssignments +-- , untermReturns concatApply :: [Fontifier] -> CheckString -> Fontifications concatApply [] _ = [] @@ -86,14 +86,14 @@ concatApply (f:fs) s = f s ++ concatApply fs s comments = slicesToFT §: "comment" §. matchAll §~ "%.*" assignments = slicesToFT §: "assignment" §. matchGrpStripCmts 1 §~ "(\\**[[:word:]]+)[[:blank:]]*=" -returns = slicesToFT §: "return" §. matchStripCmts §~ "\\^.+;" +returns = slicesToFT §: "return" §. matchStripCmts §~ "[[:space:]]\\^" strings = slicesToFT §: "string" §. matchStripCmts §~ "\"[^%\"]*\"" guards = slicesToFT §: "guard" §. matchGrpStripCmts 1 §~ "\\[(.+):.+\\]" {- Custom/Function-Based -} untermStrings = slicesToFT §: "err_unterm" §. unterm §~ "\"[^%]*\"[^\\;]" -untermAssignments s = slicesToFT §: "err_unterm" §. prune (assignments s) $ (unterm §~ "\"[^%]*\"[^\\;]") s +untermAssignments s = slicesToFT §: "err_unterm" §. prune (assignments s) $ (unterm §~ "\\**[^%]+=[^;%]+[^\\;]") s untermReturns s = slicesToFT §: "err_unterm" §. prune (returns s) $ (unterm §~ "\\^[^;%]+[^\\;]") s mismatchedBrackets s = concatMap (mismatched §: "err_brackets" $ s) [('(',')'),('[',']'),('{','}')] diff --git a/test b/test index 88cf956..e47a496 100644 --- a/test +++ b/test @@ -1,3 +1,4 @@ + { max = { % number a, number b, number c -> number or "error" [ c = "" : c = "0"; ] % by default use "0" if c not specified