tools/JavaSourceHighlighter.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Fri, 04 Oct 2013 08:59:25 +0100
branchdevelopment
changeset 2788 b25c8b9e886a
parent 2787 d4914ffbb0cf
child 2789 e6109bd7dfd2
permissions -rw-r--r--
Highlighter cleanup, addes support for Groovy.
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
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   215
    | marker cacheIt document sourceUnit parser tree |
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
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   224
    cacheIt := class notNil and:[class isJavaClass].
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.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   231
                ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   232
                ^ document sourceText copy.
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
        ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   235
            document := JavaSourceDocument for: class theNonMetaclass.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   236
            (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
   237
                 sourceIndex := SmallSense::ParseTreeIndex new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   238
            ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   239
            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
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
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   242
    marker := Marker new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   243
    marker highlighter: self.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   244
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   245
    sourceText := source isText 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   246
                    ifTrue:[source copy] 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   247
                    ifFalse:[source asText].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   248
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   249
    self doLexicalHighlightingOnly ifTrue:[          
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   250
        sourceText := self format: source string.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   251
    ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   252
        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
   253
        sourceUnit setContents: source string.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   254
        JavaCompiler synchronized:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   255
            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
   256
        ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   257
        parser setMarker: marker.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   258
        (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
   259
            | indexer |
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   260
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   261
            indexer := Indexer new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   262
            indexer index: sourceIndex.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   263
            parser setIndexer: indexer.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   264
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   265
        ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   266
        tree := parser parse: sourceUnit diet: false resolve: true.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   267
        (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
   268
            sourceIndex tree: tree. 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   269
        ]
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   270
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   271
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   272
    ^ cacheIt ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   273
        document sourceText: sourceText.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   274
        document sourceTreeIndex: sourceIndex.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   275
        sourceText copy
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   276
    ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   277
        sourceText
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   278
    ]
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   279
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   280
    "Created: / 04-08-2011 / 23:44:52 / 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
   281
    "Modified: / 03-10-2013 / 20:12:00 / 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
   282
!
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   283
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   284
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
   285
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   286
    sourceIndex := els.
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   287
    ^self formatClassDefinition:source in:class
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   288
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   289
    "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
   290
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   291
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   292
formatExpression:source in:class
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   293
    ^ self format: source
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   294
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   295
    "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
   296
    "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
   297
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   298
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   299
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
   300
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   301
    sourceIndex := els.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   302
    ^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
   303
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   304
    "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
   305
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   306
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   307
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
   308
    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
   309
    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
   310
        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
   311
    ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   312
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   313
    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
   314
        ^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
   315
    ].   
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   316
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   317
    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
   318
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   319
    self doLexicalHighlightingOnly ifTrue:[
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   320
        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
   321
    ] ifFalse:[
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   322
        | 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
   323
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   324
        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
   325
        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
   326
            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
   327
            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
   328
        ].
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   329
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   330
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   331
        document resolve.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   332
        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
   333
        marker := Marker new.
2778
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   334
        marker highlighter: self. 
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   335
        JavaCompiler synchronized:[
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   336
            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
   337
        ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   338
        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
   339
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   340
        debug :=  false.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   341
        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
   342
        debug ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   343
            nodes inspect.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   344
        ]
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   345
    ].
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   346
    ^ sourceText
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   347
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   348
    "Created: / 04-08-2011 / 23:45:10 / 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
   349
    "Modified (format): / 03-10-2013 / 20:20:18 / 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
   350
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   351
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   352
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
   353
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   354
    preferences := prefs.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   355
    sourceIndex := els.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   356
    ^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
   357
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   358
    "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
   359
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   360
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   361
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
   362
    | scanner |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   363
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   364
    line isEmptyOrNil ifTrue:[ ^  nil ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   365
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   366
    sourceText := line asText.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   367
    preferences := syntaxPreferences.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   368
    preferences isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   369
        preferences := UserPreferences current.
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
    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
   372
    scanner highlighter: self.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   373
    [
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   374
        [ scanner nextToken ~~ #EOF ] whileTrue.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   375
    ] on: Error do:[
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
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   378
    ^ sourceText
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   379
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   380
    "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
   381
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   382
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   383
!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
   384
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   385
format: source
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   386
    "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
   387
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   388
    | 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
   389
    sourceText := source asText.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   390
    scanner := Scanner for: source string.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   391
    scanner highlighter: self.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   392
    [
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   393
        [ (token := scanner nextToken) ~~ #EOF ] whileTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   394
            "/ 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
   395
            token == $( ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   396
                lastPosition0 == #Identifier ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   397
                    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
   398
                ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   399
            ].
2787
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   400
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   401
            lastToken1 := lastToken0.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   402
            lastValue1 := lastValue0.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   403
            lastPosition1  := lastPosition0.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   404
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   405
            lastToken0 := token.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   406
            lastValue0 := scanner tokenValue.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   407
            lastPosition0 := scanner tokenStartPosition.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   408
        ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   409
    ] on: Error do:[:ex|
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   410
    ].   
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   411
    ^ sourceText
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   412
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   413
    "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
   414
! !
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   415
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   416
!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
   417
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   418
doLexicalHighlightingOnly
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   419
    "/ 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
   420
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   421
    | process wgroups |
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   422
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   423
    process := Processor activeProcess.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   424
    wgroups := WindowGroup scheduledWindowGroups.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   425
    [ process notNil ] whileTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   426
        | groups wg |
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   427
        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
   428
        groups notEmpty ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   429
            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
   430
            wg isNil ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   431
                wg := groups anElement
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   432
            ].
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   433
            (wg mainView class == DebugView) ifTrue:[ ^ true ]
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   434
        ].
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   435
        process := process parentProcess.                    
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   436
    ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   437
    ^ false
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   438
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   439
    "Created: / 09-09-2013 / 02:25:39 / 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
   440
    "Modified: / 11-09-2013 / 03:39:03 / 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
   441
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   442
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   443
!JavaSourceHighlighter methodsFor:'syntax detection'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   444
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   445
markArgumentIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   446
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   447
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   448
        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
   449
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   450
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   451
markBadIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   452
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   453
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   454
        withEmphasis:(preferences badIdentifierEmphasis) 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   455
        color:(preferences badIdentifierColor)
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
markClassVariableIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   459
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   460
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   461
        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
   462
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   463
    "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
   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
markCommentFrom: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 commentEmphasis) color:(preferences commentColor)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   470
!
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
markConstantFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   473
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   474
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   475
        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
   476
!
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
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
   479
    |e p2 clr|
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
    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
   482
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   483
    clr = Color black ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   484
        e := fontEmp
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   485
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   486
        fontEmp isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   487
            e := (#color->clr)
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   488
        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   489
            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
   490
        ]
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
    (p2 := pos2) isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   493
        p2 := sourceText size
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   494
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   495
        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
   496
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   497
    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
   498
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   499
    "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
   500
    "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
   501
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   502
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   503
markFunctionNameFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   504
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   505
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   506
        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
   507
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   508
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   509
markGlobalClassIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   510
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   511
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   512
        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
   513
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   514
    "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
   515
    "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
   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
markGlobalIdentifierFrom: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 globalIdentifierEmphasis) color:(preferences globalIdentifierColor)
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
    "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
   524
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   525
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   526
markIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   527
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   528
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   529
        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
   530
