SyntaxHighlighter.st
author Claus Gittinger <cg@exept.de>
Wed, 25 Mar 2009 12:39:01 +0100
changeset 2170 907aa03513e4
parent 2087 42c0f2fe415d
child 2177 82f1c329a959
permissions -rw-r--r--
*** empty log message ***
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 1998 by eXept Software AG
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
1110
3e08a12956fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 990
diff changeset
    12
"{ Package: 'stx:libcomp' }"
3e08a12956fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 990
diff changeset
    13
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
Parser subclass:#SyntaxHighlighter
1526
e3b13dd2f034 *** empty log message ***
ca
parents: 1498
diff changeset
    15
	instanceVariableNames:'sourceText preferences currentSuperclasses currentSubclasses
1802
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
    16
		fullSelectorCheck cachedLocalIdentifierEmphasis
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
    17
		cachedLocalIdentifierColor cachedStringEmphasis cachedStringColor'
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'System-Compiler'
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!SyntaxHighlighter class methodsFor:'documentation'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
copyright
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
 COPYRIGHT (c) 1998 by eXept Software AG
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
              All Rights Reserved
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 This software is furnished under a license and may be used
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 only in accordance with the terms of that license and with the
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 be provided or otherwise made available to, or used by, any
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
 other person.  No title to or ownership of the software is
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
 hereby transferred.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
681
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    39
!
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    40
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    41
documentation
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    42
"
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    43
    colors a method.
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    44
"
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    45
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    46
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
!SyntaxHighlighter class methodsFor:'highlighting'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
1527
7ab05c80445b *** empty log message ***
ca
parents: 1526
diff changeset
    51
formatClassDefinition:aString in:aClass
7ab05c80445b *** empty log message ***
ca
parents: 1526
diff changeset
    52
    "format (recolor) a class definition expression in a given class.
7ab05c80445b *** empty log message ***
ca
parents: 1526
diff changeset
    53
     Return the text containing font changes and color information."
7ab05c80445b *** empty log message ***
ca
parents: 1526
diff changeset
    54
7ab05c80445b *** empty log message ***
ca
parents: 1526
diff changeset
    55
    ^ self formatExpression:aString in:aClass
7ab05c80445b *** empty log message ***
ca
parents: 1526
diff changeset
    56
!
7ab05c80445b *** empty log message ***
ca
parents: 1526
diff changeset
    57
684
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    58
formatExpression:aString in:aClass
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    59
    "format (recolor) an expression in a given class.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    60
     Return the text containing font changes and color information."
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    61
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    62
    |parser tree text endPos|
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    63
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    64
    aString isNil ifTrue:[^ nil].
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    65
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    66
    parser := self for:(ReadStream on:aString string) in:aClass.
1365
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1308
diff changeset
    67
    parser ignoreErrors:true.
19b74038d133 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 1308
diff changeset
    68
    parser ignoreWarnings:true.
684
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    69
    parser sourceText:(text := aString string asText).
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    70
    "/ use an array here - this can be changed much faster using #at:put:
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    71
    text emphasisCollection:(Array new:aString size).
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    72
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    73
    parser nextToken.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    74
    tree := parser expression.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    75
    "/ now, convert the emphasis-array to a runArray
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    76
    text emphasisCollection:(text emphasis asRunArray).
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    77
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    78
    tree == #Error ifTrue:[
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    79
        "/ mhmh - which is better ...
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    80
        "/ alternative1: color rest after error in red
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    81
"/        text 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    82
"/            emphasizeFrom:(parser sourceStream position) 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    83
"/            to:text size 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    84
"/            with:(#color->Color red).
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    85
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    86
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    87
        "/ alternative2: take original emphasis for rest
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    88
1371
de4c37ac12fc code rewritten to be independent of stream zero-base
Claus Gittinger <cg@exept.de>
parents: 1365
diff changeset
    89
        endPos := parser sourceStream position1Based.
