350 "return the methods comment. |
350 "return the methods comment. |
351 This is done by searching for and returning the first comment |
351 This is done by searching for and returning the first comment |
352 from the methods source (excluding any double-quotes). |
352 from the methods source (excluding any double-quotes). |
353 Returns nil if there is no comment (or source is not available)." |
353 Returns nil if there is no comment (or source is not available)." |
354 |
354 |
355 |src comment comments parser| |
355 |src| |
356 |
356 |
357 src := self source. |
357 src := self source. |
358 src isNil ifTrue:[^ nil]. |
358 src isNil ifTrue:[^ nil]. |
359 |
359 ^ self programmingLanguage parserClass methodCommentFromSource:src |
360 parser := Parser for:src in:nil. |
360 |
361 parser ignoreErrors:true; ignoreWarnings:true; saveComments:true. |
361 " |
362 parser parseMethodSpec. |
362 (Method compiledMethodAt:#comment) comment |
363 |
|
364 comments := parser comments. |
|
365 comments size ~~ 0 ifTrue:[ |
|
366 comment := comments first asString. |
|
367 (comment withoutSpaces endsWith:'}') ifTrue:[ |
|
368 "if first comment is a pragma, take next comment" |
|
369 comment := comments at:2 ifAbsent:nil. |
|
370 comment notNil ifTrue:[ |
|
371 comment := comment string. |
|
372 ]. |
|
373 ]. |
|
374 ]. |
|
375 ^ comment. |
|
376 |
|
377 " |
|
378 (Method compiledMethodAt:#comment) comment |
|
379 (Object class compiledMethodAt:#infoPrinting:) comment |
363 (Object class compiledMethodAt:#infoPrinting:) comment |
380 " |
364 " |
381 |
365 |
382 "Modified: / 17.2.1998 / 14:50:00 / cg" |
366 "Modified: / 23-02-1998 / 10:26:08 / stefan" |
383 "Modified: / 23.2.1998 / 10:26:08 / stefan" |
367 "Modified: / 17-07-2010 / 14:23:56 / cg" |
384 ! |
368 ! |
385 |
369 |
386 getPackage |
370 getPackage |
387 "return the package-ID of the method" |
371 "return the package-ID of the method" |
388 |
372 |