!
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
markInstVarIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   533
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   534
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   535
        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
   536
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   537
    "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
   538
    "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
   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
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
   542
    |em clr|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   543
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   544
    ( #( 'if' 'else'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   545
         'while'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   546
         'for'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   547
         'do'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   548
         'return'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   549
         'continue'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   550
         'break'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   551
    ) includes:kw) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   552
        em := preferences controlFlowSelectorEmphasis. 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   553
        clr := preferences controlFlowSelectorColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   554
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   555
        em := preferences jsKeywordEmphasis.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   556
        clr := preferences jsKeywordColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   557
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   558
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   559
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   560
        withEmphasis:em color:clr
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   561
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   562
    "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
   563
    "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
   564
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   565
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   566
markKeywordFlowFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   567
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   568
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   569
        withEmphasis:preferences controlFlowSelectorEmphasis
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   570
        color:preferences controlFlowSelectorColor
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   571
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   572
    "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
   573
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   574
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   575
markKeywordFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   576
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   577
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   578
        withEmphasis:preferences jsKeywordEmphasis
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   579
        color:preferences jsKeywordColor
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
    "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
   582
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   583
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   584
markLocalIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   585
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   586
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   587
        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
   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
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
   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 badIdentifierEmphasis) 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   594
        color:(preferences badIdentifierColor)
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: / 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
   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
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
   600
    | fg em |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   601
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   602
    fg := preferences selectorColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   603
    em := preferences selectorEmphasis.
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
    self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   606
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   607
        withEmphasis:em color:fg
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   608
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   609
    "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
   610
    "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
   611
    "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
   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 receiverNode:aReceiverNodeOrNil numArgs:numArgs
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   615
    |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
   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