684
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    90
        endPos >= text size ifTrue:[
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    91
            ^ text
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    92
        ].
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    93
        ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    94
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    95
        "/ alternative3: no emphasis for rest.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    96
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    97
"/        ^ text "/ aString
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    98
    ].
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    99
    ^ text
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   100
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   101
    "
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   102
     self
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   103
        formatExpression:'(1 + 2) max:5' 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   104
        in:UndefinedObject
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   105
    "
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   106
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   107
    "Modified: / 7.4.1998 / 09:57:19 / cg"
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   108
    "Created: / 9.4.1998 / 16:57:16 / cg"
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   109
!
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   110
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
formatMethod:aString in:aClass
680
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   112
    "format (recolor) a method in a given class.
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   113
     Return the text containing font changes and color information."
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   115
    ^ self formatMethod:aString in:aClass using:nil
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   116
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   117
    "
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   118
     self
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   119
        formatMethod:'foo 
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   120
    ^ self bar:''hello''.
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   121
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   122
    ' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   123
'
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   124
        in:UndefinedObject
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   125
    "
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   126
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   127
    "Modified: / 23.10.1998 / 22:48:45 / cg"
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   128
!
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   129
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   130
formatMethod:aString in:aClass using:preferencesOrNil
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   131
    "format (recolor) a method in a given class.
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   132
     Return the text containing font changes and color information."
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   133
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   134
    |highlighter tree text endPos eColor|
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    aString isNil ifTrue:[^ nil].
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
1110
3e08a12956fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 990
diff changeset
   138
    Error handle:[:ex |
1857
4d7e1edb44cd error handling
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   139
        ex signal isHandled ifTrue:[
4d7e1edb44cd error handling
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   140
            ex reject.    
4d7e1edb44cd error handling
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   141
        ].
2087
42c0f2fe415d Do not write Warning messages about parse errors
Stefan Vogel <sv@exept.de>
parents: 2070
diff changeset
   142
        (self parseErrorSignal handles:ex) ifFalse:[
42c0f2fe415d Do not write Warning messages about parse errors
Stefan Vogel <sv@exept.de>
parents: 2070
diff changeset
   143
            "Parse error may happen when re-formatting incomplete code while editing"
42c0f2fe415d Do not write Warning messages about parse errors
Stefan Vogel <sv@exept.de>
parents: 2070
diff changeset
   144
            ('SyntaxHighlighter [info]: error during highlight: ' , ex description) infoPrintCR.
42c0f2fe415d Do not write Warning messages about parse errors
Stefan Vogel <sv@exept.de>
parents: 2070
diff changeset
   145
            "/ ex suspendedContext fullPrintAll.
42c0f2fe415d Do not write Warning messages about parse errors
Stefan Vogel <sv@exept.de>
parents: 2070
diff changeset
   146
        ].
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   147
        ^ aString
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   148
    ] do:[
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   149
        highlighter := self for:(ReadStream on:aString string) in:aClass.
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   150
        preferencesOrNil notNil ifTrue:[highlighter preferences:preferencesOrNil].
1857
4d7e1edb44cd error handling
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   151
        "/ highlighter ignoreErrors:true.
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   152
        highlighter ignoreWarnings:true.
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   153
        highlighter sourceText:(text := aString string asText).
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   154
        "/ use an array here - this can be changed much faster using #at:put:
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   155
        text emphasisCollection:(Array new:aString size).
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   157
        tree := highlighter parseMethod.
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   158
        "/ now, convert the emphasis-array to a runArray
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   159
        text emphasisCollection:(text emphasis asRunArray).
680
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   160
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   161
        tree == #Error ifTrue:[
889
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   162
            eColor := UserPreferences current errorColor.
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   163
            eColor notNil ifTrue:[
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   164
                "/ mhmh - which is better ...
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   165
                "/ alternative1: color rest after error in red
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   166
                text 
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   167
                    emphasizeFrom:(highlighter sourceStream position1Based) 
889
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   168
                    to:text size 
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   169
                    with:(#color->eColor).
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   170
            ] ifFalse:[
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   171
                "/ alternative2: take original emphasis for rest
680
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   172
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   173
                endPos := highlighter sourceStream position1Based.
889
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   174
                endPos >= text size ifTrue:[
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   175
                    ^ text
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   176
                ].
554145ef6046 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 884
diff changeset
   177
                ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   178
            ].
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   179
            "/ alternative3: no emphasis for rest.
678
da6c65951755 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
   180
        ].
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   181
        ^ text
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   182
    ]
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    "
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
     self
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
        formatMethod:'foo 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    ^ self bar:''hello''.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    ' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
