SyntaxHighlighter.st
author Claus Gittinger <cg@exept.de>
Sat, 24 Oct 1998 13:01:10 +0200
changeset 794 459868dcb591
parent 788 5307f69829c6
child 822 a773bb72cbd6
permissions -rw-r--r--
highlight text after any error in red color.
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
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
		globalIdentifierColor globalIdentifierEmphasis commentColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
		commentEmphasis methodSelectorEmphasis methodSelectorColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
		selectorEmphasis selectorColor stringColor stringEmphasis
672
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
    23
		symbolColor symbolEmphasis selfColor selfEmphasis superColor
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
    24
		superEmphasis hereColor hereEmphasis thisContextColor
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
    25
		thisContextEmphasis booleanConstantColor booleanConstantEmphasis
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
    26
		constantColor constantEmphasis bracketColor bracketEmphasis
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
    27
		instVarIdentifierColor instVarIdentifierEmphasis'
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
	classVariableNames:''
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
	poolDictionaries:''
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
	category:'System-Compiler'
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
!SyntaxHighlighter class methodsFor:'documentation'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
copyright
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
 COPYRIGHT (c) 1998 by eXept Software AG
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
              All Rights Reserved
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
 This software is furnished under a license and may be used
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
 only in accordance with the terms of that license and with the
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
 inclusion of the above copyright notice.   This software may not
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
 be provided or otherwise made available to, or used by, any
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
 other person.  No title to or ownership of the software is
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
 hereby transferred.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
681
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    49
!
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    50
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    51
documentation
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    52
"
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    53
    colors a method.
3add270b9c1e documentation added
Claus Gittinger <cg@exept.de>
parents: 680
diff changeset
    54
