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