--- a/tools/JavaSourceHighlighter.st Sat Sep 28 01:49:52 2013 +0100
+++ b/tools/JavaSourceHighlighter.st Tue Oct 01 14:17:13 2013 +0100
@@ -775,27 +775,119 @@
!JavaSourceHighlighter::Indexer methodsFor:'indexing'!
-index: node from: start to: stop
+add: node from: start to: stop
+ | element |
+
+ index add: (element := index newElementFor: node).
+ element start: start + 1; stop: stop + 1.
+ ^ element
+
+ "Created: / 01-10-2013 / 10:30:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addFieldDeclaration: node from: start to: stop
+ | element binding fname previous |
- | e |
+ element := self add: node from: start to: stop.
+ binding := node binding.
+ fname := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
+ previous := fields at: fname ifAbsent: nil.
+ previous notNil ifTrue:[
+ previous next: element.
+ ].
+ fields at: fname put: element.
- index add: (e := index newElementFor: node).
+ "Created: / 01-10-2013 / 10:33:17 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addLocalDeclaration: node from: start to: stop
+ | element fname previous |
+
+ element := self add: node from: start to: stop.
+ fname := node name.
+ previous := locals at: fname ifAbsent: nil.
+ previous notNil ifTrue:[
+ previous next: element.
+ ].
+ locals at: fname put: element.
- (node isKindOf: JAVA org eclipse jdt internal compiler ast SingleTypeReference theClass) ifTrue:[
- | prev |
- prev := types at: node token ifAbsent:[nil].
- prev notNil ifTrue:[
- prev next: e.
+ "Created: / 01-10-2013 / 11:44:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addMessageSend: node from: start to: stop
+ self add: node from: start to: stop
+
+ "Created: / 01-10-2013 / 10:30:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addTypeReference: node from: start to: stop
+ | element tname previous |
+
+ element := self add: node from: start to: stop.
+ tname := node getTypeName asStringWith: $/.
+ previous := types at: tname ifAbsent: nil.
+ previous notNil ifTrue:[
+ previous next: element.
+ ].
+ types at: tname put: element.
+
+ "Created: / 01-10-2013 / 10:33:41 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+addVariableReference: node from: start to: stop
+ | element binding name previous |
+
+ element := self add: node from: start to: stop.
+ binding := node binding.
+ (binding kind bitAnd: 2r100) == 2r100 "TYPE" ifTrue:[
+ name := binding compoundName asStringWith: $/.
+ previous := types at: name ifAbsent: nil.
+ previous notNil ifTrue:[
+ previous next: element.
].
- types at: node token put: e.
+ types at: name put: element.
+ ^ self.
].
- (node isKindOf: JAVA org eclipse jdt internal compiler ast MessageSend theClass) ifTrue:[
- e start: start + 1; stop: stop + 1.
- ]
+ binding kind == 2r001 "FIELD" ifTrue:[
+ binding declaringClass isNil ifTrue:[
+ name := '???.' , binding name
+ ] ifFalse:[
+ name := (binding declaringClass compoundName asStringWith:$/) , '.' , binding name.
+ ].
+ previous := fields at: name ifAbsent: nil.
+ previous notNil ifTrue:[
+ previous next: element.
+ ].
+ fields at: name put: element.
+ ^ self.
+ ].
- "Created: / 17-09-2013 / 01:08:12 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 24-09-2013 / 03:02:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ binding kind == 2r010 "LOCAL" ifTrue:[
+ name := binding name.
+ previous := locals at: name ifAbsent: nil.
+ previous notNil ifTrue:[
+ previous next: element.
+ ].
+ locals at: name put: element.
+ ^ self.
+ ].
+
+ self error: 'Should not happen'
+
+ "Created: / 01-10-2013 / 10:33:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 01-10-2013 / 11:46:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+methodEnter: node
+ locals := Dictionary new
+
+ "Created: / 01-10-2013 / 10:44:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+methodLeave: node
+
+ "Created: / 01-10-2013 / 10:44:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!JavaSourceHighlighter::Marker class methodsFor:'initialization'!