SyntaxHighlighter.st
changeset 1526 e3b13dd2f034
parent 1498 9b4366551a2a
child 1527 7ab05c80445b
--- a/SyntaxHighlighter.st	Mon Jun 28 09:22:50 2004 +0200
+++ b/SyntaxHighlighter.st	Mon Jun 28 09:32:30 2004 +0200
@@ -15,24 +15,8 @@
 "{ Package: 'stx:libcomp' }"
 
 Parser subclass:#SyntaxHighlighter
-	instanceVariableNames:'sourceText identifierColor identifierEmphasis
-		argumentIdentifierColor argumentIdentifierEmphasis
-		localIdentifierColor localIdentifierEmphasis
-		unknownIdentifierColor unknownIdentifierEmphasis
-		badIdentifierColor badIdentifierEmphasis globalIdentifierColor
-		globalIdentifierEmphasis commentColor commentEmphasis
-		methodSelectorEmphasis methodSelectorColor selectorEmphasis
-		selectorColor stringColor stringEmphasis symbolColor
-		symbolEmphasis selfColor selfEmphasis superColor superEmphasis
-		hereColor hereEmphasis thisContextColor thisContextEmphasis
-		booleanConstantColor booleanConstantEmphasis constantColor
-		constantEmphasis bracketColor bracketEmphasis
-		instVarIdentifierColor instVarIdentifierEmphasis returnColor
-		returnEmphasis globalClassIdentifierColor
-		globalClassIdentifierEmphasis classVariableIdentifierColor
-		classVariableIdentifierEmphasis unimplementedSelectorColor
-		unimplementedSelectorEmphasis currentSuperclasses
-		currentSubclasses fullSelectorCheck'
+	instanceVariableNames:'sourceText preferences currentSuperclasses currentSubclasses
+		fullSelectorCheck'
 	classVariableNames:''
 	poolDictionaries:''
 	category:'System-Compiler'
@@ -238,62 +222,14 @@
 !SyntaxHighlighter methodsFor:'initialization'!
 
 initialize
-    |prefs|
-
     super initialize.
 
     foldConstants := false.
     allowDollarInIdentifier := true.
 
-    prefs := UserPreferences current.
+    preferences := UserPreferences current.
 
-    fullSelectorCheck := prefs fullSelectorCheck.
-    identifierEmphasis := prefs identifierEmphasis.
-    identifierColor := prefs identifierColor.
-    argumentIdentifierEmphasis := prefs argumentIdentifierEmphasis.
-    argumentIdentifierColor := prefs argumentIdentifierColor.
-    localIdentifierEmphasis := prefs localIdentifierEmphasis.
-    localIdentifierColor := prefs localIdentifierColor.
-    returnEmphasis := prefs returnEmphasis.
-    returnColor := prefs returnColor.
-    instVarIdentifierEmphasis := prefs instVarIdentifierEmphasis.
-    instVarIdentifierColor := prefs instVarIdentifierColor.
-    globalIdentifierEmphasis := prefs globalIdentifierEmphasis.
-    globalIdentifierColor := prefs globalIdentifierColor.
-    globalClassIdentifierEmphasis := prefs globalClassIdentifierEmphasis.
-    globalClassIdentifierColor := prefs globalClassIdentifierColor.
-    classVariableIdentifierEmphasis := prefs classVariableIdentifierEmphasis.
-    classVariableIdentifierColor := prefs classVariableIdentifierColor.
-    unknownIdentifierEmphasis := prefs unknownIdentifierEmphasis.
-    unknownIdentifierColor := prefs unknownIdentifierColor.
-    badIdentifierEmphasis := prefs badIdentifierEmphasis.
-    badIdentifierColor := prefs badIdentifierColor.
-    commentEmphasis := prefs commentEmphasis.
-    commentColor := prefs commentColor.
-    methodSelectorEmphasis := prefs methodSelectorEmphasis.
-    methodSelectorColor := prefs methodSelectorColor.
-    selectorEmphasis := prefs selectorEmphasis.
-    selectorColor := prefs selectorColor.
-    unimplementedSelectorEmphasis := prefs unimplementedSelectorEmphasis.
-    unimplementedSelectorColor := prefs unimplementedSelectorColor.
-    stringEmphasis := prefs stringEmphasis.
-    stringColor := prefs stringColor.
-    symbolEmphasis := prefs symbolEmphasis.
-    symbolColor := prefs symbolColor.
-    selfEmphasis := prefs selfEmphasis.
-    selfColor := prefs selfColor.
-    hereEmphasis := prefs hereEmphasis.
-    hereColor := prefs hereColor.
-    superEmphasis := prefs superEmphasis.
-    superColor := prefs superColor.
-    thisContextEmphasis := prefs thisContextEmphasis.
-    thisContextColor := prefs thisContextColor.
-    constantEmphasis := prefs constantEmphasis.
-    constantColor := prefs constantColor.
-    booleanConstantEmphasis := prefs booleanConstantEmphasis.
-    booleanConstantColor := prefs booleanConstantColor.
-    bracketEmphasis := prefs bracketEmphasis.
-    bracketColor := prefs bracketColor.
+    fullSelectorCheck := preferences fullSelectorCheck.
 
     "Created: / 31.3.1998 / 15:12:55 / cg"
     "Modified: / 5.1.1980 / 00:44:03 / cg"
