removed unterms -> don't work except we make them more sophisticated

This commit is contained in:
Armin Friedl 2016-08-13 13:52:27 +02:00
parent 5984316fde
commit ce9e1b37c1
3 changed files with 27 additions and 7 deletions

19
Makefile Normal file
View 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

View file

@ -54,7 +54,7 @@ f §. s = f . s
fontMap :: [(AttrName, Vty.Attr)] fontMap :: [(AttrName, Vty.Attr)]
fontMap = [ (attrName "assignment" , fg Vty.blue) 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 "guard" , fg Vty.yellow)
, (attrName "comment" , fg Vty.magenta) , (attrName "comment" , fg Vty.magenta)
, (attrName "string" , fg Vty.cyan) , (attrName "string" , fg Vty.cyan)
@ -67,10 +67,10 @@ fontify :: CheckString -> Fontifications
fontify = concatApply [ assignments, returns fontify = concatApply [ assignments, returns
, strings, guards, comments , strings, guards, comments
, mismatchedBrackets , mismatchedBrackets
, mismatchedQuotes , mismatchedQuotes]
, untermStrings -- , untermStrings
, untermAssignments -- , untermAssignments
, untermReturns] -- , untermReturns
concatApply :: [Fontifier] -> CheckString -> Fontifications concatApply :: [Fontifier] -> CheckString -> Fontifications
concatApply [] _ = [] concatApply [] _ = []
@ -86,14 +86,14 @@ concatApply (f:fs) s = f s ++ concatApply fs s
comments = slicesToFT §: "comment" §. matchAll §~ "%.*" comments = slicesToFT §: "comment" §. matchAll §~ "%.*"
assignments = slicesToFT §: "assignment" §. matchGrpStripCmts 1 §~ "(\\**[[:word:]]+)[[:blank:]]*=" assignments = slicesToFT §: "assignment" §. matchGrpStripCmts 1 §~ "(\\**[[:word:]]+)[[:blank:]]*="
returns = slicesToFT §: "return" §. matchStripCmts §~ "\\^.+;" returns = slicesToFT §: "return" §. matchStripCmts §~ "[[:space:]]\\^"
strings = slicesToFT §: "string" §. matchStripCmts §~ "\"[^%\"]*\"" strings = slicesToFT §: "string" §. matchStripCmts §~ "\"[^%\"]*\""
guards = slicesToFT §: "guard" §. matchGrpStripCmts 1 §~ "\\[(.+):.+\\]" guards = slicesToFT §: "guard" §. matchGrpStripCmts 1 §~ "\\[(.+):.+\\]"
{- Custom/Function-Based -} {- Custom/Function-Based -}
untermStrings = slicesToFT §: "err_unterm" §. unterm §~ "\"[^%]*\"[^\\;]" 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 untermReturns s = slicesToFT §: "err_unterm" §. prune (returns s) $ (unterm §~ "\\^[^;%]+[^\\;]") s
mismatchedBrackets s = concatMap (mismatched §: "err_brackets" $ s) [('(',')'),('[',']'),('{','}')] mismatchedBrackets s = concatMap (mismatched §: "err_brackets" $ s) [('(',')'),('[',']'),('{','}')]

1
test
View file

@ -1,3 +1,4 @@
{ {
max = { % number a, number b, number c -> number or "error" max = { % number a, number b, number c -> number or "error"
[ c = "" : c = "0"; ] % by default use "0" if c not specified [ c = "" : c = "0"; ] % by default use "0" if c not specified