tools/JavaSyntaxHighlighter.st
author Jan Vrany <jan.vrany@labware.com>
Tue, 09 Aug 2022 14:33:27 +0100
changeset 4012 117835eb9839
parent 3789 957010ea4ec1
permissions -rw-r--r--
Remove Mauve tests See previous commit for explanation.
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
3789
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
    23
"{ NameSpace: Smalltalk }"
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
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
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
    78
    slower (expecially when classes are not loader).
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:[
3789
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   114
        "/ The `...codeViewThene ? UserPreferences current` trick below is 
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   115
        "/ there to make this code working with both old and editor-thene-aware 
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   116
        "/ code. Will wanish as soon as editor thene support will be
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   117
        "/ integrated.
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   118
        preferences := UserPreferences current codeViewTheme ? UserPreferences current.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   119
    ].
3467
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   120
    (JavaVM booted not or: [self doLexicalHighlightingOnly]) ifTrue:[
3103
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   121
        ^ self format: source string.
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   122
    ].
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   123
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   124
    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
   125
    cacheIt ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   126
        document := JavaSourceDocument cachedDocumentFor: class theNonMetaclass.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   127
        document notNil ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   128
            (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
   129
                (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
   130
                     sourceIndex addAll: document sourceTreeIndex.
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   131
                     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
   132
                     sourceIndex source: document sourceText.
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   133
                ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   134
                ^ document sourceText copy.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   135
            ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   136
        ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   137
            document := JavaSourceDocument for: class theNonMetaclass.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   138
            (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
   139
                 sourceIndex := SmallSense::ParseTreeIndex new.
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
            JavaSourceDocument cachedDocumentFor: class theNonMetaclass put: document.  
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   142
            ^ self format: source.
2788
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
    ].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   145
    marker := Marker new.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   146
    marker highlighter: self.
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
    sourceText := source isText 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   149
                    ifTrue:[source copy] 
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   150
                    ifFalse:[source asText].
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   151
3467
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   152
3103
a7d69709920f Use lexical highlighting when JVM is not booted.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3101
diff changeset
   153
3467
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   154
    sourceUnit := (Java classForName:'stx.libjava.tools.Source') new.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   155
    sourceUnit setContents: source string.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   156
    parser := (Java classForName:'stx.libjava.tools.text.Highlighter') new.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   157
    parser setMarker: marker.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   158
    (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   159
        | indexer |
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   160
3467
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   161
        indexer := Indexer new.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   162
        indexer index: sourceIndex.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   163
        parser setIndexer: indexer.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   164
    ].
2951
590fd4bf22a8 Hack in JavaSourceHighlighter for JImport expecco plugin.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2950
diff changeset
   165
3467
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   166
    "/ Following is support JImport expecco plugin. For classes loaded by
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   167
    "/ JImport plugin, do not resolve classes. The LookupEnvironment cannot
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   168
    "/ find them as they are not installed in class registry...
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   169
    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
   170
3467
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   171
    tree := parser parse: sourceUnit diet: false resolve: resolve.
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   172
    (sourceIndex notNil and:[sourceIndex isKindOf: SmallSense::ParseTreeIndex]) ifTrue:[
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   173
        sourceIndex tree: tree. 
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   174
        sourceIndex source: sourceText.
2788
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
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   177
    ^ cacheIt ifTrue:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   178
        document sourceText: sourceText.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   179
        document sourceTreeIndex: sourceIndex.
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   180
        sourceText copy
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   181
    ] ifFalse:[
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   182
        sourceText
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   183
    ]
2741
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   184
a9ac61c2c454 Fixes for Java syntax highlighting and checking.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2738
diff changeset
   185
    "Created: / 04-08-2011 / 23:44:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3789
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   186
    "Modified: / 05-12-2017 / 21:19:00 / 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
   187
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   188
3226
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   189
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
    ^ 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
   191
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   192
    "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
   193
!
36c8ea432a7c Fixes in syntax hibglighting - add support for line-based highlighting
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3183
diff changeset
   194
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   195
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
   196
    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
   197
    preferences isNil ifTrue:[
3789
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   198
        "/ The `...codeViewThene ? UserPreferences current` trick below is 
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   199
        "/ there to make this code working with both old and editor-thene-aware 
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   200
        "/ code. Will wanish as soon as editor thene support will be
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   201
        "/ integrated.
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   202
        preferences := UserPreferences current codeViewTheme ? UserPreferences current.
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   203
    ].
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   204
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   205
    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
   206
        ^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
   207
    ].   
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   208
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   209
    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
   210
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   211
    self doLexicalHighlightingOnly ifTrue:[
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   212
        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
   213
    ] ifFalse:[
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   214
        | 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
   215
2950
ec1be126d72e Fixes in Java source highlighting - boot Java if not already.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2894
diff changeset
   216
        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
   217
        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
   218
        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
   219
            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
   220
            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
   221
        ].
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   222
2729
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   223
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   224
        document resolve.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   225
        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
   226
        marker := Marker new.
2778
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   227
        marker highlighter: self. 
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   228
        JavaCompiler synchronized:[
f5f21ffdbfd9 More fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2775
diff changeset
   229
            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
   230
        ].
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   231
        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
   232
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   233
        debug :=  false.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   234
        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
   235
        debug ifTrue:[
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   236
            nodes inspect.
ac412f6ea6d4 More support for method's source display. Not yet working.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2726
diff changeset
   237
        ]
2717
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   238
    ].
