Parser.st
changeset 1399 95b2eaa4e457
parent 1398 eaef898b063e
child 1400 20ccdab04698
equal deleted inserted replaced
1398:eaef898b063e 1399:95b2eaa4e457
    55 	poolDictionaries:''
    55 	poolDictionaries:''
    56 	privateIn:Parser
    56 	privateIn:Parser
    57 !
    57 !
    58 
    58 
    59 Notification subclass:#UndefinedVariableNotification
    59 Notification subclass:#UndefinedVariableNotification
    60 	instanceVariableNames:''
    60 	instanceVariableNames:'parser'
    61 	classVariableNames:''
    61 	classVariableNames:''
    62 	poolDictionaries:''
    62 	poolDictionaries:''
    63 	privateIn:Parser
    63 	privateIn:Parser
    64 !
    64 !
    65 
    65 
   244         Workspace
   244         Workspace
   245         SystemBrowser
   245         SystemBrowser
   246 
   246 
   247     [author:]
   247     [author:]
   248         Claus Gittinger
   248         Claus Gittinger
       
   249 "
       
   250 !
       
   251 
       
   252 examples
       
   253 "
       
   254                                                                         [exBegin]
       
   255     Parser 
       
   256         evaluate:'1+2*3' 
       
   257         in:nil 
       
   258         receiver:nil 
       
   259         notifying:nil 
       
   260         logged:false 
       
   261         ifFail:nil      
       
   262                                                                         [exEnd]
       
   263                                                                         [exBegin]
       
   264     Parser undefinedVariableNotification handle:[:ex |
       
   265         |badName|
       
   266 
       
   267         badName := ex variableName.
       
   268         ex proceedWith:(ConstantNode value:5).
       
   269     ] do:[
       
   270         ^ self compilerClass 
       
   271             evaluate:'foo * 3' 
       
   272             in:nil 
       
   273             receiver:nil 
       
   274             notifying:nil 
       
   275             logged:false 
       
   276             ifFail:nil 
       
   277     ]
       
   278                                                                         [exEnd]
   249 "
   279 "
   250 ! !
   280 ! !
   251 
   281 
   252 !Parser class methodsFor:'instance creation'!
   282 !Parser class methodsFor:'instance creation'!
   253 
   283 
  3170      corrected. If not corrected, only one warning is made per undefined
  3200      corrected. If not corrected, only one warning is made per undefined
  3171      variable."
  3201      variable."
  3172 
  3202 
  3173     |doCorrect msg idx boldName|
  3203     |doCorrect msg idx boldName|
  3174 
  3204 
       
  3205     doCorrect := UndefinedVariableNotification raiseRequestWith:aName.
       
  3206     doCorrect notNil ifTrue:[
       
  3207         ^ doCorrect
       
  3208     ].
       
  3209 
  3175     warnUndeclared ifFalse:[^ false].
  3210     warnUndeclared ifFalse:[^ false].
  3176     ignoreWarnings ifTrue:[^ false].
  3211     ignoreWarnings ifTrue:[^ false].
  3177 
  3212 
  3178     "
  3213     "
  3179      alredy warned about this one ?
  3214      alredy warned about this one ?
  3181     warnedUndefVars notNil ifTrue:[
  3216     warnedUndefVars notNil ifTrue:[
  3182         (warnedUndefVars includes:aName) ifTrue:[
  3217         (warnedUndefVars includes:aName) ifTrue:[
  3183             "already warned about this one"
  3218             "already warned about this one"
  3184             ^ false
  3219             ^ false
  3185         ].
  3220         ].
  3186     ].
       
  3187 
       
  3188     doCorrect := UndefinedVariableNotification raiseRequestWith:aName.
       
  3189     doCorrect notNil ifTrue:[
       
  3190         ^ doCorrect
       
  3191     ].
  3221     ].
  3192 
  3222 
  3193 "/    (classToCompileFor notNil 
  3223 "/    (classToCompileFor notNil 
  3194 "/    and:[classToCompileFor superclass notNil
  3224 "/    and:[classToCompileFor superclass notNil
  3195 "/    and:[classToCompileFor superclass instanceVariableString isNil]]) ifTrue:[
  3225 "/    and:[classToCompileFor superclass instanceVariableString isNil]]) ifTrue:[
  7144     "return the value of the instance variable 'startPosition' (automatically generated)"
  7174     "return the value of the instance variable 'startPosition' (automatically generated)"
  7145 
  7175 
  7146     ^ startPosition
  7176     ^ startPosition
  7147 ! !
  7177 ! !
  7148 
  7178 
       
  7179 !Parser::UndefinedVariableNotification methodsFor:'accessing'!
       
  7180 
       
  7181 parser
       
  7182     "return the value of the instance variable 'parser' (automatically generated)"
       
  7183 
       
  7184     ^ parser
       
  7185 !
       
  7186 
       
  7187 parser:something
       
  7188     "set the value of the instance variable 'parser' (automatically generated)"
       
  7189 
       
  7190     parser := something.
       
  7191 !
       
  7192 
       
  7193 variableName
       
  7194     ^ parameter
       
  7195 ! !
       
  7196 
  7149 !Parser class methodsFor:'documentation'!
  7197 !Parser class methodsFor:'documentation'!
  7150 
  7198 
  7151 version
  7199 version
  7152     ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.379 2003-04-21 14:39:40 cg Exp $'
  7200     ^ '$Header: /cvs/stx/stx/libcomp/Parser.st,v 1.380 2003-04-21 14:50:34 cg Exp $'
  7153 ! !
  7201 ! !
  7154 
  7202 
  7155 Parser initialize!
  7203 Parser initialize!