tools/JavaSyntaxHighlighter.st
author Claus Gittinger <cg@exept.de>
Fri, 07 Jun 2019 22:52:13 +0200
branchcvs_MAIN
changeset 3903 e0870fe108eb
parent 3717 f5197ddddac5
permissions -rw-r--r--
#REFACTORING by cg class: ProxyMethod changed: #printStringForBrowserWithSelector:inClass: (send #withColor: instead of #colorizeAllWith:)
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
"
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3302
diff changeset
     2
 COPYRIGHT (c) 1996-2015 by Claus Gittinger
2678
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
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3302
diff changeset
     6
 COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
2678
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
3677
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
    23
"{ NameSpace: Smalltalk }"
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
    24
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    25
JavaAbstractSourceHighlighter subclass:#JavaSyntaxHighlighter
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    26
	instanceVariableNames:''
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    27
	classVariableNames:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    28
	poolDictionaries:''
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    29
	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
    30
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    31
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    32
Object subclass:#Indexer
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
    33
	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
    34
	classVariableNames:''
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    35
	poolDictionaries:''
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    36
	privateIn:JavaSyntaxHighlighter
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    37
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
    38
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    39
Object subclass:#Marker
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    40
	instanceVariableNames:'highlighter'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    41
	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
    42
		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
    43
		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
    44
	poolDictionaries:''
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    45
	privateIn:JavaSyntaxHighlighter
2678
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
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    48
!JavaSyntaxHighlighter class methodsFor:'documentation'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    49
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    50
copyright
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    51
"
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3302
diff changeset
    52
 COPYRIGHT (c) 1996-2015 by Claus Gittinger
2678
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
 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
    55
3324
a58245c0e83a Updated copyright notices.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3302
diff changeset
    56
 COPYRIGHT (c) 2010-2015 by Jan Vrany, Jan Kurs and Marcel Hlopko
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    57
                            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
    58
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    59
 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
    60
 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
    61
 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
    62
 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
    63
 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
    64
 hereby transferred.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    65
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    66
 [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
    67
     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
    68
     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
    69
     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
    70
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
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    73
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    74
documentation
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    75
"
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    76
    A syntax highligter for Java. Unlike JavaLexicalHighlighter,
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    77
    this one does full parsing (using eclipse compiler) so it is
3717
f5197ddddac5 #OTHER by mawalch
mawalch
parents: 3677
diff changeset
    78
    slower (especially when classes are not loaded).
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    79
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    80
    To avoid this initial lag, which is very annoying from UX point
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    81
    of view, it temporarily bails out to lexical highlighting.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    82
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    83
    [author:]
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    84
        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
    85
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
    86
    [instance variables:]
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
    [class 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
    [see also:]
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
"
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
3226
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
    95
!JavaSyntaxHighlighter class methodsFor:'formatting'!
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
    96
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
    97
formatClassDefinition: code line: line number: lineNr in: cls
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
    98
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
    99
    ^self new formatClassDefinition: code line: line number: lineNr in: cls
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   100
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   101
    "Created: / 12-08-2014 / 13:35:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   102
! !
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   103
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   104
!JavaSyntaxHighlighter methodsFor:'formatting'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   105
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   106
formatClassDefinition:source in:class
2971
a44d1fa11204 Fix in JavaSourceHighlighter>>#formatClassDefinition:in: - care for formatting class side...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2951
diff changeset
   107
    | marker cacheIt document sourceUnit parser tree resolve loader |
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   108
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   109
    "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
   110
     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
   111
     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
   112
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   113
    preferences isNil ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   114
        preferences := UserPreferences current.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   115
    ].
3103
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   116
    JavaVM booted ifFalse:[
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   117
        ^ self format: source string.
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   118
    ].
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   119
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   120
    cacheIt := class notNil and: [class isBehavior and:[class theNonMetaclass isJavaClass]].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   121
    cacheIt ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   122
        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   123
        document notNil ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   124
            (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
   125
                (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
   126
                     sourceIndex addAll: document sourceTreeIndex.
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   127
                     sourceIndex tree:  document sourceTreeIndex tree.
3062
a3f6e540a232 Keep source along with parse tree index.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3049
diff changeset
   128
                     sourceIndex source: document sourceText.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   129
                ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   130
                ^ document sourceText copy.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   131
            ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   132
        ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   133
            document := JavaSourceDocument for: class theNonMetaclass.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   134
            (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
   135
                 sourceIndex := SmallSense::ParseTreeIndex new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   136
            ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   137
            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   138
            ^ self format: source.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   139
        ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   140
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   141
    marker := Marker new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   142
    marker highlighter: self.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   143
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   144
    sourceText := source isText 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   145
                    ifTrue:[source copy] 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   146
                    ifFalse:[source asText].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   147
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   148
    self doLexicalHighlightingOnly ifTrue:[          
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   149
        sourceText := self format: source string.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   150
    ] ifFalse:[
3103
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   151
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   152
        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
   153
        sourceUnit setContents: source string.
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   154
        parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   155
        parser setMarker: marker.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   156
        (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
   157
            | indexer |
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   158
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   159
            indexer := Indexer new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   160
            indexer index: sourceIndex.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   161
            parser setIndexer: indexer.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   162
        ].
2951
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   163
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   164
        "/ Following is support JImport expecco plugin. For classes loaded by
2971
a44d1fa11204 Fix in JavaSourceHighlighter>>#formatClassDefinition:in: - care for formatting class side...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2951
diff changeset
   165
        "/ JImport plugin, do not resolve classes. The LookupEnvironment cannot
2951
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   166
        "/ find them as they are not installed in class registry...
3302
777478bcd3f9 Fix in JavaSyntaxHighlighter: do resolve classes...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3226
diff changeset
   167
        resolve := class notNil and:[class isJavaClass and:[ (loader := class theNonMetaclass classLoader) isNil or:[loader isJavaObject] ] ].
2951
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   168
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   169
        tree := parser parse: sourceUnit diet: false resolve: resolve.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   170
        (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
   171
            sourceIndex tree: tree. 
3062
a3f6e540a232 Keep source along with parse tree index.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3049
diff changeset
   172
            sourceIndex source: sourceText.
2789
e6109bd7dfd2 Problem highlighting optimization/cleanup.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2788
diff changeset
   173
        ].
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   174
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   175
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   176
    ^ cacheIt ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   177
        document sourceText: sourceText.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   178
        document sourceTreeIndex: sourceIndex.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   179
        sourceText copy
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   180
    ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   181
        sourceText
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   182
    ]
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   183
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   184
    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3302
777478bcd3f9 Fix in JavaSyntaxHighlighter: do resolve classes...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3226
diff changeset
   185
    "Modified: / 12-12-2014 / 03:04:40 / 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
   186
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   187
3226
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   188
formatClassDefinition: code line: line number: lineNr in: cls
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   189
    ^ JavaLexicalHighlighter formatClassDefinition: code line: line number: lineNr in: cls
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   190
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   191
    "Created: / 12-08-2014 / 13:35:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   192
!
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   193
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   194
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
   195
    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
   196
    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
   197
        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
   198
    ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   199
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   200
    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
   201
        ^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
   202
    ].   
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   203
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   204
    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
   205
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   206
    self doLexicalHighlightingOnly ifTrue:[
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   207
        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
   208
    ] ifFalse:[
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   209
        | 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
   210
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2894
diff changeset
   211
        JavaVM booted ifFalse:[JavaVM boot].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   212
        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
   213
        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
   214
            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
   215
            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
   216
        ].
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   217
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   218
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   219
        document resolve.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   220
        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
   221
        marker := Marker new.
2778
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   222
        marker highlighter: self. 
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   223
        JavaCompiler synchronized:[
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   224
            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
   225
        ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   226
        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
   227
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   228
        debug :=  false.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   229
        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
   230
        debug ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   231
            nodes inspect.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   232
        ]
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   233
    ].
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   234
    ^ sourceText
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   235
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   236
    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2894
diff changeset
   237
    "Modified (format): / 26-11-2013 / 23:04:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   238
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   239
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   240
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
   241
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   242
    ^ JavaLexicalHighlighter formatMethod:mthd source:newCode line: line number: lnr in:cls using:syntaxPreferences
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   243
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   244
    "Created: / 25-06-2014 / 12:49:51 / 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
   245
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   246
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   247
!JavaSyntaxHighlighter methodsFor:'formatting-private'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   248
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   249
format: source
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   250
    ^ JavaLexicalHighlighter new format: source
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   251
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   252
    "Created: / 25-06-2014 / 11:56:08 / 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
   253
! !
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   254
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   255
!JavaSyntaxHighlighter methodsFor:'queries'!
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   256
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   257
doLexicalHighlightingOnly
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   258
    "/ 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
   259
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   260
    | process wgroups |
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   261
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   262
    process := Processor activeProcess.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   263
    wgroups := WindowGroup scheduledWindowGroups.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   264
    [ process notNil ] whileTrue:[
3677
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   265
        | groups wg application mainView |
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   266
        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
   267
        groups notEmpty ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   268
            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
   269
            wg isNil ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   270
                wg := groups anElement
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   271
            ].
3677
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   272
            (mainView := wg mainView) notNil ifTrue:[
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   273
                mainView isDebugView ifTrue:[ ^ true ].
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   274
                (application := mainView application) notNil ifTrue:[
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   275
                    application class == (Smalltalk at: #'JDI::DebuggerApplication') ifTrue:[ ^ true ].
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   276
                    application class == Tools::NewSystemBrowser ifTrue:[ ^ false ].
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   277
                ]
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   278
            ]
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   279
        ].
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   280
        process := process parentProcess.                    
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   281
    ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   282
    ^ false
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   283
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   284
    "Created: / 09-09-2013 / 02:25:39 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   285
    "Modified: / 25-03-2014 / 13:32:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   286
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   287
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   288
!JavaSyntaxHighlighter::Indexer class methodsFor:'initialization'!
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   289
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   290
initialize
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   291
    "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
   292
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   293
    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
   294
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   295
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   296
    "/ 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
   297
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   298
    "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
   299
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   300
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   301
!JavaSyntaxHighlighter::Indexer methodsFor:'accessing'!
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   302
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   303
index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   304
    ^ index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   305
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   306
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   307
index:aParseTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   308
    index := aParseTreeIndex.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   309
    types := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   310
    fields := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   311
    locals := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   312
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   313
    "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
   314
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   315
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   316
!JavaSyntaxHighlighter::Indexer methodsFor:'indexing'!
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   317
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   318
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
   319
    | element |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   320
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   321
    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
   322
    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
   323
    ^ element
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   324
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   325
    "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
   326
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   327
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   328
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
   329
    | 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
   330
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   331
    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
   332
    binding := node binding.
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   333
    binding notNil ifTrue:[
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   334
        fname := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   335
        previous := fields at: fname ifAbsent: nil.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   336
        previous notNil ifTrue:[
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   337
            previous next: element.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   338
        ].
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   339
        fields at: fname put: element.
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   340
    ].
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   341
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   342
    "Created: / 01-10-2013 / 10:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   343
    "Modified: / 08-10-2013 / 17:18:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   344
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   345
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   346
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
   347
    | element fname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   348
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   349
    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
   350
    fname := node name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   351
    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
   352
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   353
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   354
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   355
    locals at: fname put: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   356
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   357
    "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
   358
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   359
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   360
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
   361
    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
   362
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   363
    "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
   364
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   365
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   366
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
   367
    | element tname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   368
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   369
    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
   370
    tname := node getTypeName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   371
    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
   372
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   373
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   374
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   375
    types at: tname put: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   376
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   377
    "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
   378
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   379
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   380
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
   381
    | element binding name previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   382
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   383
    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
   384
    binding := node binding.
2893
272f9a99e3db Fix in JavaSourceHighlighter::Indexer - allow for null variable binding.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2876
diff changeset
   385
    binding isNil ifTrue:[ ^ self ].
2787
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   386
    "/ 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
   387
    binding problemId ~~ 0 ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   388
        name := binding name.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   389
        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
   390
        previous notNil ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   391
            previous next: element.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   392
        ].
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   393
        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
   394
        ^ self.              
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   395
    ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   396
    (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
   397
        name := binding compoundName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   398
        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
   399
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   400
            previous next: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   401
        ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   402
        types at: name put: element.   
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   403
        ^ self.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   404
    ].
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   405
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   406
    binding kind == 2r001 "FIELD" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   407
        binding declaringClass isNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   408
            name := '???.' , binding name
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   409
        ] ifFalse:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   410
            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
   411
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   412
        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
   413
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   414
            previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   415
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   416
        fields at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   417
        ^ self.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   418
    ].
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   419
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   420
    binding kind == 2r010 "LOCAL" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   421
        name := binding name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   422
        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
   423
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   424
            previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   425
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   426
        locals at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   427
        ^ self.   
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   428
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   429
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   430
    self error: 'Should not happen'
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   431
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   432
    "Created: / 01-10-2013 / 10:33:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2893
272f9a99e3db Fix in JavaSourceHighlighter::Indexer - allow for null variable binding.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2876
diff changeset
   433
    "Modified: / 26-10-2013 / 21:27:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   434
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   435
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   436
methodEnter: node
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   437
    locals := Dictionary new
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   438
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   439
    "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
   440
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   441
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   442
methodLeave: node
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   443
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   444
    "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
   445
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   446
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   447
!JavaSyntaxHighlighter::Marker class methodsFor:'initialization'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   448
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   449
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   450
    "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
   451
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   452
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   453
    !!!! IMPORTANT !!!!!!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   454
    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
   455
    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
   456
    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
   457
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   458
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   459
    self lookupObject: JavaLookup instance.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   460
    
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   461
    MARK_KEYWORD        := 1.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   462
    MARK_NUMBER         := 2.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   463
    MARK_STRING         := 3.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   464
    MARK_CHARACTER      := 4.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   465
    MARK_COMMENT        := 5.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   466
    MARK_JAVADOC        := 6.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   467
    MARK_KEYWORD_FLOW   := 7.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   468
    MARK_SELECTOR       := 8.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   469
    MARK_FIELD          := 9.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   470
    MARK_FIELD_ASSIGNED := 10.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   471
    MARK_LOCAL          := 11.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   472
    MARK_CLASS          := 12.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   473
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   474
    "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
   475
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   476
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   477
!JavaSyntaxHighlighter::Marker methodsFor:'accessing'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   478
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   479
highlighter:aJavaSourceHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   480
    highlighter := aJavaSourceHighlighter.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   481
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   482
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   483
!JavaSyntaxHighlighter::Marker methodsFor:'syntax detection'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   484
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   485
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
   486
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   487
    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
   488
    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
   489
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   490
    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
   491
    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
   492
    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
   493
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   494
    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
   495
    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
   496
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   497
    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
   498
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   499
    "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
   500
    "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
   501
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   502
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   503
!JavaSyntaxHighlighter class methodsFor:'documentation'!
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   504
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   505
version_CVS
3677
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   506
    ^ '$Header$'
2678
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
version_HG
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   510
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   511
    ^ '$Changeset: <not expanded> $'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   512
!
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
version_SVN
3677
c19ed1dbf0f9 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 3412
diff changeset
   515
    ^ '$Id$'
2678
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
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   519
JavaSyntaxHighlighter::Indexer initialize!
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   520
JavaSyntaxHighlighter::Marker initialize!