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