"/    (currentEnvironment notNil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   621
"/    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
   622
"/          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
   623
"/    ])
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   624
"/    ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   625
"/        "/ a local call
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   626
"/    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   627
"/        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
   628
"/        selectorSymbol isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   629
"/            fg := Color red.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   630
"/        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   631
"/            fullSelectorCheck == true ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   632
"/                aReceiverNodeOrNil notNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   633
"/                    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
   634
"/                                     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
   635
"/
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   636
"/                    ok := false.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   637
"/
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   638
"/                    "/ limit search if possible
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   639
"/                    (classToCompileFor notNil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   640
"/                     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
   641
"/                        currentSuperclasses isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   642
"/                            currentSuperclasses := classToCompileFor withAllSuperclasses.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   643
"/                        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   644
"/                        ok := currentSuperclasses contains:check.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   645
"/                        (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
   646
"/                            currentSubclasses isNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   647
"/                                currentSubclasses := classToCompileFor allSubclasses.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   648
"/                            ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   649
"/                            ok := currentSubclasses contains:check.
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
"/                    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   652
"/                        aReceiverNodeOrNil isConstant ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   653
"/                            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
   654
"/                        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   655
"/                            (aReceiverNodeOrNil isGlobal 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   656
"/                            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
   657
"/                                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
   658
"/                            ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   659
"/                                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
   660
"/                            ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   661
"/                        ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   662
"/                    ].
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 ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   665
"/                        em := preferences unimplementedSelectorEmphasis.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   666
"/                        fg := preferences unimplementedSelectorColor.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   667
"/                    ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   668
"/                ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   669
"/            ]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   670
"/        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   671
"/    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   672
    self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   673
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   674
        withEmphasis:em color:fg
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
    "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
   677
    "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
   678
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   679
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   680
markSelectorFrom:pos1 to:pos2 
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   681
    | fg em |
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   682
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   683
    fg := preferences selectorColor.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   684
    em := preferences selectorEmphasis.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   685
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   686
    self
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   687
        markFrom:pos1 to:pos2 
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   688
        withEmphasis:em color:fg
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   689
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   690
    "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
   691
