Parser.st
branchjv
changeset 4028 8e7af453d137
parent 3998 0d185abc2cf0
parent 4015 527fa2959e31
child 4056 d75b18246677
equal deleted inserted replaced
4009:3a4d8bddd95d 4028:8e7af453d137
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 1989 by Claus Gittinger
     2  COPYRIGHT (c) 1989 by Claus Gittinger
     5               All Rights Reserved
     3               All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
  5385     moreSharedPools := aParser moreSharedPools.
  5383     moreSharedPools := aParser moreSharedPools.
  5386     doItTemporaries := aParser doItTemporaries.
  5384     doItTemporaries := aParser doItTemporaries.
  5387     selector := aParser selector.
  5385     selector := aParser selector.
  5388 ! !
  5386 ! !
  5389 
  5387 
       
  5388 
  5390 !Parser methodsFor:'obsolete'!
  5389 !Parser methodsFor:'obsolete'!
  5391 
  5390 
  5392 correctByDeleting
  5391 correctByDeleting
  5393     "correct (by deleting token) if user wants to;
  5392     "correct (by deleting token) if user wants to;
  5394      return #Error if there was no correction;
  5393      return #Error if there was no correction;
  5499 !
  5498 !
  5500 
  5499 
  5501 blockBody
  5500 blockBody
  5502     "parse a currentBlock's block-body; return a node-tree, nil or #Error"
  5501     "parse a currentBlock's block-body; return a node-tree, nil or #Error"
  5503 
  5502 
  5504     |prevFlags stats var vars lno pos2|
  5503     |prevFlags stats var vars lno pos2 barPos1|
  5505 
  5504 
  5506     lno := tokenLineNr.
  5505     lno := tokenLineNr.
  5507 
  5506 
  5508     ((tokenType == #BinaryOperator) and:[tokenName = '<']) ifTrue:[
  5507     ((tokenType == #BinaryOperator) and:[tokenName = '<']) ifTrue:[
  5509         prevFlags := parserFlags copy.
  5508         prevFlags := parserFlags copy.
  5510         self parsePrimitiveOrResourceSpecOrEmpty.
  5509         self parsePrimitiveOrResourceSpecOrEmpty.
  5511     ].
  5510     ].
  5512 
  5511 
  5513     (tokenType == $| ) ifTrue:[
  5512     (tokenType == $| ) ifTrue:[        
       
  5513         barPos1 := tokenPosition.
  5514         self nextToken.
  5514         self nextToken.
  5515         [tokenType == $|] whileFalse:[
  5515         [tokenType == $|] whileFalse:[
  5516             (tokenType == #Identifier) ifFalse:[
  5516             (tokenType == #Identifier) ifFalse:[
  5517                 ^ self identifierExpectedIn:'block-var declaration'
  5517                 ^ self identifierExpectedIn:'block-var declaration'
  5518             ].
  5518             ].
  5549                 (tokenType == $() ifTrue:[
  5549                 (tokenType == $() ifTrue:[
  5550                     self variableTypeDeclarationFor:var.
  5550                     self variableTypeDeclarationFor:var.
  5551                 ].
  5551                 ].
  5552             ].
  5552             ].
  5553         ].
  5553         ].
  5554         self nextToken
  5554         vars isEmptyOrNil ifTrue:[
       
  5555             parserFlags warnPossibleIncompatibilities == true ifTrue:[
       
  5556                 self
       
  5557                     warning:('empty local variable list (possible incompatibility)')
       
  5558                     doNotShowAgainAction:[ parserFlags warnPossibleIncompatibilities:false.
       
  5559                                            ParserFlags warnPossibleIncompatibilities:false]
       
  5560                     position:barPos1 to:source position.
       
  5561             ]    
       
  5562         ].    
       
  5563         self nextToken.
  5555     ].
  5564     ].
  5556     currentBlock variables:vars.
  5565     currentBlock variables:vars.
  5557 
  5566 
  5558     stats := self blockStatementList.
  5567     stats := self blockStatementList.
  5559     (stats == #Error) ifTrue:[^ #Error].
  5568     (stats == #Error) ifTrue:[^ #Error].
  6014             ].
  6023             ].
  6015             self syntaxError:msg position:tokenPosition to:pos2.
  6024             self syntaxError:msg position:tokenPosition to:pos2.
  6016             ^ #Error
  6025             ^ #Error
  6017         ].
  6026         ].
  6018         localVarDefPosition at:2 put:tokenPosition.
  6027         localVarDefPosition at:2 put:tokenPosition.
       
  6028         
       
  6029         methodVars isEmptyOrNil ifTrue:[
       
  6030             parserFlags warnPossibleIncompatibilities == true ifTrue:[
       
  6031                 self
       
  6032                     warning:('empty local variable list (possible incompatibility)')
       
  6033                     doNotShowAgainAction:[ parserFlags warnPossibleIncompatibilities:false.
       
  6034                                            ParserFlags warnPossibleIncompatibilities:false]
       
  6035                     position:(localVarDefPosition first) to:source position.
       
  6036             ]    
       
  6037         ].    
  6019         self nextToken
  6038         self nextToken
  6020     ].
  6039     ].
  6021 
  6040 
  6022     (parserFlags allowSqueakPrimitives
  6041     (parserFlags allowSqueakPrimitives
  6023     or:[ parserFlags allowSqueakExtensions
  6042     or:[ parserFlags allowSqueakExtensions