*** empty log message ***
authorclaus
Fri, 05 Aug 1994 04:48:18 +0200
changeset 23 1f7bcfff8d39
parent 22 753cf527f426
child 24 d35e8fe34455
*** empty log message ***
Parser.st
--- a/Parser.st	Fri Aug 05 04:12:48 1994 +0200
+++ b/Parser.st	Fri Aug 05 04:48:18 1994 +0200
@@ -36,6 +36,8 @@
 Parser comment:'
 COPYRIGHT (c) 1989 by Claus Gittinger
              All Rights Reserved
+
+$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.13 1994-08-05 02:48:18 claus Exp $
 '!
 
 !Parser class methodsFor:'documentation'!
@@ -56,7 +58,7 @@
 
 version
 "
-$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.12 1994-07-30 22:27:01 claus Exp $
+$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.13 1994-08-05 02:48:18 claus Exp $
 "
 !
 
@@ -1860,7 +1862,7 @@
 block
     "parse a block; return a node-tree, nil or #Error"
 
-    |stats node args argNames var vars pos lno b|
+    |node args argNames arg pos lno|
 
     lno := tokenLineNr.
     self nextToken.
@@ -1873,9 +1875,9 @@
                         position:pos to:tokenPosition-1.
                 ^ #Error
             ].
-            var := Variable name:tokenName.
+            arg := Variable name:tokenName.
             args isNil ifTrue:[
-                args := Array with:var.
+                args := Array with:arg.
                 argNames := Array with:tokenName.
             ] ifFalse:[
                 (argNames includes:tokenName) ifTrue:[
@@ -1883,7 +1885,7 @@
                             position:tokenPosition 
                                    to:(tokenPosition + tokenName size - 1)
                 ].
-                args := args copyWith:var.
+                args := args copyWith:arg.
                 argNames := argNames copyWith:tokenName.
             ].
             self nextToken
@@ -1891,15 +1893,28 @@
         (tokenType ~~ $| ) ifTrue:[
             "ST-80 allows [:arg ]"
             (tokenType == $] ) ifTrue:[
-                b := BlockNode arguments:args home:currentBlock variables:nil.
-                b lineNumber:lno.
-                ^ b
+                node := BlockNode arguments:args home:currentBlock variables:nil.
+                node lineNumber:lno.
+                ^ node
             ].
             self syntaxError:'| expected after block-arg declaration'.
             ^ #Error
         ].
         self nextToken
     ].
+    node := self blockBody:args.
+    (node notNil and:[node ~~ #Error]) ifTrue:[
+        node lineNumber:lno.
+    ].
+    ^ node
+!
+
+blockBody:args
+    "parse a blocks body; return a node-tree, nil or #Error"
+
+    |stats node var vars pos lno|
+
+    lno := tokenLineNr.
     (tokenType == $| ) ifTrue:[
         self nextToken.
         pos := tokenPosition.
@@ -2307,7 +2322,7 @@
 
 askForCorrection:aString fromList:aList
     "launch a selection box, which allows user to enter correction.
-     return true for yes, false for no"
+     return newString or nil (for abort)"
 
     |box|
 
@@ -2319,7 +2334,6 @@
     box initialText:(aList at:1).
     box list:aList.
     box okText:'correct'.
-    "box abortText:'abort'."
     box action:[:aString | ^ aString].
     box showAtPointer.
     ^ nil
@@ -2361,7 +2375,7 @@
      return #Error if there was no correction 
      or a ParseNode as returned by variable"
 
-    |correctIt suggestedNames newSelector l c|
+    |correctIt suggestedNames newSelector|
 
     "
      sorry, but I cannot handle keywords with more than one-part