!
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   692
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   693
markSelfFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   694
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   695
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   696
        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
   697
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   698
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   699
markStringFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   700
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   701
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   702
        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
   703
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   704
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   705
markUnknownIdentifierFrom:pos1 to:pos2
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   706
    self 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   707
        markFrom:pos1 to:pos2 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   708
        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
   709
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   710
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   711
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
   712
    "support for syntaxColoring"
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
    |type globalValue nameSym|
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   715
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   716
    type := v type.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   717
    (type == #BlockArg
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   718
    or:[type == #MethodArg]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   719
        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
   720
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   721
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   722
    (type == #BlockVariable
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   723
    or:[type == #MethodVariable]) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   724
        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
   725
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   726
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   727
    (type == #GlobalVariable) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   728
        nameSym := v name asSymbolIfInterned.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   729
        (nameSym isNil 
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   730
        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
   731
            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
   732
            ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   733
        ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   734
        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
   735
        globalValue isBehavior ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   736
            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
   737
        ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   738
            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
   739
        ].
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 == #ClassVariable) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   743
        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
   744
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   745
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   746
    (type == #InstanceVariable) ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   747
        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
   748
        ^ self
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   749
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   750
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   751
    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
   752
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   753
    "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
   754
    "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
   755
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   756
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   757
!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
   758
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   759
initialize
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   760
    "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
   761
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   762
    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
   763
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   764
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   765
    "/ 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
   766
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   767
    "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
   768
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   769
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   770
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   771
!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
   772
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   773
index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   774
    ^ index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   775
!
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
index:aParseTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   778
    index := aParseTreeIndex.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   779
    types := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   780
    fields := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   781
    locals := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   782
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   783
    "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
   784
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   785
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   786
!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
   787
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   788
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
   789
    | element |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   790
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   791
    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
   792
    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
   793
    ^ element
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   794
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   795
    "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
   796
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   797
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   798
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
   799
    | 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
   800
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   801
    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
   802
    binding := node binding.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   803
    fname := (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
   804
    previous := fields at: fname ifAbsent: nil.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   805
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   806
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   807
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   808
    fields at: fname put: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   809
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   810
    "Created: / 01-10-2013 / 10:33:17 / 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
   811
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   812
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   813
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
   814
    | element fname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   815
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   816
    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
   817
    fname := node name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   818
    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
   819
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   820
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   821
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   822
    locals at: fname put: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   823
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   824
    "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
   825
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   826
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   827
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
   828
    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
   829
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   830
    "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
   831
!
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
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
   834
    | element tname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   835
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   836
    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
   837
    tname := node getTypeName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   838
    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
   839
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   840
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   841
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   842
    types at: tname put: element.
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
    "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
   845
!
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
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
   848
    | element binding name previous |
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
    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
   851
    binding := node binding.
2787
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   852
    "/ 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
   853
    binding problemId ~~ 0 ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   854
        name := binding name.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   855
        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
   856
        previous notNil ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   857
            previous next: element.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   858
        ].
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   859
        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
   860
        ^ self.              
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   861
    ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   862
    (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
   863
        name := binding compoundName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   864
        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
   865
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   866
            previous next: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   867
        ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   868
        types at: name put: element.   
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   869
        ^ self.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   870
    ].
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   871
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   872
    binding kind == 2r001 "FIELD" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   873
        binding declaringClass isNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   874
            name := '???.' , binding name
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   875
        ] ifFalse:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   876
            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
   877
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   878
        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
   879
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   880
            previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   881
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   882
        fields at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   883
        ^ self.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   884
    ].
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   885
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   886
    binding kind == 2r010 "LOCAL" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   887
        name := binding name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   888
        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
   889
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   890
            previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   891
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   892
        locals at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   893
        ^ self.   
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   894
    ].
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
    self error: 'Should not happen'
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   897
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   898
    "Created: / 01-10-2013 / 10:33:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2787
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   899
    "Modified: / 03-10-2013 / 18:41:37 / 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
   900
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   901
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   902
methodEnter: node
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   903
    locals := Dictionary new
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   904
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   905
    "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
   906
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   907
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   908
methodLeave: node
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
    "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
   911
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   912
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   913
!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
   914
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   915
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   916
    "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
   917
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   918
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   919
    !!!! IMPORTANT !!!!!!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   920
    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
   921
    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
   922
    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
   923
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   924
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   925
    self lookupObject: JavaLookup instance.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   926
    
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   927
    MARK_KEYWORD        := 1.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   928
    MARK_NUMBER         := 2.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   929
    MARK_STRING         := 3.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   930
    MARK_CHARACTER      := 4.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   931
    MARK_COMMENT        := 5.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   932
    MARK_JAVADOC        := 6.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   933
    MARK_KEYWORD_FLOW   := 7.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   934
    MARK_SELECTOR       := 8.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   935
    MARK_FIELD          := 9.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   936
    MARK_FIELD_ASSIGNED := 10.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   937
    MARK_LOCAL          := 11.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   938
    MARK_CLASS          := 12.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   939
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   940
    "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
   941
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   942
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   943
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   944
!JavaSourceHighlighter::Marker methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   945
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   946
highlighter:aJavaSourceHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   947
    highlighter := aJavaSourceHighlighter.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   948
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   949
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   950
!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
   951
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   952
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
   953
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   954
    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
   955
    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
   956
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   957
    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
   958
    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
   959
    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
   960
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   961
    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
   962
    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
   963
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   964
    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
   965
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   966
    "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
   967
    "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
   968
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   969
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   970
!JavaSourceHighlighter::Scanner methodsFor:'accessing'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   971
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   972
highlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   973
    ^ highlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   974
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   975
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   976
highlighter:aJavaSyntaxHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   977
    highlighter := aJavaSyntaxHighlighter.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   978
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   979
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   980
!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
   981
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   982
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
   983
    "a syntax error happened"
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   984
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   985
    endPos notNil ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   986
        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
   987
    ]
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
    "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
   990
! !
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
!JavaSourceHighlighter::Scanner methodsFor:'initialization'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   993
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   994
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   995
    "initialize the scanner"
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
    super initialize.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   998
    saveComments := true.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   999
    buffer := Array new: 3.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1000
    bufferFirst := 1.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1001
    bufferLast := 0.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1002
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1003
    "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
  1004
    "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
  1005
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1006
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1007
!JavaSourceHighlighter::Scanner methodsFor:'private'!
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
checkForKeyword:string
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1010
    | isKW |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1011
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1012
    isKW := super checkForKeyword:string.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1013
    isKW ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1014
        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
  1015
    ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1016
    ^isKW
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1017
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1018
    "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
  1019
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1020
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1021
!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
  1022
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1023
nextToken
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1024
    | t |
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
    t := super nextToken.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1027
    t == #String ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1028
        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
  1029
    ] ifFalse:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1030
    t == #Integer ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1031
        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
  1032
    ]].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1033
