PetitCommonMark/software/PetitMarkdown/PPCMText.class.st

56 lines
884 B
Smalltalk

Class {
#name : 'PPCMText',
#superclass : 'PPCMNode',
#instVars : [
'text'
],
#category : 'PetitMarkdown-AST'
}
{ #category : 'as yet unclassified' }
PPCMText class >> empty [
^ self new
text: '';
yourself
]
{ #category : 'comparing' }
PPCMText >> = anObject [
^ text = anObject
]
{ #category : 'visiting' }
PPCMText >> accept: visitor [
^ visitor visitText: self
]
{ #category : 'converting' }
PPCMText >> asString [
^ text
]
{ #category : 'comparing' }
PPCMText >> hash [
^ text hash
]
{ #category : 'printing' }
PPCMText >> printOn: aStream [
super printOn: aStream.
aStream nextPut: $(.
aStream nextPut: $'.
text isNil ifFalse: [ aStream nextPutAll: text ].
aStream nextPut: $'.
aStream nextPut: $).
]
{ #category : 'accessing' }
PPCMText >> text [
^ text ifNil: [ '' ]
]
{ #category : 'accessing' }
PPCMText >> text: anObject [
text := anObject
]