16564a7101b8 Initial support for displaying only selected method's source in browser.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2716
diff changeset
   239
    ^ sourceText
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   240
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   241
    "Created: / 04-08-2011 / 23:45:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
3789
957010ea4ec1 Editor theme: read styles from theme object rather than from preferences themselves
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3508
diff changeset
   242
    "Modified: / 05-12-2017 / 21:19:06 / 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
   243
!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   244
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   245
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
   246
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   247
    ^ 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
   248
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   249
    "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
   250
! !
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
!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
   253
2788
b25c8b9e886a Highlighter cleanup, addes support for Groovy.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2787
diff changeset
   254
format: source
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   255
    ^ 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
   256
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   257
    "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
   258
! !
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   259
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   260
!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
   261
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   262
doLexicalHighlightingOnly
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   263
    "/ 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
   264
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   265
    | process wgroups |
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   266
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   267
    process := Processor activeProcess.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   268
    wgroups := WindowGroup scheduledWindowGroups.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   269
    [ process notNil ] whileTrue:[
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   270
        | groups wg application |
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   271
        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
   272
        groups notEmpty ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   273
            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
   274
            wg isNil ifTrue:[
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   275
                wg := groups anElement
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   276
            ].
2876
7bcde178eee7 Fix in JavaSourceHighlighter: do full highlighting for applications spawn from the debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2836
diff changeset
   277
            (wg mainView class == DebugView) ifTrue:[ ^ true ].
3049
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   278
            (wg mainView notNil and:[(application := wg mainView application) notNil]) ifTrue:[
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   279
                application class == (Smalltalk at: #'JDI::DebuggerApplication') ifTrue:[ ^ true ].
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   280
                application class == Tools::NewSystemBrowser ifTrue:[ ^ false ].
033e56844dc9 Fixes to for JDI debugger.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2971
diff changeset
   281
            ]
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   282
        ].
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   283
        process := process parentProcess.                    
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   284
    ].
3467
8906649c0be3 Fix in JavaSyntaxHighlighter: do not create (and cache) source document...
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3324
diff changeset
   285
    ^ false 
2718
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   286
b3fe904a2fc7 Use eclipse-based highlighter for both class and method highlighting.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2717
diff changeset
   287
    "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
   288
    "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
   289
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   290
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   291
!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
   292
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   293
initialize
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   294
    "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
   295
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   296
    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
   297
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   298
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   299
    "/ 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
   300
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   301
    "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
   302
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   303
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   304
!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
   305
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   306
index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   307
    ^ index
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   308
!
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   309
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   310
index:aParseTreeIndex
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   311
    index := aParseTreeIndex.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   312
    types := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   313
    fields := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   314
    locals := Dictionary new.
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   315
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   316
    "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
   317
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   318
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   319
!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
   320
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   321
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
   322
    | element |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   323
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   324
    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
   325
    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
   326
    ^ element
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
    "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
   329
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   330
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   331
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
   332
    | 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
   333
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   334
    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
   335
    binding := node binding.
2836
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   336
    binding notNil ifTrue:[
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   337
        fname := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   338
        previous := fields at: fname ifAbsent: nil.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   339
        previous notNil ifTrue:[
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   340
            previous next: element.
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   341
        ].
1c7b69664136 Fixes in JavaSourceHighlighter:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2808
diff changeset
   342
        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
   343
    ].
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   344
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   345
    "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
   346
    "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
   347
!
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
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
   350
    | element fname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   351
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   352
    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
   353
    fname := node name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   354
    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
   355
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   356
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   357
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   358
    locals at: fname put: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   359
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   360
    "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
   361
