removed unterms -> don't work except we make them more sophisticated
This commit is contained in:
parent
5984316fde
commit
ce9e1b37c1
3 changed files with 27 additions and 7 deletions
19
Makefile
Normal file
19
Makefile
Normal file
|
@ -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
|
|
@ -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) [('(',')'),('[',']'),('{','}')]
|
||||
|
|
1
test
1
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
|
||||
|
|
Loading…
Reference in a new issue