'
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
        in:UndefinedObject
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    "
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
1857
4d7e1edb44cd error handling
Claus Gittinger <cg@exept.de>
parents: 1802
diff changeset
   193
    "Modified: / 22-08-2006 / 13:32:04 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
!SyntaxHighlighter methodsFor:'accessing'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   198
preferences:something
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   199
    preferences := something.
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   200
!
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   201
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
sourceText
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
    "return the value of the instance variable 'sourceText' (automatically generated)"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
    ^ sourceText
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    "Created: / 31.3.1998 / 11:49:05 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
sourceText:something
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    "set the value of the instance variable 'sourceText' (automatically generated)"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    sourceText := something.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    "Created: / 31.3.1998 / 11:49:05 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
948
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   218
!SyntaxHighlighter methodsFor:'error handling'!
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   219
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   220
parseError:aMessage position:position to:endPos
1174
30ff886ef43e remove error output on Transcript
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   221
"/ Transcript showCR:aMessage.
948
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   222
    super parseError:aMessage position:position to:endPos.
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   223
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   224
    self 
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   225
        markFrom:position to:endPos 
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   226
        withEmphasis:nil color:UserPreferences current errorColor
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   227
!
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   228
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   229
showErrorMessage:aMessage position:pos
1174
30ff886ef43e remove error output on Transcript
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   230
"/ Transcript showCR:aMessage.
948
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   231
    super showErrorMessage:aMessage position:pos.
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   232
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   233
    self 
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   234
        markFrom:pos to:nil 
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   235
        withEmphasis:nil color:UserPreferences current errorColor
978
9c62352be67b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
   236
!
9c62352be67b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
   237
1169
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   238
syntaxError:aMessage position:position to:endPos
1174
30ff886ef43e remove error output on Transcript
Claus Gittinger <cg@exept.de>
parents: 1170
diff changeset
   239
"/ Transcript showCR:aMessage.
1169
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   240
    super syntaxError:aMessage position:position to:endPos.
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   241
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   242
    self 
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   243
        markFrom:position to:endPos 
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   244
        withEmphasis:nil color:UserPreferences current errorColor
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   245
!
7204e72c7c3c better error message with bad parentNesting in a block.
Claus Gittinger <cg@exept.de>
parents: 1159
diff changeset
   246
978
9c62352be67b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
   247
warning:msg position:pos1 to:pos2
979
2f20ef7dc8c0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   248
"/    self markUnknownIdentifierFrom:pos1 to:pos2
2f20ef7dc8c0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   249
978
9c62352be67b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
   250
"/    self
9c62352be67b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
   251
"/        markFrom:pos1 to:pos2 
9c62352be67b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
   252
"/        withEmphasis:nil color:UserPreferences current errorColor
9c62352be67b checkin from browser
Claus Gittinger <cg@exept.de>
parents: 948
diff changeset
   253
979
2f20ef7dc8c0 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 978
diff changeset
   254
    "Modified: / 25.9.1999 / 18:42:30 / cg"
948
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   255
! !
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   256
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   257
!SyntaxHighlighter methodsFor:'initialization'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   258
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
initialize
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
    super initialize.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
990
cd1aa00086fd dont care to fold constants during syntaxHighlight
Claus Gittinger <cg@exept.de>
parents: 987
diff changeset
   262
    foldConstants := false.
1636
98afdcdacde8 compilerflags separated into ParserFlags.
Claus Gittinger <cg@exept.de>
parents: 1553
diff changeset
   263
"/    parserFlags allowDollarInIdentifier:true.
990
cd1aa00086fd dont care to fold constants during syntaxHighlight
Claus Gittinger <cg@exept.de>
parents: 987
diff changeset
   264
1526
e3b13dd2f034 *** empty log message ***
ca
parents: 1498
diff changeset
   265
    preferences := UserPreferences current.
868
f49c96b8c843 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 865
diff changeset
   266
1526
e3b13dd2f034 *** empty log message ***
ca
parents: 1498
diff changeset
   267
    fullSelectorCheck := preferences fullSelectorCheck.
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
    "Created: / 31.3.1998 / 15:12:55 / cg"
838
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   270
    "Modified: / 5.1.1980 / 00:44:03 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   272