!
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
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
   364
    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
   365
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   366
    "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
   367
!
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
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
   370
    | element tname previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   371
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   372
    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
   373
    tname := node getTypeName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   374
    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
   375
    previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   376
        previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   377
    ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   378
    types at: tname put: element.
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
    "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
   381
!
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
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
   384
    | element binding name previous |
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   385
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   386
    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
   387
    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
   388
    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
   389
    "/ 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
   390
    binding problemId ~~ 0 ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   391
        name := binding name.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   392
        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
   393
        previous notNil ifTrue:[
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   394
            previous next: element.
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   395
        ].
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   396
        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
   397
        ^ self.              
d4914ffbb0cf Fix in JavaSourceHighlighter: save full tree in sourceIndex.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2781
diff changeset
   398
    ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   399
    (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
   400
        name := binding compoundName asStringWith: $/.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   401
        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
   402
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   403
            previous next: element.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   404
        ].
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   405
        types at: name put: element.   
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   406
        ^ self.
2775
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   407
    ].
ddc68c69915a Improvements for Java code navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2741
diff changeset
   408
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   409
    binding kind == 2r001 "FIELD" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   410
        binding declaringClass isNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   411
            name := '???.' , binding name
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   412
        ] ifFalse:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   413
            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
   414
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   415
        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
   416
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   417
            previous next: element.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   418
        ].
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   419
        fields at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   420
        ^ self.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   421
    ].
2735
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   422
2781
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   423
    binding kind == 2r010 "LOCAL" ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   424
        name := binding name.
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   425
        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
   426
        previous notNil ifTrue:[
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   427
            previous next: element.
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
        locals at: name put: element.  
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   430
        ^ self.   
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
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   433
    self error: 'Should not happen'
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
    "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
   436
    "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
   437
!
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
methodEnter: node
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   440
    locals := Dictionary new
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
    "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
   443
!
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   444
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   445
methodLeave: node
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   446
bdabb1cf8408 Some more fixes for semi-modal navigation.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2778
diff changeset
   447
    "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
   448
! !
e20dd8496371 Initial support for source code indexing (for semi-modal navigation)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2733
diff changeset
   449
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   450
!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
   451
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   452
initialize
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   453
    "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
   454
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   455
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   456
    !!!! IMPORTANT !!!!!!
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   457
    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
   458
    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
   459
    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
   460
    "
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   461
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   462
    self lookupObject: JavaLookup instance.
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   463
    
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   464
    MARK_KEYWORD        := 1.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   465
    MARK_NUMBER         := 2.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   466
    MARK_STRING         := 3.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   467
    MARK_CHARACTER      := 4.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   468
    MARK_COMMENT        := 5.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   469
    MARK_JAVADOC        := 6.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   470
    MARK_KEYWORD_FLOW   := 7.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   471
    MARK_SELECTOR       := 8.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   472
    MARK_FIELD          := 9.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   473
    MARK_FIELD_ASSIGNED := 10.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   474
    MARK_LOCAL          := 11.
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   475
    MARK_CLASS          := 12.
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   476
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   477
    "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
   478
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   479
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   480
!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
   481
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   482
highlighter:aJavaSourceHighlighter
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   483
    highlighter := aJavaSourceHighlighter.
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
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   486
!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
   487
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   488
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
   489
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   490
    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
   491
    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
   492
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   493
    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
   494
    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
   495
    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
   496
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   497
    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
   498
    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
   499
2726
6971720de5a4 More support for method's source only.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 2718
diff changeset
   500
    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
   501
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   502
    "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
   503
    "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
   504
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   505
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   506
!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
   507
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   508
version_CVS
3412
df11bb428463 Merged with mercurial revision 4f3cc813be4 (8 changesets total)
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3360
diff changeset
   509
    ^ '$Header: /cvs/stx/stx/libjava/tools/JavaSyntaxHighlighter.st,v 1.5 2015-03-20 13:29:52 vrany Exp $'
2678
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
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   512
version_HG
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
    ^ '$Changeset: <not expanded> $'
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   515
!
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
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
   518
    ^ 'Id'
2678
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   519
! !
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   520
c865275e48a7 Updated to match Mercurial revision a00302fe5083 with two tweaks:
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
diff changeset
   521
3126
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   522
JavaSyntaxHighlighter::Indexer initialize!
4eaeba9fa910 Java source highlughter refactoring.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 3103
diff changeset
   523
JavaSyntaxHighlighter::Marker initialize!