CodeCoverageHighlighter.st
author Claus Gittinger <cg@exept.de>
Mon, 15 Jul 2019 15:38:51 +0200
changeset 4458 458a1ac0701d
parent 3606 d5540813bb30
child 4315 734f7d2b6efe
permissions -rw-r--r--
#OTHER by cg unneeded subProjects method removed (already inherited)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3606
d5540813bb30 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
     1
"{ Encoding: utf8 }"
d5540813bb30 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
     2
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
 COPYRIGHT (c) 2010 by eXept Software AG
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
              All Rights Reserved
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 This software is furnished under a license and may be used
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
 hereby transferred.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
"{ Package: 'stx:libcomp' }"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
3606
d5540813bb30 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
    16
"{ NameSpace: Smalltalk }"
d5540813bb30 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
    17
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
AbstractSyntaxHighlighter subclass:#CodeCoverageHighlighter
2524
6e4671c8097d lifted the method instvar
Claus Gittinger <cg@exept.de>
parents: 2495
diff changeset
    19
	instanceVariableNames:'methodInvocationInfo cachedColorForCoveredCode
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
		cachedColorForUncoveredCode'
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
	classVariableNames:''
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
	poolDictionaries:''
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
	category:'System-Compiler'
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
!CodeCoverageHighlighter class methodsFor:'documentation'!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
copyright
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 COPYRIGHT (c) 2010 by eXept Software AG
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
              All Rights Reserved
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 This software is furnished under a license and may be used
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 only in accordance with the terms of that license and with the
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 inclusion of the above copyright notice.   This software may not
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
 be provided or otherwise made available to, or used by, any
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 other person.  No title to or ownership of the software is
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
 hereby transferred.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
documentation
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    colors a method according to some methodInvocationInfo.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
! !
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
!CodeCoverageHighlighter methodsFor:'accessing'!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
colorForCoveredCode
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    cachedColorForCoveredCode isNil ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
        cachedColorForCoveredCode := UserPreferences current colorForInstrumentedFullyCoveredCode
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    ^ cachedColorForCoveredCode
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    "Created: / 28-04-2010 / 12:38:51 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
    "Modified: / 28-04-2010 / 14:08:10 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
colorForUncoveredCode
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
    cachedColorForUncoveredCode isNil ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
        cachedColorForUncoveredCode := UserPreferences current colorForInstrumentedNeverCalledCode
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
    ^ cachedColorForUncoveredCode
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    "Created: / 28-04-2010 / 12:38:51 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    "Modified: / 28-04-2010 / 14:08:16 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
method:aMethod
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    method := aMethod.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    self updateMethodInvocationInfo.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    "Modified: / 28-04-2010 / 13:22:16 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
methodInvocationInfo:something
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    methodInvocationInfo := something.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    "Modified: / 28-04-2010 / 13:38:56 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
sourceText:aString
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    sourceText := aString.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
    self updateMethodInvocationInfo.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    "Created: / 28-04-2010 / 13:22:35 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
updateMethodInvocationInfo
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    (method notNil 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    and:[ method isInstrumented
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    and:[ method source asString string asStringCollection withTabsExpanded asString
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
          = sourceText asString string asStringCollection withTabsExpanded asString]]) ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
        methodInvocationInfo := method methodInvocationInfo
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    ] ifFalse:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
        methodInvocationInfo := nil
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    "Created: / 28-04-2010 / 13:22:02 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    "Modified: / 28-04-2010 / 14:32:02 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
! !
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
!CodeCoverageHighlighter methodsFor:'syntax detection'!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
markArgumentIdentifierFrom:pos1 to:pos2
3606
d5540813bb30 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
   107
    "intentionally left empty"
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
markBlockFrom:pos1 to:pos2
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
"/    methodInvocationInfo notNil ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
"/        method blockInvocationInfo do:[:eachBlockInfo |
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
"/            eachBlockInfo characterPosition = pos1 ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
"/                eachBlockInfo hasBeenExecuted ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
"/                    sourceText 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
"/                        emphasizeFrom:pos1 to:pos2 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
"/                        with:#color->self colorForCoveredCode.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
"/                        "/ with:#backgroundColor->self colorForCoveredCode lightened lightened lightened.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
"/                    ^ self.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
"/                ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
"/            ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
"/        ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
"/    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
"/
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
"/    sourceText 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
"/        emphasizeFrom:pos1 to:pos2 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
"/        with:#color->self colorForUncoveredCode.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
"/        "/ with:#backgroundColor->self colorForUncoveredCode lightened lightened lightened.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
"/
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
"/
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    "Modified: / 28-04-2010 / 15:49:34 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
markBracketAt:pos
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    |level colors clr em|
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    preferences emphasizeParenthesisLevel ifFalse:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
        self 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
            markFrom:pos to:pos 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
            withEmphasis:(preferences bracketEmphasis) 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
            color:(preferences bracketColor).
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
        ^ self
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    level := currentBlock isNil ifTrue:[1] ifFalse:[currentBlock nestingLevel + 2].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
    (sourceText at:pos) = $] ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
        level := level - 1.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
    colors := Array 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
                with:(Color black)
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
                with:(Color blue)
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
                with:(Color green blendWith:(Color grey:30))
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
                with:(Color red blendWith:(Color grey:30))
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
                with:(Color yellow darkened).
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    clr := colors at:((level-1) \\ colors size + 1).
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    em := #normal.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    level > 1 ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
        em := #bold.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    self 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
        markFrom:pos to:pos 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
        withEmphasis:em 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
        color:clr
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
markCommentFrom:pos1 to:pos2
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
    self 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
        markFrom:pos1 to:pos2 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
        withEmphasis:(preferences commentEmphasis) 
