@@ -29,90 +29,92 @@ Instance Variables
2929
3030"
3131Class {
32- #name : # PRAbstractAnnotation ,
33- #superclass : # PRDocumentGroup ,
32+ #name : ' PRAbstractAnnotation' ,
33+ #superclass : ' PRDocumentGroup' ,
3434 #traits : ' PRTParametrizable' ,
3535 #classTraits : ' PRTParametrizable classTrait' ,
3636 #instVars : [
3737 ' parameters' ,
3838 ' hadAllKeys' ,
3939 ' isValid'
4040 ],
41- #category : #' Pillar-Core-Model'
41+ #category : ' Pillar-Core-Model' ,
42+ #package : ' Pillar-Core' ,
43+ #tag : ' Model'
4244}
4345
44- { #category : # protected }
46+ { #category : ' protected' }
4547PRAbstractAnnotation class >> acceptName: aTag [
4648 ^ aTag asSymbol = self tag
4749]
4850
49- { #category : # constant }
51+ { #category : ' constant' }
5052PRAbstractAnnotation class >> closingAnnotationString [
5153 ^ ' }$'
5254
5355
5456]
5557
56- { #category : # accessing }
58+ { #category : ' accessing' }
5759PRAbstractAnnotation class >> defaultParameterName [
5860 " Each annotation can have some parameters. A parameter has a key and a value. We allow for each annotation to have 1 parameter without key inside the pillar document. I return the key of this parameter."
5961
6062 ^ self possibleParameters first
6163]
6264
63- { #category : # protected }
65+ { #category : ' protected' }
6466PRAbstractAnnotation class >> findClassAcceptingTag: aTag ifNone: aBlock [
6567 ^ self withAllConcreteClasses
6668 detect: [ :class | class acceptName: aTag ]
6769 ifNone: aBlock
6870]
6971
70- { #category : # accessing }
72+ { #category : ' accessing' }
7173PRAbstractAnnotation class >> hasParameters [
7274 " Subclasses should override this method when they do not require parameters."
7375 ^ true
7476]
7577
76- { #category : # testing }
78+ { #category : ' testing' }
7779PRAbstractAnnotation class >> isAbstract [
7880 ^ self = PRAbstractAnnotation
7981]
8082
81- { #category : # constant }
83+ { #category : ' constant' }
8284PRAbstractAnnotation class >> keyValueSeparator [
8385 ^ $=
8486
8587
8688]
8789
88- { #category : # constant }
90+ { #category : ' constant' }
8991PRAbstractAnnotation class >> markupParameterSeparator [
9092 ^ $:
9193]
9294
93- { #category : # constant }
95+ { #category : ' constant' }
9496PRAbstractAnnotation class >> openingAnnotationString [
9597 ^ ' ${'
9698
9799
98100]
99101
100- { #category : # constant }
102+ { #category : ' constant' }
101103PRAbstractAnnotation class >> parameterSeparator [
102104 ^ $|
103105]
104106
105- { #category : # accessing }
107+ { #category : ' accessing' }
106108PRAbstractAnnotation class >> possibleParameters [
107109 ^ #( value )
108110]
109111
110- { #category : # protected }
112+ { #category : ' protected' }
111113PRAbstractAnnotation class >> tag [
112114 ^ self possibleParameters first
113115]
114116
115- { #category : # protected }
117+ { #category : ' protected' }
116118PRAbstractAnnotation class >> validateParameters: parameters [
117119 | usedKeys |
118120 usedKeys := parameters keys.
@@ -126,7 +128,7 @@ PRAbstractAnnotation class >> validateParameters: parameters [
126128 self hasParameters not and : [ usedKeys ifNotEmpty: [ PRSyntaxError signal : ' The annotation ' , self tag , ' does not expect parameter' ] ]
127129]
128130
129- { #category : # protected }
131+ { #category : ' protected' }
130132PRAbstractAnnotation class >> validateParameters: aPRParameters dictionary: parametersDictionary in: anAnnotation [
131133 | usedKeys |
132134 usedKeys := parametersDictionary keys.
@@ -137,21 +139,21 @@ PRAbstractAnnotation class >> validateParameters: aPRParameters dictionary: para
137139 self hasParameters not and : [ usedKeys ifNotEmpty: [ PRValidation strategy unexpectedParameterIn: anAnnotation ] ]
138140]
139141
140- { #category : # comparing }
142+ { #category : ' comparing' }
141143PRAbstractAnnotation >> = anObject [
142144 ^ super = anObject and : [
143145 self parameters = anObject parameters and : [
144146 self hadAllKeys = anObject hadAllKeys and : [
145147 self isValid = anObject isValid ] ] ]
146148]
147149
148- { #category : # visiting }
150+ { #category : ' visiting' }
149151PRAbstractAnnotation >> accept: aVisitor [
150152
151153 ^ aVisitor visitAnnotation: self
152154]
153155
154- { #category : # rendering }
156+ { #category : ' rendering' }
155157PRAbstractAnnotation >> asPillar [
156158 " Return a representation similar to the one used to create the annotation the assumption here is that the parameter dictionary only hold strings."
157159
@@ -166,7 +168,7 @@ PRAbstractAnnotation >> asPillar [
166168 s nextPutAll: self closingAnnotationString ]
167169]
168170
169- { #category : # rendering }
171+ { #category : ' rendering' }
170172PRAbstractAnnotation >> asPillarKey: key value: aValue on: aStream [
171173 " Output on aStream key = aValue."
172174
@@ -176,7 +178,7 @@ PRAbstractAnnotation >> asPillarKey: key value: aValue on: aStream [
176178 nextPutAll: aValue
177179]
178180
179- { #category : # rendering }
181+ { #category : ' rendering' }
180182PRAbstractAnnotation >> asPillarParametersOn: aStream [
181183 | nonDefaultParameters |
182184 nonDefaultParameters := self parameters keys asOrderedCollection.
@@ -194,98 +196,98 @@ PRAbstractAnnotation >> asPillarParametersOn: aStream [
194196 separatedBy: [ aStream nextPut: self parameterSeparator ]
195197]
196198
197- { #category : # initialization }
199+ { #category : ' initialization' }
198200PRAbstractAnnotation >> beInvalid [
199201 isValid := false .
200202]
201203
202- { #category : # rendering }
204+ { #category : ' rendering' }
203205PRAbstractAnnotation >> closingAnnotationString [
204206 ^ self class closingAnnotationString
205207]
206208
207- { #category : # rendering }
209+ { #category : ' rendering' }
208210PRAbstractAnnotation >> defaultParameterName [
209211
210212 ^ self class defaultParameterName
211213
212214]
213215
214- { #category : # accessing }
216+ { #category : ' accessing' }
215217PRAbstractAnnotation >> hadAllKeys [
216218 ^ hadAllKeys ifNil: [ hadAllKeys := true ]
217219]
218220
219- { #category : # accessing }
221+ { #category : ' accessing' }
220222PRAbstractAnnotation >> hadAllKeys: anObject [
221223 hadAllKeys := anObject
222224]
223225
224- { #category : # comparing }
226+ { #category : ' comparing' }
225227PRAbstractAnnotation >> hash [
226228 ^ ((super hash
227229 bitXor: self parameters hash)
228230 bitXor: self hadAllKeys hash)
229231 bitXor: self isValid hash
230232]
231233
232- { #category : # initialization }
234+ { #category : ' initialization' }
233235PRAbstractAnnotation >> initialize [
234236 super initialize.
235237 parameters := OrderedDictionary new .
236238 isValid := true .
237239]
238240
239- { #category : # testing }
241+ { #category : ' testing' }
240242PRAbstractAnnotation >> isValid [
241243 ^ isValid
242244]
243245
244- { #category : # rendering }
246+ { #category : ' rendering' }
245247PRAbstractAnnotation >> keyValueSeparator [
246248
247249 ^ self class keyValueSeparator
248250]
249251
250- { #category : # rendering }
252+ { #category : ' rendering' }
251253PRAbstractAnnotation >> markupParameterSeparator [
252254 ^ self class markupParameterSeparator
253255]
254256
255- { #category : # rendering }
257+ { #category : ' rendering' }
256258PRAbstractAnnotation >> openingAnnotationString [
257259 ^ self class openingAnnotationString
258260]
259261
260- { #category : # rendering }
262+ { #category : ' rendering' }
261263PRAbstractAnnotation >> parameterSeparator [
262264
263265 ^ self class parameterSeparator
264266]
265267
266- { #category : # accessing }
268+ { #category : ' accessing' }
267269PRAbstractAnnotation >> parameters [
268270 ^ parameters
269271]
270272
271- { #category : # accessing }
273+ { #category : ' accessing' }
272274PRAbstractAnnotation >> parameters: aCollection [
273275 parameters := aCollection
274276]
275277
276- { #category : # accessing }
278+ { #category : ' accessing' }
277279PRAbstractAnnotation >> possibleParameters [
278280 ^ self class possibleParameters
279281]
280282
281- { #category : # copying }
283+ { #category : ' copying' }
282284PRAbstractAnnotation >> postCopy [
283285 super postCopy.
284286 parameters := parameters copy.
285287 hadAllKeys := hadAllKeys copy
286288]
287289
288- { #category : # rendering }
290+ { #category : ' rendering' }
289291PRAbstractAnnotation >> tag [
290292 ^ self class tag
291293]
0 commit comments