diff --git a/src/App/Fontifier.hs b/src/App/Fontifier.hs index 9ecfda6..e46503c 100644 --- a/src/App/Fontifier.hs +++ b/src/App/Fontifier.hs @@ -57,7 +57,7 @@ fontMap = [ (attrName "assignment" , fg Vty.blue) , (attrName "return" , fg Vty.green) , (attrName "guard" , fg Vty.yellow) , (attrName "comment" , fg Vty.magenta) - , (attrName "string" , fg Vty.green) + , (attrName "string" , fg Vty.cyan) , (attrName "err_brackets" , bg Vty.red) -- unbalanced brackets , (attrName "err_quotes" , Vty.withStyle (fg Vty.red) Vty.underline) -- unbalanced quotes , (attrName "err_unterm" , Vty.withStyle (fg Vty.red) Vty.underline) -- missing ; @@ -85,9 +85,9 @@ concatApply (f:fs) s = f s ++ concatApply fs s {- Regex-Based -} comments = slicesToFT §: "comment" §. matchAll §~ "%.*" -assignments = slicesToFT §: "assignment" §. matchStripCmts §~ "\\**.+=.+;" +assignments = slicesToFT §: "assignment" §. matchGrpStripCmts 1 §~ "(\\**[[:word:]]+)[[:blank:]]*=" returns = slicesToFT §: "return" §. matchStripCmts §~ "\\^.+;" -strings = slicesToFT §: "string" §. matchStripCmts §~ "\"[^%]*\"" +strings = slicesToFT §: "string" §. matchStripCmts §~ "\"[^%\"]*\"" guards = slicesToFT §: "guard" §. matchGrpStripCmts 1 §~ "\\[(.+):.+\\]" {- Custom/Function-Based -} diff --git a/test b/test new file mode 100644 index 0000000..88cf956 --- /dev/null +++ b/test @@ -0,0 +1,17 @@ +{ + max = { % number a, number b, number c -> number or "error" + [ c = "" : c = "0"; ] % by default use "0" if c not specified + ab = {} + ("test " + a + " -le " + b).syscall; + [ ab = "1" : + ac = {} + ("test " + a + " -le " + c).syscall; + [ ac = "1" : ^c; ] + [ ac = "0" : ^a; ] + ][ ab = "0" : + ^ { a = *a; b = *c; c = *b; } + *max; + ] + ^ "error"; + } + result = { a = "12"; b = "27"; c = "18"; } + max; + {} + ("echo " + result).syscall; + {} + ("echo " + ({ a = "-12"; b = "-27"; } + max)).syscall; +}