"/    bufferLast := (bufferLast \\ buffer size) + 1.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1034
"/    bufferLast == bufferFirst ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1035
"/        bufferFirst := (bufferFirst \\ buffer size) + 1.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1036
"/    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1037
"/    buffer at: bufferLast put: self token.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1038
"/    "/ 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
  1039
"/    "/ but helps a bit
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1040
"/    ((bufferLast - bufferFirst) \\ 10) > 2 ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1041
"/        "/ 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
  1042
"/        t == $( ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1043
"/
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1044
"/            ((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
  1045
"/                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
  1046
"/                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
  1047
"/                ifTrue:[
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1048
"/                    | nameToken |
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1049
"/    
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1050
"/                    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
  1051
"/                    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
  1052
"/                    ^ t
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1053
"/                ].
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1054
"/        ].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1055
"/        "/ Add more patterns here
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
  1056
"/    ].
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1057
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1058
    ^ t
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1059
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1060
    "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
  1061
    "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
  1062
    "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
  1063
    "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
  1064
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1065
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1066
skipComment
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1067
    super skipComment.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1068
    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
  1069
    ^nil
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
    "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
  1072
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1073
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1074
skipEOLComment
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1075
    super skipEOLComment.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1076
    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
  1077
    ^nil
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1078
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 / 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
  1080
! !
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
!JavaSourceHighlighter class methodsFor:'documentation'!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1083
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1084
version_CVS
2396
fadc6d7a2f5b Updated to rev 009a0df3afce
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2353
diff changeset
  1085
    ^ '$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
  1086
!
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
version_HG
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
    ^ '$Changeset: <not expanded> $'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1091
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1092
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1093
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
  1094
    ^ 'Id'
2678
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
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1097
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
  1098
JavaSourceHighlighter::Indexer initialize!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
  1099
JavaSourceHighlighter::Marker initialize!