788
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   273
!SyntaxHighlighter methodsFor:'misc'!
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   274
1905
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   275
controlFlowSelectors
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   276
    ^ #(
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   277
        ifTrue:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   278
        ifFalse:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   279
        ifTrue:ifFalse:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   280
        ifFalse:ifTrue:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   281
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   282
        whileTrue:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   283
        whileFalse:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   284
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   285
        to:do:
2170
907aa03513e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   286
        downTo:do:
1905
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   287
        to:by:do:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   288
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   289
        loop
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   290
        whileTrue
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   291
        whileFalse
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   292
        doWhile:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   293
        doUntil:
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   294
    )
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   295
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   296
    "Created: / 08-09-2006 / 15:56:47 / cg"
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   297
!
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   298
788
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   299
defineAsUndeclaredVariable:aName
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   300
    "redefined to NOT declare undefined vars"
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   301
1308
4a5853596d8e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1174
diff changeset
   302
    ^ VariableNode globalNamed:aName
788
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   303
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   304
    "Modified: / 19.10.1998 / 19:38:12 / cg"
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   305
!
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   306
884
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   307
isSyntaxHighlighter
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   308
    ^ true
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   309
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   310
!
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   311
788
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   312
plausibilityCheck:aNode
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   313
    "redefined to NOT do checks"
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   314
902
4ceee83e5e07 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 889
diff changeset
   315
    ^ nil
788
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   316
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   317
    "Modified: / 19.10.1998 / 19:38:12 / cg"
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   318
    "Created: / 19.10.1998 / 19:57:18 / cg"
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   319
! !
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   320
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
!SyntaxHighlighter methodsFor:'syntax detection'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
markArgumentIdentifierFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   326
        withEmphasis:(preferences argumentIdentifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   327
        color:(preferences argumentIdentifierColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
    "Modified: / 31.3.1998 / 18:01:27 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
884
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   332
markBadIdentifierFrom:pos1 to:pos2
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   333
    self 
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   334
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   335
        withEmphasis:(preferences badIdentifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   336
        color:(preferences badIdentifierColor)
884
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   337
!
5ec4b67dce33 mark bad identifiers
Claus Gittinger <cg@exept.de>
parents: 870
diff changeset
   338
2055
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   339
markBlockFrom:pos1 to:pos2
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   340
    #experimental.
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   341
"/    |level color|
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   342
"/
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   343
"/    level := currentBlock isNil ifTrue:[1] ifFalse:[currentBlock nestingLevel+1].
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   344
"/    color := (Array 
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   345
"/                with:Color yellow
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   346
"/                with:Color lightGrey) at:level\\2+1.
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   347
"/    self 
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   348
"/        markFrom:pos1 to:pos2 
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   349
"/        withAddedEmphasis:(#backgroundColor->color)
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   350
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   351
    "Created: / 15-01-2008 / 11:48:51 / cg"
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   352
!
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   353
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
markBooleanConstantFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   357
        withEmphasis:(preferences booleanConstantEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   358
        color:(preferences booleanConstantColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
    "Created: / 31.3.1998 / 18:09:01 / cg"
665
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   361
    "Modified: / 31.3.1998 / 19:36:44 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
673
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   364
markBracketAt:pos
2070
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   365
    |level colors clr em|
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   366
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   367
    preferences emphasizeParenthesisLevel ifFalse:[
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   368
        self 
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   369
            markFrom:pos to:pos 
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   370
            withEmphasis:(preferences bracketEmphasis) 
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   371
            color:(preferences bracketColor).
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   372
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   373
        ^ self
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   374
    ].
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   375
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   376
    level := currentBlock isNil ifTrue:[1] ifFalse:[currentBlock nestingLevel + 2].
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   377
    (sourceText at:pos) = $] ifTrue:[
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   378
        level := level - 1.
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   379
    ].
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   380
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   381
    colors := Array 
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   382
                with:(Color black)
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   383
                with:(Color blue)
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   384
                with:(Color green blendWith:(Color grey:30))
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   385
                with:(Color red blendWith:(Color grey:30))
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   386
                with:(Color yellow darkened).
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   387
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   388
    clr := colors at:((level-1) \\ colors size + 1).
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   389
    em := #normal.
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   390
    level > 1 ifTrue:[
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   391
        em := #bold.
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   392
    ].
673
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   393
    self 
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   394
        markFrom:pos to:pos 
2070
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   395
        withEmphasis:em 
1f4574d55b53 bracket level
Claus Gittinger <cg@exept.de>
parents: 2055
diff changeset
   396
        color:clr
673
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   397
!
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   398
870
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   399
markClassVariableIdentifierFrom:pos1 to:pos2
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   400
    self 
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   401
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   402
        withEmphasis:(preferences classVariableIdentifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   403
        color:(preferences classVariableIdentifierColor)
870
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   404
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   405
    "Modified: / 31.3.1998 / 18:02:14 / cg"
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   406
!
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   407
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   408
markCommentFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   409
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   410
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   411
        withEmphasis:(preferences commentEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   412
        color:(preferences commentColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   413
1550
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   414
    "
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   415
     UserPreferences current commentEmphasis
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   416
    "
aed158a284b7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1527
diff changeset
   417
    "Modified: / 31.3.1998 / 18:01:55 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   418
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   419
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   420
markConstantFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   421
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   422
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   423
        withEmphasis:(preferences constantEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   424
        color:(preferences constantColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   425
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   426
    "Modified: / 31.3.1998 / 18:01:44 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
    "Created: / 31.3.1998 / 18:09:22 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
2055
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   430
markFrom:pos1 to:pos2 withAddedEmphasis:addedEmphasis
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   431
    sourceText emphasisFrom:pos1 to:pos2 add:addedEmphasis
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   432
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   433
    "Created: / 15-01-2008 / 11:48:18 / cg"
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   434
!
b04faf4243fd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1905
diff changeset
   435
987
49a05e400448 aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents: 979
diff changeset
   436
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn
49a05e400448 aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents: 979
diff changeset
   437
    |e p2 clr|
49a05e400448 aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents: 979
diff changeset
   438
49a05e400448 aquire device colors - faster on pseudoColor devices.
Claus Gittinger <cg@exept.de>
parents: 979
diff changeset
   439
    clr := clrIn onDevice:Screen current.
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   440
669
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   441
    clr = Color black ifTrue:[
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   442
        e := fontEmp
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   443
    ] ifFalse:[
948
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   444
        fontEmp isNil ifTrue:[
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   445
            e := (#color->clr)
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   446
        ] ifFalse:[
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   447
            e := Text addEmphasis:fontEmp to:(#color->clr).
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   448
        ]
669
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   449
    ].
948
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   450
    (p2 := pos2) isNil ifTrue:[
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   451
        p2 := sourceText size
1143
3a9ddfa26b16 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
   452
    ] ifFalse:[
3a9ddfa26b16 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1132
diff changeset
   453
        p2 := p2 min:sourceText size
948
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   454
    ].
6ba29fe774f2 show earliest possible error position.
Claus Gittinger <cg@exept.de>
parents: 902
diff changeset
   455
    sourceText emphasizeFrom:pos1 to:p2 with:e
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   456
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   457
    "Created: / 31.3.1998 / 13:26:53 / cg"
669
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   458
    "Modified: / 1.4.1998 / 12:51:56 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   459
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   460
822
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   461
markGlobalClassIdentifierFrom:pos1 to:pos2
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   462
    self 
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   463
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   464
        withEmphasis:(preferences globalClassIdentifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   465
        color:(preferences globalClassIdentifierColor)
822
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   466
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   467
    "Modified: / 31.3.1998 / 18:02:14 / cg"
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   468
    "Created: / 4.3.1999 / 12:53:02 / cg"
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   469
!
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   470
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   471
markGlobalIdentifierFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   472
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   473
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   474
        withEmphasis:(preferences globalIdentifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   475
        color:(preferences globalIdentifierColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   476
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   477
    "Modified: / 31.3.1998 / 18:02:14 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   478
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   479
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   480
markHereFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   481
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   482
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   483
        withEmphasis:(preferences hereEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   484
        color:(preferences hereColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
    "Modified: / 31.3.1998 / 18:02:25 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
markIdentifierFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   490
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   492
        withEmphasis:(preferences identifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   493
        color:(preferences identifierColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   494
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   495
    "Modified: / 31.3.1998 / 18:02:39 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   496
    "Created: / 31.3.1998 / 18:04:56 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   497
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   498
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   499
markInstVarIdentifierFrom:pos1 to:pos2
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   500
    self 
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   501
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   502
        withEmphasis:(preferences instVarIdentifierEmphasis)    
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   503
        color:(preferences instVarIdentifierColor)
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   504
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   505
    "Created: / 16.4.1998 / 18:35:40 / cg"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   506
    "Modified: / 16.4.1998 / 18:37:30 / cg"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   507
!
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   508
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   509
markLocalIdentifierFrom:pos1 to:pos2
1802
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   510
    cachedLocalIdentifierEmphasis isNil ifTrue:[
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   511
        cachedLocalIdentifierEmphasis := preferences localIdentifierEmphasis.
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   512
        cachedLocalIdentifierColor := preferences localIdentifierColor.
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   513
    ].
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   514
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   515
        markFrom:pos1 to:pos2 
1802
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   516
        withEmphasis:cachedLocalIdentifierEmphasis 
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   517
        color:cachedLocalIdentifierColor
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   518
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   519
    "Modified: / 31.3.1998 / 18:02:39 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   520
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   521
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   522
markMethodSelectorFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   523
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   524
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   525
        withEmphasis:(preferences methodSelectorEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   526
        color:(preferences methodSelectorColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   527
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   528
    "Modified: / 31.3.1998 / 18:02:52 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   529
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   530
1684
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   531
markNumberConstantFrom:pos1 to:pos2
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   532
    self 
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   533
        markFrom:pos1 to:pos2 
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   534
        withEmphasis:(preferences numberConstantEmphasis) 
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   535
        color:(preferences numberConstantColor)
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   536
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   537
    "Modified: / 31.3.1998 / 18:01:44 / cg"
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   538
    "Created: / 31.3.1998 / 18:09:22 / cg"
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   539
!
e9d1d09ca914 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1640
diff changeset
   540
1640
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   541
markParenthesisAt:pos
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   542
    |colors clr em|
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   543
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   544
    preferences emphasizeParenthesisLevel ifFalse:[^ self].
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   545
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   546
    colors := Array 
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   547
                with:(Color black)
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   548
                with:(Color blue)
1757
c1edf49e8f9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
   549
                with:(Color green blendWith:(Color grey:30))
c1edf49e8f9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
   550
                with:(Color red blendWith:(Color grey:30))
1640
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   551
                with:(Color yellow darkened).
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   552
                        
1757
c1edf49e8f9f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1684
diff changeset
   553
    clr := colors at:((parenthesisLevel-1) \\ colors size + 1).
1640
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   554
    em := #normal.
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   555
    parenthesisLevel > 1 ifTrue:[
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   556
        em := #bold.
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   557
    ].
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   558
    self 
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   559
        markFrom:pos to:pos 
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   560
        withEmphasis:em 
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   561
        color:clr
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   562
!
261459ccc704 emphasize parenthesis nesting
Claus Gittinger <cg@exept.de>
parents: 1636
diff changeset
   563
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   564
markPoolVariableIdentifierFrom:pos1 to:pos2
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   565
    self 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   566
        markFrom:pos1 to:pos2 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   567
        withEmphasis:(preferences poolVariableIdentifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   568
        color:(preferences poolVariableIdentifierColor)
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   569
!
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   570
838
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   571
markReturnAt:pos
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   572
    self 
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   573
        markFrom:pos to:pos 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   574
        withEmphasis:(preferences returnEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   575
        color:(preferences returnColor)
838
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   576
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   577
    "Modified: / 31.3.1998 / 19:36:44 / cg"
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   578
    "Created: / 5.1.1980 / 00:44:27 / cg"
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   579
!
fd3286584da6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 823
diff changeset
   580
863
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   581
markSelector:selectorString from:pos1 to:pos2 receiverNode:aReceiverNode
1498
9b4366551a2a speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents: 1396
diff changeset
   582
    |fg selectorSymbol check ok rec em|
863
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   583
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   584
"/ uncommenting the code below
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   585
"/ will suppress highlighting of common selectors ...
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   586
"/
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   587
"/    (#(
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   588
"/        'ifTrue:' 
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   589
"/        'ifFalse:'
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   590
"/        'not'
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   591
"/        'and:'
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   592
"/        'or:'
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   593
"/        '='
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   594
"/        '=='
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   595
"/        '~='
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   596
"/        '~~'
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   597
"/    ) includes:sel) ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   598
"/        ^ self
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   599
"/    ].
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   600
1526
e3b13dd2f034 *** empty log message ***
ca
parents: 1498
diff changeset
   601
    fg := preferences selectorColor.
e3b13dd2f034 *** empty log message ***
ca
parents: 1498
diff changeset
   602
    em := preferences selectorEmphasis.
1498
9b4366551a2a speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents: 1396
diff changeset
   603
    selectorSymbol := selectorString asSymbolIfInterned.
9b4366551a2a speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents: 1396
diff changeset
   604
    selectorSymbol isNil ifTrue:[
1905
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   605
        em := preferences unimplementedSelectorEmphasis.
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   606
        fg := preferences unimplementedSelectorColor.
1498
9b4366551a2a speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents: 1396
diff changeset
   607
    ] ifFalse:[
1905
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   608
        ok := true.
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   609
863
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   610
        fullSelectorCheck == true ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   611
1498
9b4366551a2a speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents: 1396
diff changeset
   612
            check := [:cls | (cls includesSelector:selectorSymbol)
9b4366551a2a speed up symbol checking and generation
Stefan Vogel <sv@exept.de>
parents: 1396
diff changeset
   613
                             or:[cls class includesSelector:selectorSymbol]].
863
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   614
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   615
            ok := false.
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   616
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   617
            "/ limit search if possible
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   618
            (classToCompileFor notNil
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   619
             and:[aReceiverNode isSelf or:[aReceiverNode isSuper]]) ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   620
                currentSuperclasses isNil ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   621
                    currentSuperclasses := classToCompileFor withAllSuperclasses.
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   622
                ].
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   623
                ok := currentSuperclasses contains:check.
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   624
                (ok not and:[aReceiverNode isSelf]) ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   625
                    currentSubclasses isNil ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   626
                        currentSubclasses := classToCompileFor allSubclasses.
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   627
                    ].
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   628
                    ok := currentSubclasses contains:check.
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   629
                ].
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   630
            ] ifFalse:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   631
                aReceiverNode isConstant ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   632
                    ok := aReceiverNode evaluate class withAllSuperclasses contains:check.
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   633
                ] ifFalse:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   634
                    (aReceiverNode isGlobal 
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   635
                    and:[(rec := aReceiverNode evaluate) isBehavior]) ifTrue:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   636
                        ok := rec class withAllSuperclasses contains:check.
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   637
                    ] ifFalse:[
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   638
                        ok := Smalltalk allClasses contains:check
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   639
                    ]
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   640
                ]
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   641
            ].
1905
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   642
        ].
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   643
        ok ifFalse:[
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   644
            em := preferences unimplementedSelectorEmphasis.
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   645
            fg := preferences unimplementedSelectorColor.
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   646
        ] ifTrue:[
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   647
            (self controlFlowSelectors includesIdentical:selectorSymbol) ifTrue:[
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   648
                em := preferences controlFlowSelectorEmphasis.
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   649
                fg := preferences controlFlowSelectorColor.
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   650
            ].
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   651
        ].
863
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   652
    ].
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   653
    self
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   654
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   655
        withEmphasis:em 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   656
        color:fg
863
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   657
1905
fba079d9d509 control flow color&emphasis
Claus Gittinger <cg@exept.de>
parents: 1857
diff changeset
   658
    "Modified: / 08-09-2006 / 15:57:02 / cg"
863
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   659
!
4e8b99196457 better selector checks
Claus Gittinger <cg@exept.de>
parents: 838
diff changeset
   660
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   661
markSelfFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   662
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   663
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   664
        withEmphasis:(preferences selfEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   665
        color:(preferences selfColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   666
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   667
    "Modified: / 31.3.1998 / 18:03:10 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   668
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   669
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   670
markStringFrom:pos1 to:pos2
1802
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   671
    cachedStringEmphasis isNil ifTrue:[
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   672
        cachedStringEmphasis := preferences stringEmphasis.
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   673
        cachedStringColor := preferences stringColor.
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   674
    ].
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   675
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   676
        markFrom:pos1 to:pos2 
1802
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   677
        withEmphasis:cachedStringEmphasis 
e0b32dc71dac *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1757
diff changeset
   678
        color:cachedStringColor
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   679
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   680
    "Modified: / 31.3.1998 / 18:03:18 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   681
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   682
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   683
markSuperFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   684
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   685
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   686
        withEmphasis:(preferences superEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   687
        color:(preferences superColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   688
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   689
    "Modified: / 31.3.1998 / 18:03:26 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   690
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   691
672
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   692
markSymbolFrom:pos1 to:pos2
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   693
    self 
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   694
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   695
        withEmphasis:(preferences symbolEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   696
        color:(preferences symbolColor)
672
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   697
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   698
    "Created: / 1.4.1998 / 12:56:47 / cg"
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   699
    "Modified: / 1.4.1998 / 12:58:00 / cg"
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   700
!
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   701
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   702
markThisContextFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   703
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   704
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   705
        withEmphasis:(preferences thisContextEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   706
        color:(preferences thisContextColor)
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   707
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   708
    "Modified: / 31.3.1998 / 18:03:36 / cg"
665
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   709
!
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   710
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   711
markUnknownIdentifierFrom:pos1 to:pos2
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   712
    self 
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   713
        markFrom:pos1 to:pos2 
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   714
        withEmphasis:(preferences unknownIdentifierEmphasis) 
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   715
        color:(preferences unknownIdentifierColor)
665
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   716
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   717
    "Created: / 31.3.1998 / 19:09:26 / cg"
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   718
    "Modified: / 31.3.1998 / 19:10:30 / cg"
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   719
!
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   720
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   721
markVariable:v
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   722
    "support for syntaxColoring"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   723
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   724
    |pos endPos|
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   725
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   726
    pos := tokenPosition.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   727
    endPos := pos+tokenName size-1.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   728
    self markVariable:v from:pos to:endPos
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   729
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   730
    "Modified: / 16.4.1998 / 18:49:51 / cg"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   731
!
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   732
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   733
markVariable:v from:pos to:endPos
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   734
    "support for syntaxColoring"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   735
823
a05ffe57b1b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
   736
    |type globalValue nameSym|
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   737
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   738
    type := v type.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   739
    (type == #BlockArg
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   740
    or:[type == #MethodArg]) ifTrue:[
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   741
        self markArgumentIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   742
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   743
    ].
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   744
    (type == #BlockVariable
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   745
    or:[type == #MethodVariable]) ifTrue:[
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   746
        self markLocalIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   747
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   748
    ].
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   749
    (type == #GlobalVariable) ifTrue:[
823
a05ffe57b1b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
   750
        nameSym := v name asSymbolIfInterned.
a05ffe57b1b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
   751
        nameSym notNil ifTrue:[
a05ffe57b1b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
   752
            globalValue := Smalltalk at:nameSym ifAbsent:nil.
a05ffe57b1b8 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 822
diff changeset
   753
        ].
822
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   754
        globalValue isBehavior ifTrue:[
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   755
            self markGlobalClassIdentifierFrom:pos to:endPos.
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   756
        ] ifFalse:[
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   757
            self markGlobalIdentifierFrom:pos to:endPos.
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   758
        ].
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   759
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   760
    ].
1553
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   761
    (type == #PoolVariable) ifTrue:[
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   762
        self markPoolVariableIdentifierFrom:pos to:endPos.
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   763
        ^ self
1657d0843c64 sharedPools
ca
parents: 1550
diff changeset
   764
    ].
870
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   765
    (type == #ClassVariable) ifTrue:[
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   766
        self markClassVariableIdentifierFrom:pos to:endPos.
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   767
        ^ self
1db26e4ce4c4 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 868
diff changeset
   768
    ].
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   769
    (type == #InstanceVariable) ifTrue:[
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   770
        self markInstVarIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   771
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   772
    ].
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   773
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   774
    self markIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   775
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   776
    "Created: / 16.4.1998 / 18:49:34 / cg"
822
a773bb72cbd6 added extra globalClassIdentifierColor & emphasis
Claus Gittinger <cg@exept.de>
parents: 794
diff changeset
   777
    "Modified: / 4.3.1999 / 12:56:13 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   778
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   779
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   780
!SyntaxHighlighter class methodsFor:'documentation'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   781
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   782
version
2170
907aa03513e4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2087
diff changeset
   783
    ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.58 2009-03-25 11:39:01 cg Exp $'
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   784
! !