--- a/AbstractSyntaxHighlighter.st Sun Feb 01 22:53:27 2015 +0100
+++ b/AbstractSyntaxHighlighter.st Sun Feb 01 22:53:37 2015 +0100
@@ -11,6 +11,8 @@
"
"{ Package: 'stx:libcomp' }"
+"{ NameSpace: Smalltalk }"
+
Parser subclass:#AbstractSyntaxHighlighter
instanceVariableNames:'method sourceText preferences fullSelectorCheck'
classVariableNames:''
@@ -446,6 +448,33 @@
sourceText emphasizeFrom:pos1 to:p2 with:e
"Created: / 01-06-2012 / 21:44:17 / cg"
+!
+
+mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp ifNil:fontEmp2 color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr
+ |e p2 clr fgClr|
+
+ fgClr := fgClr1 ? fgClr2.
+ (fgClr isNil or:[fgClr = Color black]) ifTrue:[
+ e := fontEmp ? fontEmp2
+ ] ifFalse:[
+ clr := fgClr onDevice:Screen current.
+ (fontEmp ? fontEmp2) isNil ifTrue:[
+ e := (#color->clr)
+ ] ifFalse:[
+ e := Text addEmphasis:(fontEmp ? fontEmp2) to:(#color->clr).
+ ]
+ ].
+ bgClr notNil ifTrue:[
+ e := Text addEmphasis:(#backgroundColor->bgClr) to:e.
+ ].
+ (p2 := pos2) isNil ifTrue:[
+ p2 := sourceText size
+ ] ifFalse:[
+ p2 := p2 min:sourceText size
+ ].
+ sourceText emphasizeFrom:pos1 to:p2 with:e
+
+ "Created: / 01-06-2012 / 21:44:17 / cg"
! !
!AbstractSyntaxHighlighter methodsFor:'accessing'!
@@ -599,6 +628,13 @@
"Created: / 13-02-2012 / 11:48:09 / cg"
!
+markFrom:pos1 to:pos2 withEmphasis:fontEmp ifNil:fontEmp2 color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr
+ self class
+ mark:sourceText from:pos1 to:pos2 withEmphasis:fontEmp ifNil:fontEmp2 color:fgClr1 ifNil:fgClr2 backgroundColor:bgClr
+
+ "Created: / 13-02-2012 / 11:48:09 / cg"
+!
+
markVariable:v
|pos endPos|
@@ -612,13 +648,14 @@
!AbstractSyntaxHighlighter class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.32 2014-06-10 10:21:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.33 2015-02-01 21:53:37 cg Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.32 2014-06-10 10:21:56 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libcomp/AbstractSyntaxHighlighter.st,v 1.33 2015-02-01 21:53:37 cg Exp $'
!
version_SVN
^ '$ Id $'
! !
+