Commit 7007d7b0 authored by John van Groningen's avatar John van Groningen

syntax color 'derive', not 'default'

parent 819f37bc
...@@ -11,8 +11,6 @@ import StdArray, StdBool, StdClass, StdEnum, StdList ...@@ -11,8 +11,6 @@ import StdArray, StdBool, StdClass, StdEnum, StdList
import StdIOCommon, StdPicture, StdPSt import StdIOCommon, StdPicture, StdPSt
import EdMonad, syncol import EdMonad, syncol
//--
splitAtTabs :: !String -> .[String] splitAtTabs :: !String -> .[String]
splitAtTabs string splitAtTabs string
= splitAtTabs` 0 0 = splitAtTabs` 0 0
...@@ -42,8 +40,6 @@ tabTake n [string:strings] ...@@ -42,8 +40,6 @@ tabTake n [string:strings]
where where
len = size string len = size string
//--
alignAtTab` x tabSize charWidth alignAtTab` x tabSize charWidth
| tabSize <= 0 | tabSize <= 0
= x + charWidth // sensible result for silly value = x + charWidth // sensible result for silly value
...@@ -51,8 +47,6 @@ alignAtTab` x tabSize charWidth ...@@ -51,8 +47,6 @@ alignAtTab` x tabSize charWidth
where where
tabWidth = tabSize * charWidth tabWidth = tabSize * charWidth
//--
tabDrawString :: !Point2 !String !FontInfo !*Picture -> *Picture tabDrawString :: !Point2 !String !FontInfo !*Picture -> *Picture
tabDrawString point string {thefont, showTabs,tabSize,charWidth} picture tabDrawString point string {thefont, showTabs,tabSize,charWidth} picture
#! strings = splitAtTabs string #! strings = splitAtTabs string
...@@ -131,9 +125,7 @@ where ...@@ -131,9 +125,7 @@ where
#! picture = optDrawC '~' picture #! picture = optDrawC '~' picture
#! picture = setPenColour textColour picture #! picture = setPenColour textColour picture
= tabDrawString` /*False*/ clevel {point & x = newX} strings picture = tabDrawString` /*False*/ clevel {point & x = newX} strings picture
drawC :: /*!Bool*/ !CommentLevel !.String !*Picture -> (!CommentLevel,!*Picture) drawC :: /*!Bool*/ !CommentLevel !.String !*Picture -> (!CommentLevel,!*Picture)
drawC /*ini*/ c s pic drawC /*ini*/ c s pic
= drawC c pic = drawC c pic
...@@ -162,7 +154,7 @@ where ...@@ -162,7 +154,7 @@ where
l = size s l = size s
funnyChar i = isStringMember s.[i] (dec funnySize) funnyChars funnyChar i = isStringMember s.[i] (dec funnySize) funnyChars
//isStringMember:: a !.[a] -> .Bool | Eq a isStringMember :: !Char !Int !{#Char} -> Bool
isStringMember x i s isStringMember x i s
| i < 0 = False | i < 0 = False
| s.[i] == x = True | s.[i] == x = True
...@@ -319,18 +311,22 @@ where ...@@ -319,18 +311,22 @@ where
T l -> l <> 0 T l -> l <> 0
D l -> l <> 0 D l -> l <> 0
_ -> False _ -> False
dec_comment cl = case cl of dec_comment cl = case cl of
N l -> N (dec l) N l -> N (dec l)
T l -> T (dec l) T l -> T (dec l)
D l -> D (dec l) D l -> D (dec l)
inc_comment cl = case cl of inc_comment cl = case cl of
N l -> N (inc l) N l -> N (inc l)
T l -> T (inc l) T l -> T (inc l)
D l -> D (inc l) D l -> D (inc l)
non_comment_colour cl = case cl of non_comment_colour cl = case cl of
N _ -> textColour N _ -> textColour
T _ -> typedefColour T _ -> typedefColour
D _ -> typedeclColour D _ -> typedeclColour
scankeyword :: !.String !Int -> (!Bool,!Int) scankeyword :: !.String !Int -> (!Bool,!Int)
scankeyword s i scankeyword s i
# c = s.[i] # c = s.[i]
...@@ -344,10 +340,10 @@ where ...@@ -344,10 +340,10 @@ where
| c == 'g' // generic | c == 'g' // generic
| (j == i+7) && (s%(i,i+6)=="generic") = (True,j) | (j == i+7) && (s%(i,i+6)=="generic") = (True,j)
= (False,j) = (False,j)
| c == 'd' // definition | c == 'd' // definition, derive, dynamic
| (j == i+10) && (s%(i,i+9)=="definition") = (True,j) | j == i+10 = (s % (i,i+9)=="definition",j)
| (j == i+7) && (s%(i,i+6)=="default") = (True,j) // only in typedef! | j == i+6 = (s % (i,i+5)=="derive",j)
| (j == i+7) && (s%(i,i+6)=="dynamic") = (True,j) | j == i+7 = (s % (i,i+6)=="dynamic",j)
= (False,j) = (False,j)
| c == 'i' // implementation, import, if, in, infix, infixl, infixr, instance | c == 'i' // implementation, import, if, in, infix, infixl, infixr, instance
| (j == i+14) && (s%(i,i+13)=="implementation") = (True,j) | (j == i+14) && (s%(i,i+13)=="implementation") = (True,j)
...@@ -386,17 +382,6 @@ where ...@@ -386,17 +382,6 @@ where
| (j == i+4) && (s%(i,i+3)=="with") = (True,j) | (j == i+4) && (s%(i,i+3)=="with") = (True,j)
| (j == i+5) && (s%(i,i+4)=="where") = (True,j) | (j == i+5) && (s%(i,i+4)=="where") = (True,j)
= (False,j) = (False,j)
/* | c == 'B' // bool
| (j == i+4) && (s%(i,i+3)=="Bool") = (True,j)
= (False,j)
| c == 'C' // char
| (j == i+4) && (s%(i,i+3)=="Char") = (True,j)
= (False,j)
| c == 'I' // int
| (j == i+3) && (s%(i,i+2)=="Int") = (True,j)
= (False,j)
// True / False; numeric constants??
*/
= (False,j) = (False,j)
scanalpha i scanalpha i
| i >= l = l | i >= l = l
...@@ -427,6 +412,7 @@ where ...@@ -427,6 +412,7 @@ where
= dS (inc i) pic = dS (inc i) pic
# pic = optDrawC s.[i] pic # pic = optDrawC s.[i] pic
= dS (inc i) pic = dS (inc i) pic
dC :: !Int !*Picture -> (!CommentLevel,!*Picture) dC :: !Int !*Picture -> (!CommentLevel,!*Picture)
dC i pic dC i pic
| i >= l | i >= l
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment