66 lines
1.8 KiB
Smalltalk
66 lines
1.8 KiB
Smalltalk
Class {
|
|
#name : #GrafoscopioPillarTextAnnotator,
|
|
#superclass : #PRVisitor,
|
|
#instVars : [
|
|
'texts',
|
|
'formatter',
|
|
'lastStop'
|
|
],
|
|
#category : #'Grafoscopio-Pillar'
|
|
}
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> formatter: aFormatter [
|
|
formatter := aFormatter
|
|
]
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> initialize [
|
|
super initialize.
|
|
texts := OrderedCollection new.
|
|
formatter := GrafoscopioTextFormatter default.
|
|
]
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> visitCodeblock: aTextObject [
|
|
self visitText: aTextObject
|
|
]
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> visitCommentedLine: aTextObject [
|
|
self visitText: aTextObject
|
|
]
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> visitDocument: aDoc [
|
|
lastStop := 1 .
|
|
aDoc accept: formatter.
|
|
super visitDocument: aDoc.
|
|
|
|
]
|
|
|
|
{ #category : #'as yet unclassified' }
|
|
GrafoscopioPillarTextAnnotator >> visitFormatText: aGrafoscopioFormatTextNode [
|
|
" for the annotator, a format text is a much as regular text"
|
|
self visitText: aGrafoscopioFormatTextNode
|
|
]
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> visitLineBreak: anObject [
|
|
^ self visitText: anObject
|
|
]
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> visitRaw: aTextObject [
|
|
self visitText: aTextObject
|
|
]
|
|
|
|
{ #category : #'visiting-document' }
|
|
GrafoscopioPillarTextAnnotator >> visitText: aTextObject [
|
|
texts ifNotEmpty: [ texts last next: aTextObject ].
|
|
texts add: aTextObject.
|
|
aTextObject propertyAt: #textStart put: lastStop.
|
|
lastStop := lastStop + aTextObject text size.
|
|
aTextObject propertyAt: #textStop put: lastStop .
|
|
]
|