@@ -328,7 +264,7 @@
 markArgumentIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:argumentIdentifierEmphasis color:argumentIdentifierColor
+        withEmphasis:(preferences argumentIdentifierEmphasis) color:(preferences argumentIdentifierColor)
 
     "Modified: / 31.3.1998 / 18:01:27 / cg"
 !
@@ -336,14 +272,13 @@
 markBadIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:badIdentifierEmphasis color:badIdentifierColor
-
+        withEmphasis:(preferences badIdentifierEmphasis) color:(preferences badIdentifierColor)
 !
 
 markBooleanConstantFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:booleanConstantEmphasis color:booleanConstantColor
+        withEmphasis:(preferences booleanConstantEmphasis) color:(preferences booleanConstantColor)
 
     "Created: / 31.3.1998 / 18:09:01 / cg"
     "Modified: / 31.3.1998 / 19:36:44 / cg"
@@ -352,7 +287,7 @@
 markBracketAt:pos
     self 
         markFrom:pos to:pos 
-        withEmphasis:bracketEmphasis color:bracketColor
+        withEmphasis:(preferences bracketEmphasis) color:(preferences bracketColor)
 
     "Created: / 31.3.1998 / 18:09:01 / cg"
     "Modified: / 31.3.1998 / 19:36:44 / cg"
@@ -361,7 +296,7 @@
 markClassVariableIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:classVariableIdentifierEmphasis color:classVariableIdentifierColor
+        withEmphasis:(preferences classVariableIdentifierEmphasis) color:(preferences classVariableIdentifierColor)
 
     "Modified: / 31.3.1998 / 18:02:14 / cg"
 !
@@ -369,15 +304,15 @@
 markCommentFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:commentEmphasis color:commentColor
+        withEmphasis:(preferences commentEmphasis) color:(preferences commentColor)
 
-    "Modified: / 31.3.1998 / 18:01:55 / cg"
+ "Modified: / 31.3.1998 / 18:01:55 / cg"
 !
 
 markConstantFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:constantEmphasis color:constantColor
+        withEmphasis:(preferences constantEmphasis) color:(preferences constantColor)
 
     "Modified: / 31.3.1998 / 18:01:44 / cg"
     "Created: / 31.3.1998 / 18:09:22 / cg"
@@ -411,7 +346,7 @@
 markGlobalClassIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:globalClassIdentifierEmphasis color:globalClassIdentifierColor
+        withEmphasis:(preferences globalClassIdentifierEmphasis) color:(preferences globalClassIdentifierColor)
 
     "Modified: / 31.3.1998 / 18:02:14 / cg"
     "Created: / 4.3.1999 / 12:53:02 / cg"
@@ -420,7 +355,7 @@
 markGlobalIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:globalIdentifierEmphasis color:globalIdentifierColor
+        withEmphasis:(preferences globalIdentifierEmphasis) color:(preferences globalIdentifierColor)
 
     "Modified: / 31.3.1998 / 18:02:14 / cg"
 !
@@ -428,7 +363,7 @@
 markHereFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:hereEmphasis color:hereColor
+        withEmphasis:(preferences hereEmphasis) color:(preferences hereColor)
 
     "Modified: / 31.3.1998 / 18:02:25 / cg"
 !
@@ -436,7 +371,7 @@
 markIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:identifierEmphasis color:identifierColor
