help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [PATCH] gst-doc adjustments for new syntax


From: Paolo Bonzini
Subject: [Help-smalltalk] [PATCH] gst-doc adjustments for new syntax
Date: Fri, 05 Oct 2007 21:13:20 +0200
User-agent: Thunderbird 2.0.0.6 (Macintosh/20070728)

Mostly regarding guessing comments like "Answer 'true'."

Paolo
* local directory is at address@hidden/smalltalk--devo--2.2--patch-580
* comparing to address@hidden/smalltalk--devo--2.2--patch-580
M  ./packages/stinst/doc/Publish.st
M  ./scripts/GenDoc.st

* modified files

--- orig/packages/stinst/doc/Publish.st
+++ mod/packages/stinst/doc/Publish.st
@@ -411,7 +411,7 @@ extractComment: source
 
     ^isCommented
        ifTrue: [ self reformatComment: comment ]
-       ifFalse: [ self guessComment: source ]
+       ifFalse: [ self guessComment: comment contents ]
 !
 
 guessComment: source
@@ -427,26 +427,31 @@ guessComment: source
        ifTrue: [ ^'This method''s functionality should be implemented by 
subclasses of ',
            self currentClass asClass printString ].
 
-    n := self skipWhite: 1 on: source.
-    n > source size ifTrue: [ ^'Answer the receiver.' ].
-
-    m := self skipToWhite: n on: source.
-    start := source copyFrom: n to: m - 1.
+    n := 1.
+    [
+        n := self skipWhite: n on: source.
+       (n > source size or: [ ']"' includes: (source at: n) ])
+            ifTrue: [ ^'Answer the receiver.' ].
 
-    m <= source size ifTrue: [
+        m := self skipToWhite: n on: source.
+        start := source copyFrom: n to: m - 1.
        n := self skipWhite: m on: source.
-       n <= source size ifTrue: [
-           (source at: n) = $" ifFalse: [
-               (source at: n) = $! ifFalse: [ ^'Not commented.' ]
-           ]
-       ]
-    ].
-    start = '^self'
-       ifTrue: [ ^'Answer the receiver.' ].
 
-    ^(start at: 1) = $^
-       ifTrue: [ 'Answer `', (start copyFrom: 2 to: start size), '''.' ]
-       ifFalse: [ 'Not commented' ]
+        (start notEmpty and: [ (start at: 1) = $^
+               and: [ n > source size
+                         or: [ ']"' includes: (source at: n) ]]]) ifTrue: [
+           start = '^self'
+               ifTrue: [ ^'Answer the receiver.' ].
+           ^'Answer `', (start copyFrom: 2 to: start size), '''.' ].
+
+       n <= source size ifTrue: [
+           (source at: n) = $<
+               ifTrue: [ n := source indexOf: $> startingAt: n ]
+               ifFalse: [
+                   (']"' includes: (source at: n))
+                       ifFalse: [ ^'Not commented.' ] ].
+           n := n + 1 ].
+    ] repeat
 ! !
 
 
@@ -1255,7 +1260,7 @@ emitSelectorAndMethod: association
         emitMethodSelector: association key;
        emitCrossReferences: comment;
        nextPutAll: '@item ';
-       nextPutAllText: (selAndBody at: 1);
+       nextPutAllText: ((selAndBody at: 1) copyWithout: Character nl);
        nl;
        nextPutAllText: comment;
        nl; nl


--- orig/scripts/GenDoc.st
+++ mod/scripts/GenDoc.st
@@ -81,7 +81,7 @@ Options:
                file := FileStream open: each mode: FileStream read.
                loader
                    parseSmalltalkStream: file
-                   with: STInST.STFileInParser ].
+                   with: STInST.GSTFileInParser ].
 
            loader currentNamespace: Smalltalk ].
 
@@ -89,7 +89,7 @@ Options:
            file := FileStream open: arg mode: FileStream read.
            loader
                parseSmalltalkStream: file
-               with: STInST.STFileInParser ].
+               with: STInST.GSTFileInParser ].
 
         opt isNil ifTrue: [ classPatterns add: arg ] ]
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]