3496
0c9b5f469f78 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 2670
diff changeset
   174
        color:(Color gray "preferences commentColor")
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    "
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
     UserPreferences current commentEmphasis
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    "
2495
41b9af0fcb20 changed: #markCommentFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2372
diff changeset
   179
41b9af0fcb20 changed: #markCommentFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2372
diff changeset
   180
    "Modified: / 24-05-2011 / 19:43:31 / cg"
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
2670
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   183
markMethodArgumentIdentifierFrom:pos1 to:pos2
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   184
    self 
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   185
        markFrom:pos1 to:pos2 
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   186
        withEmphasis:(preferences argumentIdentifierEmphasis) 
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   187
        color:(preferences argumentIdentifierColor)
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   188
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   189
    "Created: / 21-08-2011 / 08:12:29 / cg"
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   190
!
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   191
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
markMethodSelectorFrom:pos1 to:pos2
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    |clr|
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
2670
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   195
"/    methodInvocationInfo notNil ifTrue:[
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   196
"/        methodInvocationInfo hasBeenCalled ifTrue:[
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   197
"/            clr := self colorForCoveredCode
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   198
"/        ] ifFalse:[
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   199
"/            clr := self colorForUncoveredCode
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   200
"/        ].
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   201
"/    ].
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   202
"/    clr notNil ifTrue:[
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   203
"/        "/ sourceText emphasizeFrom:1 to:sourceText size with:(#backgroundColor "#color" -> clr lightened lightened).
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   204
"/        sourceText emphasizeFrom:1 to:sourceText size with:(#color -> clr).
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   205
"/    ].
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    self 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
        markFrom:pos1 to:pos2 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
        withEmphasis:(preferences methodSelectorEmphasis) 
2670
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   210
        color:(clr ? preferences methodSelectorColor).
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
"/    emp notNil ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
"/        sourceText emphasisFrom:1 to:sourceText size add:emp.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
"/    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
2670
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   216
    "Modified: / 21-08-2011 / 08:10:36 / cg"
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
markUnknownIdentifierFrom:pos1 to:pos2
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    self 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
        markFrom:pos1 to:pos2 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
        withEmphasis:(preferences unknownIdentifierEmphasis) 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
        color:(preferences unknownIdentifierColor)
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    "Created: / 31.3.1998 / 19:09:26 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    "Modified: / 31.3.1998 / 19:10:30 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
parseMethod
2670
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   230
    |clr|
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   231
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   232
    methodInvocationInfo notNil ifTrue:[
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   233
        methodInvocationInfo hasBeenCalled ifTrue:[
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   234
            clr := self colorForCoveredCode
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   235
        ] ifFalse:[
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   236
            clr := self colorForUncoveredCode
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   237
        ].
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   238
        "/ sourceText emphasizeFrom:1 to:sourceText size with:(#backgroundColor "#color" -> clr lightened lightened).
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   239
        sourceText emphasizeFrom:1 to:sourceText size with:(#color -> clr).
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   240
    ].
5e72a9b660d3 added: #markMethodArgumentIdentifierFrom:to:
Claus Gittinger <cg@exept.de>
parents: 2581
diff changeset
   241
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   242
    super parseMethod.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   243
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   244
    methodInvocationInfo notNil ifTrue:[
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   245
        (method blockInvocationInfo copy sort:[:a :b | a startPosition < b startPosition])
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   246
            do:[:eachBlockInfo |
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   247
                |pos clr|
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   248
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   249
                clr := eachBlockInfo hasBeenExecuted 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   250
                            ifTrue:[ self colorForCoveredCode ]
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   251
                            ifFalse:[ self colorForUncoveredCode ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   252
                sourceText 
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   253
                    emphasizeFrom:eachBlockInfo startPosition to:eachBlockInfo endPosition 
2581
4a9ed916d6f1 experimented with background color - but it looks ugly
Claus Gittinger <cg@exept.de>
parents: 2524
diff changeset
   254
                    "/ with:(#backgroundColor "#color" -> clr lightened lightened)
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   255
                    with:#color->clr.
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   256
            ]
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
    ].
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
    "Created: / 28-04-2010 / 15:49:27 / cg"
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
! !
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
!CodeCoverageHighlighter class methodsFor:'documentation'!
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
version_CVS
3606
d5540813bb30 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 3496
diff changeset
   265
    ^ '$Header: /cvs/stx/stx/libcomp/CodeCoverageHighlighter.st,v 1.7 2015-02-28 00:54:47 cg Exp $'
2372
8f217be79734 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
! !
3496
0c9b5f469f78 class: CodeCoverageHighlighter
Claus Gittinger <cg@exept.de>
parents: 2670
diff changeset
   267