+        withEmphasis:(preferences identifierEmphasis) color:(preferences identifierColor)
 
     "Modified: / 31.3.1998 / 18:02:39 / cg"
     "Created: / 31.3.1998 / 18:04:56 / cg"
@@ -445,7 +380,7 @@
 markInstVarIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:instVarIdentifierEmphasis color:instVarIdentifierColor
+        withEmphasis:(preferences instVarIdentifierEmphasis) color:(preferences instVarIdentifierColor)
 
     "Created: / 16.4.1998 / 18:35:40 / cg"
     "Modified: / 16.4.1998 / 18:37:30 / cg"
@@ -454,7 +389,7 @@
 markLocalIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:localIdentifierEmphasis color:localIdentifierColor
+        withEmphasis:(preferences localIdentifierEmphasis) color:(preferences localIdentifierColor)
 
     "Modified: / 31.3.1998 / 18:02:39 / cg"
 !
@@ -462,7 +397,7 @@
 markMethodSelectorFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:methodSelectorEmphasis color:methodSelectorColor
+        withEmphasis:(preferences methodSelectorEmphasis) color:(preferences methodSelectorColor)
 
     "Modified: / 31.3.1998 / 18:02:52 / cg"
 !
@@ -470,7 +405,7 @@
 markReturnAt:pos
     self 
         markFrom:pos to:pos 
-        withEmphasis:returnEmphasis color:returnColor
+        withEmphasis:(preferences returnEmphasis) color:(preferences returnColor)
 
     "Modified: / 31.3.1998 / 19:36:44 / cg"
     "Created: / 5.1.1980 / 00:44:27 / cg"
@@ -496,8 +431,8 @@
 "/        ^ self
 "/    ].
 
-    fg := selectorColor.
-    em := selectorEmphasis.
+    fg := preferences selectorColor.
+    em := preferences selectorEmphasis.
     selectorSymbol := selectorString asSymbolIfInterned.
     selectorSymbol isNil ifTrue:[
         fg := Color red.
@@ -536,8 +471,8 @@
             ].
 
             ok ifFalse:[
-                em := unimplementedSelectorEmphasis.
-                fg := unimplementedSelectorColor.
+                em := preferences unimplementedSelectorEmphasis.
+                fg := preferences unimplementedSelectorColor.
             ]
         ]
     ].
@@ -551,7 +486,7 @@
 markSelfFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:selfEmphasis color:selfColor
+        withEmphasis:(preferences selfEmphasis) color:(preferences selfColor)
 
     "Modified: / 31.3.1998 / 18:03:10 / cg"
 !
@@ -559,7 +494,7 @@
 markStringFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:stringEmphasis color:stringColor
+        withEmphasis:(preferences stringEmphasis) color:(preferences stringColor)
 
     "Modified: / 31.3.1998 / 18:03:18 / cg"
 !
@@ -567,7 +502,7 @@
 markSuperFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:superEmphasis color:superColor
+        withEmphasis:(preferences superEmphasis) color:(preferences superColor)
 
     "Modified: / 31.3.1998 / 18:03:26 / cg"
 !
@@ -575,7 +510,7 @@
 markSymbolFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:symbolEmphasis color:symbolColor
+        withEmphasis:(preferences symbolEmphasis) color:(preferences symbolColor)
 
     "Created: / 1.4.1998 / 12:56:47 / cg"
     "Modified: / 1.4.1998 / 12:58:00 / cg"
@@ -584,7 +519,7 @@
 markThisContextFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:thisContextEmphasis color:thisContextColor
+        withEmphasis:(preferences thisContextEmphasis) color:(preferences thisContextColor)
 
     "Modified: / 31.3.1998 / 18:03:36 / cg"
 !
@@ -592,7 +527,7 @@
 markUnknownIdentifierFrom:pos1 to:pos2
     self 
         markFrom:pos1 to:pos2 
-        withEmphasis:unknownIdentifierEmphasis color:unknownIdentifierColor
+        withEmphasis:(preferences unknownIdentifierEmphasis) color:(preferences unknownIdentifierColor)
 
     "Created: / 31.3.1998 / 19:09:26 / cg"
     "Modified: / 31.3.1998 / 19:10:30 / cg"
@@ -656,5 +591,5 @@
 !SyntaxHighlighter class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.43 2004-03-19 13:14:20 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.44 2004-06-28 07:32:30 ca Exp $'
 ! !