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