"
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
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
!SyntaxHighlighter class methodsFor:'highlighting'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
684
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    61
formatExpression:aString in:aClass
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    62
    "format (recolor) an expression in a given class.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    63
     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
    64
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    65
    |parser tree text endPos|
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    66
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    67
    aString isNil ifTrue:[^ nil].
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    68
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    69
    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
    70
    parser ignoreErrors.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    71
    parser ignoreWarnings.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    72
    parser sourceText:(text := aString string asText).
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    73
    "/ 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
    74
    text emphasisCollection:(Array new:aString size).
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    75
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    76
    parser nextToken.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    77
    tree := parser expression.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    78
    "/ now, convert the emphasis-array to a runArray
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    79
    text emphasisCollection:(text emphasis asRunArray).
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    80
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    81
    tree == #Error ifTrue:[
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    82
        "/ mhmh - which is better ...
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    83
        "/ alternative1: color rest after error in red
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    84
"/        text 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    85
"/            emphasizeFrom:(parser sourceStream position) 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    86
"/            to:text size 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    87
"/            with:(#color->Color red).
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
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    90
        "/ alternative2: take original emphasis for rest
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    91
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    92
        endPos := parser sourceStream position.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    93
        endPos >= text size ifTrue:[
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    94
            ^ text
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
        ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
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
        "/ alternative3: no emphasis for rest.
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
    99
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   100
"/        ^ text "/ aString
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
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
    "
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   105
     self
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   106
        formatExpression:'(1 + 2) max:5' 
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   107
        in:UndefinedObject
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
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   110
    "Modified: / 7.4.1998 / 09:57:19 / cg"
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   111
    "Created: / 9.4.1998 / 16:57:16 / cg"
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   112
!
dd691ac07f90 added entry to color an expression
Claus Gittinger <cg@exept.de>
parents: 681
diff changeset
   113
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
formatMethod:aString in:aClass
680
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   115
    "format (recolor) a method in a given class.
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   116
     Return the text containing font changes and color information."
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
678
da6c65951755 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
   118
    |parser tree text endPos|
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    aString isNil ifTrue:[^ nil].
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   122
    Object errorSignal handle:[:ex |
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   123
        ^ aString
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   124
    ] do:[
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   125
        parser := self for:(ReadStream on:aString string) in:aClass.
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   126
        parser ignoreErrors.
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   127
        parser ignoreWarnings.
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   128
        parser sourceText:(text := aString string asText).
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   129
        "/ 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
   130
        text emphasisCollection:(Array new:aString size).
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   132
        tree := parser parseMethod.
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   133
        "/ now, convert the emphasis-array to a runArray
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   134
        text emphasisCollection:(text emphasis asRunArray).
680
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   135
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   136
        tree == #Error ifTrue:[
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   137
            "/ mhmh - which is better ...
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   138
            "/ alternative1: color rest after error in red
794
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   139
true ifTrue:[
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   140
            text 
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   141
                emphasizeFrom:(parser sourceStream position) 
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   142
                to:text size 
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   143
                with:(#color->Color red).
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   144
] ifFalse:[
680
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   145
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   146
            "/ alternative2: take original emphasis for rest
680
ebc432c71aec much faster (due to runArray changes.
Claus Gittinger <cg@exept.de>
parents: 678
diff changeset
   147
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   148
            endPos := parser sourceStream position.
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   149
            endPos >= text size ifTrue:[
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   150
                ^ text
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   151
            ].
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   152
            ^ (text copyTo:endPos) , (aString copyFrom:(endPos+1))
794
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   153
].
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   154
            "/ alternative3: no emphasis for rest.
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   155
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   156
    "/        ^ text "/ aString
678
da6c65951755 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 674
diff changeset
   157
        ].
689
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   158
        ^ text
42a774852fed care for errors ...
Claus Gittinger <cg@exept.de>
parents: 686
diff changeset
   159
    ]
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    "
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
     self
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
        formatMethod:'foo 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    ^ self bar:''hello''.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
    ' , (Character doubleQuote asString) , 'some comment' , (Character doubleQuote asString) , '
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
'
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
        in:UndefinedObject
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    "
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
794
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   170
    "Modified: / 23.10.1998 / 22:48:45 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
!SyntaxHighlighter methodsFor:'accessing'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
sourceText
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
    "return the value of the instance variable 'sourceText' (automatically generated)"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
    ^ sourceText
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
    "Created: / 31.3.1998 / 11:49:05 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
sourceText:something
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
    "set the value of the instance variable 'sourceText' (automatically generated)"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
    sourceText := something.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
    "Created: / 31.3.1998 / 11:49:05 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
!SyntaxHighlighter methodsFor:'initialization'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
initialize
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
    |prefs|
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
    super initialize.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
    prefs := UserPreferences current.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
    identifierEmphasis := prefs identifierEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
    identifierColor := prefs identifierColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   201
    argumentIdentifierEmphasis := prefs argumentIdentifierEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    argumentIdentifierColor := prefs argumentIdentifierColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   203
    localIdentifierEmphasis := prefs localIdentifierEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   204
    localIdentifierColor := prefs localIdentifierColor.
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   205
    instVarIdentifierEmphasis := prefs instVarIdentifierEmphasis.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   206
    instVarIdentifierColor := prefs instVarIdentifierColor.
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
    globalIdentifierEmphasis := prefs globalIdentifierEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
    globalIdentifierColor := prefs globalIdentifierColor.
665
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   209
    unknownIdentifierEmphasis := prefs unknownIdentifierEmphasis.
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   210
    unknownIdentifierColor := prefs unknownIdentifierColor.
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
    commentEmphasis := prefs commentEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
    commentColor := prefs commentColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
    methodSelectorEmphasis := prefs methodSelectorEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    methodSelectorColor := prefs methodSelectorColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
    selectorEmphasis := prefs selectorEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
    selectorColor := prefs selectorColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
    stringEmphasis := prefs stringEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
    stringColor := prefs stringColor.
672
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   219
    symbolEmphasis := prefs symbolEmphasis.
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   220
    symbolColor := prefs symbolColor.
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
    selfEmphasis := prefs selfEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    selfColor := prefs selfColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
    hereEmphasis := prefs hereEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
    hereColor := prefs hereColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
    superEmphasis := prefs superEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    superColor := prefs superColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
    thisContextEmphasis := prefs thisContextEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   228
    thisContextColor := prefs thisContextColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   229
    constantEmphasis := prefs constantEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    constantColor := prefs constantColor.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
    booleanConstantEmphasis := prefs booleanConstantEmphasis.
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
    booleanConstantColor := prefs booleanConstantColor.
673
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   233
    bracketEmphasis := prefs bracketEmphasis.
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   234
    bracketColor := prefs bracketColor.
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   235
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   236
    "Created: / 31.3.1998 / 15:12:55 / cg"
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   237
    "Modified: / 16.4.1998 / 18:40:19 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   238
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   239
788
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   240
!SyntaxHighlighter methodsFor:'misc'!
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   241
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   242
defineAsUndeclaredVariable:aName
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   243
    "redefined to NOT declare undefined vars"
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   244
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   245
    ^ VariableNode type:#GlobalVariable name:aName
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   246
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   247
    "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
   248
!
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   249
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   250
plausibilityCheck:aNode
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   251
    "redefined to NOT do checks"
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   252
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   253
    ^ aNode
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   254
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   255
    "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
   256
    "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
   257
! !
5307f69829c6 do not enter undeclared vars into Undeclared.
Claus Gittinger <cg@exept.de>
parents: 689
diff changeset
   258
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   259
!SyntaxHighlighter methodsFor:'syntax detection'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   260
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   261
markArgumentIdentifierFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   262
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   263
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   264
        withEmphasis:argumentIdentifierEmphasis color:argumentIdentifierColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   265
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   266
    "Modified: / 31.3.1998 / 18:01:27 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   267
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   268
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   269
markBooleanConstantFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   270
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   271
        markFrom:pos1 to:pos2 
665
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   272
        withEmphasis:booleanConstantEmphasis color:booleanConstantColor
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   273
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   274
    "Created: / 31.3.1998 / 18:09:01 / cg"
665
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   275
    "Modified: / 31.3.1998 / 19:36:44 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   276
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   277
673
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   278
markBracketAt:pos
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   279
    self 
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   280
        markFrom:pos to:pos 
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   281
        withEmphasis:bracketEmphasis color:bracketColor
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   282
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   283
    "Created: / 31.3.1998 / 18:09:01 / cg"
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   284
    "Modified: / 31.3.1998 / 19:36:44 / cg"
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   285
!
0c66b7cb1d2f checkin from browser
ca
parents: 672
diff changeset
   286
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   287
markCommentFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   288
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   289
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   290
        withEmphasis:commentEmphasis color:commentColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   291
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   292
    "Modified: / 31.3.1998 / 18:01:55 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   293
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   294
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   295
markConstantFrom: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 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   298
        withEmphasis:constantEmphasis color:constantColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   299
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   300
    "Modified: / 31.3.1998 / 18:01:44 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   301
    "Created: / 31.3.1998 / 18:09:22 / 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
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   304
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clr
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   305
    |e|
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   306
669
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   307
    clr = Color black ifTrue:[
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   308
        e := fontEmp
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   309
    ] ifFalse:[
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   310
        e := Text addEmphasis:fontEmp to:(#color->clr).
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   311
    ].
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   312
    sourceText emphasizeFrom:pos1 to:pos2 with:e
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   313
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
    "Created: / 31.3.1998 / 13:26:53 / cg"
669
5ef61aacc5d3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 667
diff changeset
   315
    "Modified: / 1.4.1998 / 12:51:56 / cg"
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
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
markGlobalIdentifierFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
        withEmphasis:globalIdentifierEmphasis color:globalIdentifierColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   322
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   323
    "Modified: / 31.3.1998 / 18:02:14 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   324
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   325
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
markHereFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
        withEmphasis:hereEmphasis color:hereColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   330
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   331
    "Modified: / 31.3.1998 / 18:02:25 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   332
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   333
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   334
markIdentifierFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   335
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   336
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   337
        withEmphasis:identifierEmphasis color:identifierColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   338
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   339
    "Modified: / 31.3.1998 / 18:02:39 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   340
    "Created: / 31.3.1998 / 18:04:56 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   341
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   343
markInstVarIdentifierFrom:pos1 to:pos2
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   344
    self 
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   345
        markFrom:pos1 to:pos2 
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   346
        withEmphasis:instVarIdentifierEmphasis color:instVarIdentifierColor
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   347
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   348
    "Created: / 16.4.1998 / 18:35:40 / cg"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   349
    "Modified: / 16.4.1998 / 18:37:30 / cg"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   350
!
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   351
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   352
markLocalIdentifierFrom: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 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
        withEmphasis:localIdentifierEmphasis color:localIdentifierColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
    "Modified: / 31.3.1998 / 18:02:39 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   358
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   360
markMethodSelectorFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   361
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   362
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   363
        withEmphasis:methodSelectorEmphasis color:methodSelectorColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   364
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   365
    "Modified: / 31.3.1998 / 18:02:52 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   366
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   367
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   368
markSelectorFrom:pos1 to:pos2
672
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   369
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   370
"/ uncommenting the code below
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   371
"/ will suppress highlighting of common selectors ...
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   372
"/
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   373
"/    (#(
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   374
"/        'ifTrue:' 
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   375
"/        'ifFalse:'
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   376
"/        'not'
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   377
"/        'and:'
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   378
"/        'or:'
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   379
"/        '='
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   380
"/        '=='
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   381
"/        '~='
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   382
"/        '~~'
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   383
"/    ) includes:tokenName) ifTrue:[
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   384
"/        ^ self
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   385
"/    ].
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   386
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   387
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   388
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   389
        withEmphasis:selectorEmphasis color:selectorColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   390
672
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   391
    "Modified: / 1.4.1998 / 13:14:43 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   392
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   393
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   394
markSelfFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   395
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   396
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   397
        withEmphasis:selfEmphasis color:selfColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   398
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   399
    "Modified: / 31.3.1998 / 18:03:10 / cg"
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   400
!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   401
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   402
markStringFrom: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:stringEmphasis color:stringColor
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:03:18 / 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
markSuperFrom: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:superEmphasis color:superColor
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:03:26 / 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
672
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   418
markSymbolFrom:pos1 to:pos2
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   419
    self 
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   420
        markFrom:pos1 to:pos2 
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   421
        withEmphasis:symbolEmphasis color:symbolColor
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   422
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   423
    "Created: / 1.4.1998 / 12:56:47 / cg"
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   424
    "Modified: / 1.4.1998 / 12:58:00 / cg"
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   425
!
392927bad277 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 669
diff changeset
   426
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   427
markThisContextFrom:pos1 to:pos2
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   428
    self 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   429
        markFrom:pos1 to:pos2 
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   430
        withEmphasis:thisContextEmphasis color:thisContextColor
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   431
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   432
    "Modified: / 31.3.1998 / 18:03:36 / cg"
665
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   433
!
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   434
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   435
markUnknownIdentifierFrom:pos1 to:pos2
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   436
    self 
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   437
        markFrom:pos1 to:pos2 
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   438
        withEmphasis:unknownIdentifierEmphasis color:unknownIdentifierColor
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   439
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   440
    "Created: / 31.3.1998 / 19:09:26 / cg"
14114d1e653c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 662
diff changeset
   441
    "Modified: / 31.3.1998 / 19:10:30 / cg"
686
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   442
!
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   443
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   444
markVariable:v
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   445
    "support for syntaxColoring"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   446
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   447
    |pos endPos|
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   448
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   449
    pos := tokenPosition.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   450
    endPos := pos+tokenName size-1.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   451
    self markVariable:v from:pos to:endPos
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   452
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   453
    "Modified: / 16.4.1998 / 18:49:51 / cg"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   454
!
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   455
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   456
markVariable:v from:pos to:endPos
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   457
    "support for syntaxColoring"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   458
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   459
    |type|
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   460
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   461
    type := v type.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   462
    (type == #BlockArg
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   463
    or:[type == #MethodArg]) ifTrue:[
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   464
        self markArgumentIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   465
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   466
    ].
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   467
    (type == #BlockVariable
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   468
    or:[type == #MethodVariable]) ifTrue:[
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   469
        self markLocalIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   470
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   471
    ].
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   472
    (type == #GlobalVariable) ifTrue:[
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   473
        self markGlobalIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   474
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   475
    ].
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   476
    (type == #InstanceVariable) ifTrue:[
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   477
        self markInstVarIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   478
        ^ self
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   479
    ].
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   480
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   481
    self markIdentifierFrom:pos to:endPos.
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   482
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   483
    "Created: / 16.4.1998 / 18:49:34 / cg"
067a8c8be462 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 684
diff changeset
   484
    "Modified: / 16.4.1998 / 18:58:10 / cg"
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   485
! !
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   486
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   487
!SyntaxHighlighter class methodsFor:'documentation'!
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   488
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   489
version
794
459868dcb591 highlight text after any error in red color.
Claus Gittinger <cg@exept.de>
parents: 788
diff changeset
   490
    ^ '$Header: /cvs/stx/stx/libcomp/SyntaxHighlighter.st,v 1.15 1998-10-24 11:01:10 cg Exp $'
662
5a0a832ac06c initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   491
! !