tools/JavaSourceHighlighter.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Mon, 12 May 2014 17:34:16 +0100
changeset 3101 446b34b9a386
parent 3062 a3f6e540a232
child 3103 a7d69709920f
permissions -rw-r--r--
Fixed GroovyScanner w.r.t ''' multiline comments.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     1
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     2
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     3
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     4
 New code and modifications done at SWING Research Group [1]:
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     5
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     6
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     7
                            SWING Research Group, Czech Technical University in Prague
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     8
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
     9
 This software is furnished under a license and may be used
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    10
 only in accordance with the terms of that license and with the
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    11
 inclusion of the above copyright notice.   This software may not
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    12
 be provided or otherwise made available to, or used by, any
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    13
 other person.  No title to or ownership of the software is
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    14
 hereby transferred.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    15
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    16
 [1] Code written at SWING Research Group contains a signature
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    17
     of one of the above copright owners. For exact set of such code,
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    18
     see the differences between this version and version stx:libjava
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    19
     as of 1.9.2010
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    20
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    21
"{ Package: 'stx:libjava/tools' }"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    22
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    23
Object subclass:#JavaSourceHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    24
	instanceVariableNames:'preferences cachedStringEmphasis cachedStringColor sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    25
		sourceIndex'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    26
	classVariableNames:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	poolDictionaries:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
	category:'Languages-Java-Tools-Source'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    30
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    31
Object subclass:#Indexer
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
    32
	instanceVariableNames:'index types fields locals'
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    33
	classVariableNames:''
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    34
	poolDictionaries:''
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    35
	privateIn:JavaSourceHighlighter
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    36
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    37
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    38
Object subclass:#Marker
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
	instanceVariableNames:'highlighter'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
	classVariableNames:'MARK_KEYWORD MARK_NUMBER MARK_STRING MARK_CHARACTER MARK_COMMENT
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
    41
		MARK_JAVADOC MARK_KEYWORD_FLOW MARK_SELECTOR MARK_FIELD
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
    42
		MARK_FIELD_ASSIGNED MARK_LOCAL MARK_CLASS'
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    43
	poolDictionaries:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    44
	privateIn:JavaSourceHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    45
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    46
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    47
JavaScanner subclass:#Scanner
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    48
	instanceVariableNames:'buffer bufferFirst bufferLast highlighter'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
	classVariableNames:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
	poolDictionaries:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
	privateIn:JavaSourceHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    52
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    53
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    54
!JavaSourceHighlighter class methodsFor:'documentation'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    55
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    56
copyright
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    58
 COPYRIGHT (c) 1996-2011 by Claus Gittinger
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    60
 New code and modifications done at SWING Research Group [1]:
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    61
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    62
 COPYRIGHT (c) 2010-2011 by Jan Vrany, Jan Kurs and Marcel Hlopko
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    63
                            SWING Research Group, Czech Technical University in Prague
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    64
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
 This software is furnished under a license and may be used
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
 only in accordance with the terms of that license and with the
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    67
 inclusion of the above copyright notice.   This software may not
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    68
 be provided or otherwise made available to, or used by, any
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    69
 other person.  No title to or ownership of the software is
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    70
 hereby transferred.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    71
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    72
 [1] Code written at SWING Research Group contains a signature
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
     of one of the above copright owners. For exact set of such code,
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
     see the differences between this version and version stx:libjava
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
     as of 1.9.2010
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    76
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    77
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    78
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    79
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    80
documentation
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    81
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
    A syntax highligter for Java. This highlighter is SmallSense-aware and
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
    supports incremental highlighting.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    85
    [author:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
        Jan Vrany <jan.vrany@fit.cvut.cz>
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    87
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    88
    [instance variables:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    89
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    90
    [class variables:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    91
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    92
    [see also:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    93
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    94
"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    95
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    96
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    97
!JavaSourceHighlighter class methodsFor:'formatting'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    98
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
    99
_formatClassDefinition:newCode line: ln number: lnr in:cls
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   100
    ^self new formatClassDefinition:newCode line: ln number: lnr in:cls.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   101
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   102
    "Created: / 21-09-2013 / 04:22:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   103
!
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   104
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   105
_formatMethod:mthd source:newCode line: ln number: lnr in:cls using:syntaxPreferences
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   106
    ^ self new formatMethod:mthd source:newCode line: ln number: lnr in:cls using:syntaxPreferences
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   107
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   108
    "Created: / 21-09-2013 / 04:22:19 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   109
!
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   110
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   111
formatClass: javaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   112
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   113
    ^self new formatClassDefinition: javaClass source in: javaClass
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   114
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   115
    "Created: / 15-12-2011 / 21:54:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   116
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   117
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   118
formatClassDefinition:source in:class
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   119
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   120
    ^self new formatClassDefinition:source in:class
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   121
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   122
    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   123
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   124
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   125
formatClassDefinition:source in:class elementsInto: elements
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   126
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   127
    ^self new formatClassDefinition:source in:class elementsInto: elements
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   128
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   129
    "Created: / 04-08-2011 / 23:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   130
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   131
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   132
formatExpression:source in:class
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   133
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   134
    ^self new formatExpression:source in:class
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   135
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   136
    "Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   137
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   138
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   139
formatExpression:source in:class elementsInto: elements
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   140
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   141
    ^self new formatExpression:source in:class elementsInto: elements
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   142
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   143
    "Created: / 04-08-2011 / 23:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   144
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   145
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   146
formatMethod:mth source:source in:class
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   147
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   148
    ^self formatMethod: mth source: source in: class using: UserPreferences current
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   149
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   150
    "Created: / 11-02-2012 / 18:18:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   151
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   152
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   153
formatMethod:mth source:source in:class using: preferences
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   154
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   155
    ^self new formatMethod:mth source:source in:class using: preferences
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   156
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   157
    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   158
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   159
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   160
formatMethod:mth source:source in:class using: preferences elementsInto: elements
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   161
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   162
    ^self new formatMethod:mth source:source in:class using: preferences elementsInto: elements
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   163
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   164
    "Created: / 04-08-2011 / 23:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   165
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   166
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   167
!JavaSourceHighlighter methodsFor:'formatting'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   168
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   169
_formatClassDefinition:newCode line: line number: lnr in:cls
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   170
    | scanner |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   171
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   172
    line isEmptyOrNil ifTrue:[ ^  nil ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   173
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   174
    sourceText := line asText.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   175
    preferences isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   176
        preferences := UserPreferences current.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   177
    ]. 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   178
    scanner := Scanner for: line asString.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   179
    scanner highlighter: self.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   180
    [
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   181
        [ scanner nextToken ~~ #EOF ] whileTrue.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   182
    ] on: Error do:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   183
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   184
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   185
    ^ sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   186
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   187
    "Created: / 21-09-2013 / 04:19:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   188
!
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   189
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   190
_formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   191
    | scanner |
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   192
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   193
    line isEmptyOrNil ifTrue:[ ^  nil ].
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   194
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   195
    sourceText := line asText.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   196
    preferences := syntaxPreferences.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   197
    preferences isNil ifTrue:[
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   198
        preferences := UserPreferences current.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   199
    ]. 
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   200
    scanner := Scanner for: line asString.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   201
    scanner highlighter: self.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   202
    [
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   203
        [ scanner nextToken ~~ #EOF ] whileTrue.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   204
    ] on: Error do:[
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   205
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   206
    ].
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   207
    ^ sourceText
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   208
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   209
    "Created: / 21-09-2013 / 04:20:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   210
!
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   211
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   212
formatClassDefinition:source in:class
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   213
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   214
2971
a44d1fa11204 Fix in JavaSourceHighlighter>>#formatClassDefinition:in: - care for formatting class side...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2951
diff changeset
   215
    | marker cacheIt document sourceUnit parser tree resolve loader |
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   216
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   217
    "Optimization - if full class source is to be formatted,
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   218
     consult cache - when browsing the code or debugging, very 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   219
     often same same source is to be highlighted"
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   220
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   221
    preferences isNil ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   222
        preferences := UserPreferences current.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   223
    ].
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   224
    cacheIt := class notNil and: [class isBehavior and:[class theNonMetaclass isJavaClass]].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   225
    cacheIt ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   226
        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   227
        document notNil ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   228
            (document sourceText notNil and:[document sourceText string = source]) ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   229
                (sourceIndex notNil and:[document sourceTreeIndex notNil]) ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   230
                     sourceIndex addAll: document sourceTreeIndex.
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   231
                     sourceIndex tree:  document sourceTreeIndex tree.
3062
a3f6e540a232 Keep source along with parse tree index.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3049
diff changeset
   232
                     sourceIndex source: document sourceText.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   233
                ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   234
                ^ document sourceText copy.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   235
            ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   236
        ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   237
            document := JavaSourceDocument for: class theNonMetaclass.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   238
            (sourceIndex isNil and:[SmallSense::ParseTreeIndex notNil]) ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   239
                 sourceIndex := SmallSense::ParseTreeIndex new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   240
            ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   241
            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   242
        ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   243
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   244
    marker := Marker new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   245
    marker highlighter: self.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   246
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   247
    sourceText := source isText 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   248
                    ifTrue:[source copy] 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   249
                    ifFalse:[source asText].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   250
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   251
    self doLexicalHighlightingOnly ifTrue:[          
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   252
        sourceText := self format: source string.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   253
    ] ifFalse:[
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2894
diff changeset
   254
        JavaVM booted ifFalse:[JavaVM boot].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   255
        sourceUnit := (Java classForName:'stx.libjava.tools.Source') new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   256
        sourceUnit setContents: source string.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   257
        JavaCompiler synchronized:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   258
            parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   259
        ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   260
        parser setMarker: marker.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   261
        (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   262
            | indexer |
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   263
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   264
            indexer := Indexer new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   265
            indexer index: sourceIndex.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   266
            parser setIndexer: indexer.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   267
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   268
        ].
2951
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   269
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   270
        "/ Following is support JImport expecco plugin. For classes loaded by
2971
a44d1fa11204 Fix in JavaSourceHighlighter>>#formatClassDefinition:in: - care for formatting class side...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2951
diff changeset
   271
        "/ JImport plugin, do not resolve classes. The LookupEnvironment cannot
2951
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   272
        "/ find them as they are not installed in class registry...
2971
a44d1fa11204 Fix in JavaSourceHighlighter>>#formatClassDefinition:in: - care for formatting class side...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2951
diff changeset
   273
        resolve := class isNil or:[ (loader := class theNonMetaclass classLoader isNil) or:[loader isJavaObject] ] .
2951
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   274
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   275
        tree := parser parse: sourceUnit diet: false resolve: resolve.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   276
        (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   277
            sourceIndex tree: tree. 
3062
a3f6e540a232 Keep source along with parse tree index.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3049
diff changeset
   278
            sourceIndex source: sourceText.
2789
e6109bd7dfd2 Problem highlighting optimization/cleanup.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2788
diff changeset
   279
        ].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   280
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   281
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   282
    ^ cacheIt ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   283
        document sourceText: sourceText.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   284
        document sourceTreeIndex: sourceIndex.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   285
        sourceText copy
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   286
    ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   287
        sourceText
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   288
    ]
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   289
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   290
    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3062
a3f6e540a232 Keep source along with parse tree index.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3049
diff changeset
   291
    "Modified: / 09-04-2014 / 09:54:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   292
!
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   293
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   294
formatClassDefinition:source in:class elementsInto: els
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   295
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   296
    sourceIndex := els.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   297
    ^self formatClassDefinition:source in:class
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   298
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   299
    "Created: / 04-08-2011 / 23:44:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   300
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   302
formatExpression:source in:class
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   303
    ^ self format: source
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   304
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   305
    "Created: / 04-08-2011 / 23:45:01 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   306
    "Modified: / 03-10-2013 / 20:19:35 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   307
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   308
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   309
formatExpression:source in:class elementsInto: els
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   310
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   311
    sourceIndex := els.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   312
    ^self formatExpression:source in:class
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   313
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   314
    "Created: / 04-08-2011 / 23:43:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   315
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   316
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   317
formatMethod:mth source:source in:class using: prefs
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   318
    preferences := prefs.
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   319
    preferences isNil ifTrue:[
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   320
        preferences := UserPreferences current.
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   321
    ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   322
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   323
    JavaMethod showFullSource ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   324
        ^self formatClassDefinition: source in: class
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   325
    ].   
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   326
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   327
    sourceText := source asText.
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   328
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   329
    self doLexicalHighlightingOnly ifTrue:[
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   330
        sourceText := self format: source
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   331
    ] ifFalse:[
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   332
        | document type parser marker nodes debug |
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   333
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2894
diff changeset
   334
        JavaVM booted ifFalse:[JavaVM boot].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   335
        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   336
        document isNil ifTrue:[
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   337
            document := JavaSourceDocument for: class theNonMetaclass.
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   338
            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   339
        ].
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   340
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   341
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   342
        document resolve.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   343
        type := document sourceTreeForClass: class theNonMetaclass.
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   344
        marker := Marker new.
2778
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   345
        marker highlighter: self. 
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   346
        JavaCompiler synchronized:[
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   347
            parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   348
        ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   349
        parser setMarker: marker.
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   350
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   351
        debug :=  false.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   352
        nodes := parser parseClassBodyDeclarations: source string unit: document sourceTree copy type: type copy resolve: debug.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   353
        debug ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   354
            nodes inspect.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   355
        ]
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   356
    ].
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   357
    ^ sourceText
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   359
    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2894
diff changeset
   360
    "Modified (format): / 26-11-2013 / 23:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   361
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   362
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   363
formatMethod:mth source:source in:class using: prefs elementsInto: els
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   364
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   365
    preferences := prefs.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   366
    sourceIndex := els.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   367
    ^self formatMethod:mth source:source in:class using: prefs
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   368
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   369
    "Created: / 04-08-2011 / 23:42:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   370
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   371
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   372
formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   373
    | scanner |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   374
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   375
    line isEmptyOrNil ifTrue:[ ^  nil ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   376
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   377
    sourceText := line asText.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   378
    preferences := syntaxPreferences.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   379
    preferences isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   380
        preferences := UserPreferences current.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   381
    ]. 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   382
    scanner := Scanner for: line asString.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   383
    scanner highlighter: self.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   384
    [
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   385
        [ scanner nextToken ~~ #EOF ] whileTrue.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   386
    ] on: Error do:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   387
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   388
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   389
    ^ sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   390
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   391
    "Created: / 04-08-2013 / 00:26:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   392
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   393
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   394
!JavaSourceHighlighter methodsFor:'formatting-private'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   395
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   396
format: source
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   397
    "Simple formatting based on lexical structure only"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   398
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   399
    | scanner token lastToken0 lastToken1 lastValue0 lastValue1 lastPosition0 lastPosition1 |
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   400
    sourceText := source asText.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   401
    scanner := Scanner for: source string.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   402
    scanner highlighter: self.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   403
    [
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   404
        [ (token := scanner nextToken) ~~ #EOF ] whileTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   405
            "/ Here, try to guess what's selector...
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   406
            token == $( ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   407
                lastPosition0 == #Identifier ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   408
                    self markSelectorFrom: lastPosition0  to: lastPosition0 + lastValue0 size - 1.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   409
                ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   410
            ].
2787
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   411
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   412
            lastToken1 := lastToken0.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   413
            lastValue1 := lastValue0.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   414
            lastPosition1  := lastPosition0.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   415
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   416
            lastToken0 := token.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   417
            lastValue0 := scanner tokenValue.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   418
            lastPosition0 := scanner tokenStartPosition.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   419
        ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   420
    ] on: Error do:[:ex|
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   421
    ].   
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   422
    ^ sourceText
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   423
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   424
    "Created: / 03-10-2013 / 20:19:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   425
! !
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   426
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   427
!JavaSourceHighlighter methodsFor:'queries'!
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   428
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   429
doLexicalHighlightingOnly
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   430
    "/ For now, in debugger always use lexical highlighting. Makes highlighter debugging easier"
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   431
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   432
    | process wgroups |
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   433
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   434
    process := Processor activeProcess.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   435
    wgroups := WindowGroup scheduledWindowGroups.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   436
    [ process notNil ] whileTrue:[
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   437
        | groups wg application |
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   438
        groups := wgroups select:[:wg | wg process == process ].
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   439
        groups notEmpty ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   440
            wg := groups detect:[:wg | wg isModal] ifNone:nil.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   441
            wg isNil ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   442
                wg := groups anElement
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   443
            ].
2876
7bcde178eee7 Fix in JavaSourceHighlighter: do full highlighting for applications spawn from the debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2836
diff changeset
   444
            (wg mainView class == DebugView) ifTrue:[ ^ true ].
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   445
            (wg mainView notNil and:[(application := wg mainView application) notNil]) ifTrue:[
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   446
                application class == (Smalltalk at: #'JDI::DebuggerApplication') ifTrue:[ ^ true ].
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   447
                application class == Tools::NewSystemBrowser ifTrue:[ ^ false ].
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   448
            ]
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   449
        ].
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   450
        process := process parentProcess.                    
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   451
    ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   452
    ^ false
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   453
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   454
    "Created: / 09-09-2013 / 02:25:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   455
    "Modified: / 25-03-2014 / 13:32:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   456
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   457
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   458
!JavaSourceHighlighter methodsFor:'syntax detection'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   459
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   460
markArgumentIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   461
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   462
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   463
        withEmphasis:(preferences argumentIdentifierEmphasis) color:(preferences argumentIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   464
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   465
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   466
markBadIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   467
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   468
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   469
        withEmphasis:(preferences badIdentifierEmphasis) 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   470
        color:(preferences badIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   471
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   472
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   473
markClassVariableIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   474
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   475
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   476
        withEmphasis:(preferences classVariableIdentifierEmphasis) color:(preferences classVariableIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   477
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   478
    "Modified: / 31.3.1998 / 18:02:14 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   479
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   480
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   481
markCommentFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   482
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   483
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   484
        withEmphasis:(preferences commentEmphasis) color:(preferences commentColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   485
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   486
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   487
markConstantFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   488
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   489
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   490
        withEmphasis:(preferences constantEmphasis) color:(preferences constantColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   491
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   492
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   493
markFrom:pos1 to:pos2 withEmphasis:fontEmp color:clrIn
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   494
    |e p2 clr|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   495
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   496
    clr := clrIn onDevice:Screen current.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   497
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   498
    clr = Color black ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   499
        e := fontEmp
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   500
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   501
        fontEmp isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   502
            e := (#color->clr)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   503
        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   504
            e := Text addEmphasis:fontEmp to:(#color->clr).
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   505
        ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   506
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   507
    (p2 := pos2) isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   508
        p2 := sourceText size
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   509
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   510
        p2 := p2 min:sourceText size
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   511
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   512
    sourceText emphasizeFrom:pos1 to:p2 with:e
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   513
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   514
    "Created: / 31.3.1998 / 13:26:53 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   515
    "Modified: / 1.4.1998 / 12:51:56 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   516
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   517
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   518
markFunctionNameFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   519
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   520
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   521
        withEmphasis:(preferences methodSelectorEmphasis) color:(preferences methodSelectorColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   522
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   523
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   524
markGlobalClassIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   525
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   526
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   527
        withEmphasis:(preferences globalClassIdentifierEmphasis) color:(preferences globalClassIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   528
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   529
    "Modified: / 31.3.1998 / 18:02:14 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   530
    "Created: / 4.3.1999 / 12:53:02 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   531
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   532
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   533
markGlobalIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   534
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   535
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   536
        withEmphasis:(preferences globalIdentifierEmphasis) color:(preferences globalIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   537
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   538
    "Modified: / 31.3.1998 / 18:02:14 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   539
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   540
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   541
markIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   542
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   543
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   544
        withEmphasis:(preferences identifierEmphasis) color:(preferences identifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   545
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   546
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   547
markInstVarIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   548
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   549
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   550
        withEmphasis:(preferences instVarIdentifierEmphasis) color:(preferences instVarIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   551
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   552
    "Created: / 16.4.1998 / 18:35:40 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   553
    "Modified: / 16.4.1998 / 18:37:30 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   554
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   555
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   556
markKeyword:kw from:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   557
    |em clr|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   558
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   559
    ( #( 'if' 'else'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   560
         'while'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   561
         'for'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   562
         'do'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   563
         'return'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   564
         'continue'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   565
         'break'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   566
    ) includes:kw) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   567
        em := preferences controlFlowSelectorEmphasis. 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   568
        clr := preferences controlFlowSelectorColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   569
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   570
        em := preferences jsKeywordEmphasis.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   571
        clr := preferences jsKeywordColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   572
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   573
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   574
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   575
        withEmphasis:em color:clr
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   576
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   577
    "Modified: / 19-05-2010 / 15:07:59 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   578
    "Modified: / 07-08-2013 / 00:28:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   579
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   580
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   581
markKeywordFlowFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   582
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   583
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   584
        withEmphasis:preferences controlFlowSelectorEmphasis
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   585
        color:preferences controlFlowSelectorColor
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   586
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   587
    "Created: / 05-09-2013 / 03:09:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   588
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   589
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   590
markKeywordFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   591
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   592
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   593
        withEmphasis:preferences jsKeywordEmphasis
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   594
        color:preferences jsKeywordColor
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   595
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   596
    "Created: / 05-09-2013 / 03:09:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   597
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   598
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   599
markLocalIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   600
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   601
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   602
        withEmphasis:(preferences localIdentifierEmphasis) color:(preferences localIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   603
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   604
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   605
markProblem: problem from:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   606
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   607
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   608
        withEmphasis:(preferences badIdentifierEmphasis) 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   609
        color:(preferences badIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   610
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   611
    "Created: / 15-04-2013 / 22:23:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   612
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   613
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   614
markSelector:selectorString from:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   615
    | fg em |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   616
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   617
    fg := preferences selectorColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   618
    em := preferences selectorEmphasis.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   619
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   620
    self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   621
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   622
        withEmphasis:em color:fg
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   623
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   624
    "Modified: / 04-10-2011 / 19:48:48 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   625
    "Modified: / 17-03-2012 / 13:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   626
    "Created: / 17-03-2012 / 19:12:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   627
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   628
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   629
markSelector:selectorString from:pos1 to:pos2 receiverNode:aReceiverNodeOrNil numArgs:numArgs
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   630
    |fg selectorSymbol check ok rec em currentEnvironment currentSuperclasses currentSubclasses classToCompileFor fullSelectorCheck|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   631
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   632
    fg := preferences selectorColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   633
    em := preferences selectorEmphasis.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   634
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   635
"/    (currentEnvironment notNil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   636
"/    and:[ (((currentEnvironment _localVariables ? #()) contains:[:local | local name = selectorString]) 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   637
"/          or:[((currentEnvironment _argVariables ? #()) contains:[:local | local name = selectorString])])
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   638
"/    ])
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   639
"/    ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   640
"/        "/ a local call
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   641
"/    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   642
"/        selectorSymbol := (self translatedSmalltalkSelectorFor:selectorString numArgs:numArgs) asSymbolIfInterned.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   643
"/        selectorSymbol isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   644
"/            fg := Color red.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   645
"/        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   646
"/            fullSelectorCheck == true ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   647
"/                aReceiverNodeOrNil notNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   648
"/                    check := [:cls | (cls includesSelector:selectorSymbol)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   649
"/                                     or:[cls class includesSelector:selectorSymbol]].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   650
"/
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   651
"/                    ok := false.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   652
"/
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   653
"/                    "/ limit search if possible
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   654
"/                    (classToCompileFor notNil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   655
"/                     and:[aReceiverNodeOrNil isSelf or:[aReceiverNodeOrNil isSuper]]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   656
"/                        currentSuperclasses isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   657
"/                            currentSuperclasses := classToCompileFor withAllSuperclasses.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   658
"/                        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   659
"/                        ok := currentSuperclasses contains:check.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   660
"/                        (ok not and:[aReceiverNodeOrNil isSelf]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   661
"/                            currentSubclasses isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   662
"/                                currentSubclasses := classToCompileFor allSubclasses.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   663
"/                            ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   664
"/                            ok := currentSubclasses contains:check.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   665
"/                        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   666
"/                    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   667
"/                        aReceiverNodeOrNil isConstant ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   668
"/                            ok := aReceiverNodeOrNil evaluate class withAllSuperclasses contains:check.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   669
"/                        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   670
"/                            (aReceiverNodeOrNil isGlobal 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   671
"/                            and:[(rec := aReceiverNodeOrNil evaluate) isBehavior]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   672
"/                                ok := rec class withAllSuperclasses contains:check.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   673
"/                            ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   674
"/                                ok := Smalltalk allClasses contains:check
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   675
"/                            ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   676
"/                        ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   677
"/                    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   678
"/
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   679
"/                    ok ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   680
"/                        em := preferences unimplementedSelectorEmphasis.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   681
"/                        fg := preferences unimplementedSelectorColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   682
"/                    ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   683
"/                ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   684
"/            ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   685
"/        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   686
"/    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   687
    self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   688
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   689
        withEmphasis:em color:fg
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   690
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   691
    "Modified: / 04-10-2011 / 19:48:48 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   692
    "Modified: / 17-03-2012 / 13:26:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   693
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   694
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   695
markSelectorFrom:pos1 to:pos2 
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   696
    | fg em |
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   697
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   698
    fg := preferences selectorColor.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   699
    em := preferences selectorEmphasis.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   700
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   701
    self
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   702
        markFrom:pos1 to:pos2 
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   703
        withEmphasis:em color:fg
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   704
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   705
    "Created: / 11-09-2013 / 05:01:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   706
!
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   707
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   708
markSelfFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   709
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   710
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   711
        withEmphasis:(preferences selfEmphasis) color:(preferences selfColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   712
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   713
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   714
markStringFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   715
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   716
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   717
        withEmphasis:(preferences stringEmphasis) color:(preferences stringColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   718
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   719
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   720
markUnknownIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   721
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   722
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   723
        withEmphasis:(preferences unknownIdentifierEmphasis) color:(preferences unknownIdentifierColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   724
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   725
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   726
markVariable:v from:pos to:endPos
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   727
    "support for syntaxColoring"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   728
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   729
    |type globalValue nameSym|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   730
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   731
    type := v type.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   732
    (type == #BlockArg
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   733
    or:[type == #MethodArg]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   734
        self markArgumentIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   735
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   736
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   737
    (type == #BlockVariable
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   738
    or:[type == #MethodVariable]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   739
        self markLocalIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   740
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   741
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   742
    (type == #GlobalVariable) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   743
        nameSym := v name asSymbolIfInterned.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   744
        (nameSym isNil 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   745
        or:[(Smalltalk includesKey:nameSym) not]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   746
            self markUnknownIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   747
            ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   748
        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   749
        globalValue := Smalltalk at:nameSym ifAbsent:nil.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   750
        globalValue isBehavior ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   751
            self markGlobalClassIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   752
        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   753
            self markGlobalIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   754
        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   755
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   756
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   757
    (type == #ClassVariable) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   758
        self markClassVariableIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   759
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   760
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   761
    (type == #InstanceVariable) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   762
        self markInstVarIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   763
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   764
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   765
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   766
    self markIdentifierFrom:pos to:endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   767
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   768
    "Created: / 16.4.1998 / 18:49:34 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   769
    "Modified: / 4.3.1999 / 12:56:13 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   770
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   771
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   772
!JavaSourceHighlighter::Indexer class methodsFor:'initialization'!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   773
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   774
initialize
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   775
    "Invoked at system start or when the class is dynamically loaded."
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   776
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   777
    self lookupObject: JavaLookup instance.
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   778
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   779
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   780
    "/ please change as required (and remove this comment)
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   781
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   782
    "Modified: / 17-09-2013 / 01:33:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   783
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   784
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   785
!JavaSourceHighlighter::Indexer methodsFor:'accessing'!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   786
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   787
index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   788
    ^ index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   789
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   790
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   791
index:aParseTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   792
    index := aParseTreeIndex.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   793
    types := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   794
    fields := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   795
    locals := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   796
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   797
    "Modified: / 24-09-2013 / 02:32:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   798
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   799
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   800
!JavaSourceHighlighter::Indexer methodsFor:'indexing'!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   801
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   802
add: node from: start to: stop
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   803
    | element |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   804
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   805
    index add: (element := index newElementFor: node).
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   806
    element start: start + 1; stop: stop + 1.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   807
    ^ element
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   808
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   809
    "Created: / 01-10-2013 / 10:30:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   810
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   811
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   812
addFieldDeclaration: node from: start to: stop
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   813
    | element binding fname previous |
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   814
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   815
    element := self add: node from: start to: stop.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   816
    binding := node binding.
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   817
    binding notNil ifTrue:[
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   818
        fname := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   819
        previous := fields at: fname ifAbsent: nil.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   820
        previous notNil ifTrue:[
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   821
            previous next: element.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   822
        ].
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   823
        fields at: fname put: element.
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   824
    ].
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   825
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   826
    "Created: / 01-10-2013 / 10:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   827
    "Modified: / 08-10-2013 / 17:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   828
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   829
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   830
addLocalDeclaration: node from: start to: stop
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   831
    | element fname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   832
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   833
    element := self add: node from: start to: stop.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   834
    fname := node name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   835
    previous := locals at: fname ifAbsent: nil.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   836
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   837
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   838
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   839
    locals at: fname put: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   840
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   841
    "Created: / 01-10-2013 / 11:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   842
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   843
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   844
addMessageSend: node from: start to: stop
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   845
    self add: node from: start to: stop
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   846
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   847
    "Created: / 01-10-2013 / 10:30:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   848
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   849
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   850
addTypeReference: node from: start to: stop
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   851
    | element tname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   852
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   853
    element := self add: node from: start to: stop.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   854
    tname := node getTypeName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   855
    previous := types at: tname ifAbsent: nil.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   856
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   857
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   858
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   859
    types at: tname put: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   860
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   861
    "Created: / 01-10-2013 / 10:33:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   862
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   863
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   864
addVariableReference: node from: start to: stop
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   865
    | element binding name previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   866
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   867
    element := self add: node from: start to: stop.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   868
    binding := node binding.
2893
272f9a99e3db Fix in JavaSourceHighlighter::Indexer - allow for null variable binding.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2876
diff changeset
   869
    binding isNil ifTrue:[ ^ self ].
2787
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   870
    "/ ProblemBinding, treat is as a local
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   871
    binding problemId ~~ 0 ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   872
        name := binding name.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   873
        previous := locals at: name ifAbsent: nil.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   874
        previous notNil ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   875
            previous next: element.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   876
        ].
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   877
        locals at: name put: element.  
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   878
        ^ self.              
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   879
    ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   880
    (binding kind bitAnd: 2r100) == 2r100 "TYPE" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   881
        name := binding compoundName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   882
        previous := types at: name ifAbsent: nil.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   883
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   884
            previous next: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   885
        ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   886
        types at: name put: element.   
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   887
        ^ self.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   888
    ].
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   889
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   890
    binding kind == 2r001 "FIELD" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   891
        binding declaringClass isNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   892
            name := '???.' , binding name
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   893
        ] ifFalse:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   894
            name := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   895
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   896
        previous := fields at: name ifAbsent: nil.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   897
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   898
            previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   899
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   900
        fields at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   901
        ^ self.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   902
    ].
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   903
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   904
    binding kind == 2r010 "LOCAL" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   905
        name := binding name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   906
        previous := locals at: name ifAbsent: nil.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   907
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   908
            previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   909
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   910
        locals at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   911
        ^ self.   
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   912
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   913
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   914
    self error: 'Should not happen'
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   915
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   916
    "Created: / 01-10-2013 / 10:33:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2893
272f9a99e3db Fix in JavaSourceHighlighter::Indexer - allow for null variable binding.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2876
diff changeset
   917
    "Modified: / 26-10-2013 / 21:27:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   918
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   919
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   920
methodEnter: node
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   921
    locals := Dictionary new
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   922
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   923
    "Created: / 01-10-2013 / 10:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   924
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   925
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   926
methodLeave: node
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   927
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   928
    "Created: / 01-10-2013 / 10:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   929
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   930
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   931
!JavaSourceHighlighter::Marker class methodsFor:'initialization'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   932
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   933
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   934
    "Invoked at system start or when the class is dynamically loaded."
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   935
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   936
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   937
    !!!! IMPORTANT !!!!!!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   938
    When changing / adding constants, make sure they
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   939
    are in sync with those defined in Smaltalk
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   940
    stx.libjava.tools.source.JavaSourceMarker !!!!!!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   941
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   942
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   943
    self lookupObject: JavaLookup instance.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   944
    
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   945
    MARK_KEYWORD        := 1.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   946
    MARK_NUMBER         := 2.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   947
    MARK_STRING         := 3.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   948
    MARK_CHARACTER      := 4.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   949
    MARK_COMMENT        := 5.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   950
    MARK_JAVADOC        := 6.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   951
    MARK_KEYWORD_FLOW   := 7.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   952
    MARK_SELECTOR       := 8.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   953
    MARK_FIELD          := 9.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   954
    MARK_FIELD_ASSIGNED := 10.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   955
    MARK_LOCAL          := 11.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   956
    MARK_CLASS          := 12.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   957
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   958
    "Modified: / 11-09-2013 / 01:45:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   959
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   960
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   961
!JavaSourceHighlighter::Marker methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   962
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   963
highlighter:aJavaSourceHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   964
    highlighter := aJavaSourceHighlighter.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   965
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   966
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   967
!JavaSourceHighlighter::Marker methodsFor:'syntax detection'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   968
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   969
mark: kind from:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   970
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   971
    kind == MARK_KEYWORD        ifTrue:[ ^ highlighter markKeywordFrom: pos1 + 1 to: pos2 + 1].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   972
    kind == MARK_KEYWORD_FLOW   ifTrue:[ ^ highlighter markKeywordFlowFrom: pos1 + 1 to: pos2 + 1 ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   973
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   974
    kind == MARK_NUMBER         ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   975
    kind == MARK_STRING         ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   976
    kind == MARK_CHARACTER      ifTrue:[ ^ highlighter markConstantFrom: pos1 + 1 to: pos2 + 1 ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   977
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   978
    kind == MARK_COMMENT        ifTrue:[ ^ highlighter markCommentFrom: pos1 + 1 to: pos2 + 1 ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   979
    kind == MARK_JAVADOC        ifTrue:[ ^ highlighter markCommentFrom: pos1 + 1 to: pos2 + 1 ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   980
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   981
    kind == MARK_SELECTOR      ifTrue:[ ^ highlighter markSelectorFrom: pos1 + 1 to: pos2 + 1 ].
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   982
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   983
    "Created: / 05-09-2013 / 03:03:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   984
    "Modified: / 11-09-2013 / 01:48:16 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   985
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   986
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   987
!JavaSourceHighlighter::Scanner methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   988
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   989
highlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   990
    ^ highlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   991
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   992
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   993
highlighter:aJavaSyntaxHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   994
    highlighter := aJavaSyntaxHighlighter.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   995
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   996
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   997
!JavaSourceHighlighter::Scanner methodsFor:'error handling'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   998
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   999
syntaxError:aMessage position:position to:endPos
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1000
    "a syntax error happened"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1001
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1002
    endPos notNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1003
        highlighter markBadIdentifierFrom:position to: endPos.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1004
    ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1005
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1006
    "Created: / 13-04-2012 / 18:31:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1007
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1008
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1009
!JavaSourceHighlighter::Scanner methodsFor:'initialization'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1010
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1011
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1012
    "initialize the scanner"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1013
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1014
    super initialize.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1015
    saveComments := true.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1016
    buffer := Array new: 3.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1017
    bufferFirst := 1.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1018
    bufferLast := 0.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1019
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1020
    "Created: / 17-03-2012 / 00:02:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1021
    "Modified: / 01-09-2013 / 18:51:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1022
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1023
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1024
!JavaSourceHighlighter::Scanner methodsFor:'private'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1025
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1026
checkForKeyword:string
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1027
    | isKW |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1028
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1029
    isKW := super checkForKeyword:string.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1030
    isKW ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1031
        highlighter markKeyword:string from:tokenStartPosition + 1 to:tokenStartPosition + string size
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1032
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1033
    ^isKW
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1034
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1035
    "Created: / 17-03-2012 / 00:15:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1036
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1037
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1038
!JavaSourceHighlighter::Scanner methodsFor:'reading next token'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1039
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1040
nextToken
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1041
    | t |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1042
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1043
    t := super nextToken.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1044
    t == #String ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1045
        highlighter markStringFrom:tokenStartPosition + 1 to: tokenEndPosition + 1.  
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1046
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1047
    t == #Integer ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1048
        highlighter markConstantFrom:tokenStartPosition + 1 to: tokenEndPosition + 1.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1049
    ]].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1050
"/    bufferLast := (bufferLast \\ buffer size) + 1.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1051
"/    bufferLast == bufferFirst ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1052
"/        bufferFirst := (bufferFirst \\ buffer size) + 1.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1053
"/    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1054
"/    buffer at: bufferLast put: self token.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1055
"/    "/ Now, do a quick check for some common token sequences...not a full parsing,
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1056
"/    "/ but helps a bit
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1057
"/    ((bufferLast - bufferFirst) \\ 10) > 2 ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1058
"/        "/ Quick check for method call sequence...
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1059
"/        t == $( ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1060
"/
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1061
"/            ((buffer at:(bufferLast - 1) \\ buffer size) type == #Identifier
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1062
"/                and:[(buffer at:(bufferLast - 2) \\ buffer size) type == $.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1063
"/                and:[(buffer at:(bufferLast - 1) \\ buffer size) value first isLowercase]])
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1064
"/                ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1065
"/                    | nameToken |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1066
"/    
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1067
"/                    nameToken := (buffer at:(bufferLast - 1) \\ buffer size).
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1068
"/                    highlighter markSelector: nameToken value from: nameToken startPosition to: nameToken endPosition.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1069
"/                    ^ t
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1070
"/                ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1071
"/        ].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1072
"/        "/ Add more patterns here
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1073
"/    ].
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1074
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1075
    ^ t
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1076
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1077
    "Created: / 14-05-1998 / 15:48:04 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1078
    "Modified: / 16-05-1998 / 19:12:29 / cg"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1079
    "Created: / 17-03-2012 / 19:15:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1080
    "Modified: / 03-10-2013 / 20:25:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1081
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1082
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1083
skipComment
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1084
    super skipComment.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1085
    highlighter markCommentFrom:((tokenStartPosition + 1) max: 1) to: source position.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1086
    ^nil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1087
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1088
    "Created: / 17-03-2012 / 00:04:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1089
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1090
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1091
skipEOLComment
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1092
    super skipEOLComment.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1093
    highlighter markCommentFrom:((tokenStartPosition - 1) max: 1) to: source position.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1094
    ^nil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1095
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1096
    "Created: / 17-03-2012 / 00:05:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1097
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1098
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1099
!JavaSourceHighlighter class methodsFor:'documentation'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1100
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1101
version_CVS
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
  1102
    ^ '$Header: /cvs/stx/stx/libjava/tools/JavaSyntaxHighlighter.st,v 1.2 2013-02-25 11:15:35 vrany Exp $'
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1103
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1104
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1105
version_HG
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1106
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1107
    ^ '$Changeset: <not expanded> $'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1108
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1109
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1110
version_SVN
2353
fa7400d022a0 Updated to https://swing.fit.cvut.cz/hg/stx.libjava/rev/31f8b995905e
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1111
    ^ 'Id'
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1112
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1113
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1114
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1115
JavaSourceHighlighter::Indexer initialize!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1116
JavaSourceHighlighter::Marker initialize!