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