Scanner.st
changeset 4150 475f9690e560
parent 4148 4fc143114250
child 4157 b200307a167c
equal deleted inserted replaced
4149:acf5605cc099 4150:475f9690e560
  3290 
  3290 
  3291     prefix isEmpty ifTrue:[
  3291     prefix isEmpty ifTrue:[
  3292         nextChar isLetter ifFalse:[
  3292         nextChar isLetter ifFalse:[
  3293             ((nextChar == $_) and:[allowUnderscoreInIdentifier]) ifFalse:[
  3293             ((nextChar == $_) and:[allowUnderscoreInIdentifier]) ifFalse:[
  3294                 ((nextChar == $.) and:[allowPeriodInSymbol]) ifFalse:[
  3294                 ((nextChar == $.) and:[allowPeriodInSymbol]) ifFalse:[
  3295                     "/ just for the better error message
  3295                     (nextChar isDigit and:[parserFlags allowSymbolsStartingWithDigit]) ifFalse:[
  3296                     (nextChar isNationalAlphaNumeric) ifTrue:[
  3296                         "/ just for the better error message
  3297                         |errMsg|
  3297                         (nextChar isNationalAlphaNumeric) ifTrue:[
  3298 
  3298                             |errMsg|
  3299                         errMsg := 'Invalid character: ''' , nextChar asString , ''' ', '(' , (nextChar codePoint radixPrintStringRadix:16) , ').'.
  3299 
  3300                         errMsg := errMsg , '\\Notice:\  Only 7-bit ascii allowed (for compatibility with other Smalltalk dialects).' withCRs.
  3300                             errMsg := 'Invalid character: ''' , nextChar asString , ''' ', '(' , (nextChar codePoint radixPrintStringRadix:16) , ').'.
  3301                         errMsg := errMsg , '\  If you need symbols with 8-bit characters, use the #''...'' form, or ''...'' asSymbol.' withCRs.
  3301                             errMsg := errMsg , '\\Notice:\  Only 7-bit ascii allowed (for compatibility with other Smalltalk dialects).' withCRs.
  3302                         self syntaxError:errMsg position:tokenPosition to:source position+1.
  3302                             errMsg := errMsg , '\  If you need symbols with 8-bit characters, use the #''...'' form, or ''...'' asSymbol.' withCRs.
  3303                     ].    
  3303                             self syntaxError:errMsg position:tokenPosition to:source position+1.
  3304                     ^ nil
  3304                         ].    
       
  3305                         ^ nil
       
  3306                     ]
  3305                 ]
  3307                 ]
  3306             ]
  3308             ]
  3307         ].
  3309         ].
  3308     ].
  3310     ].
  3309 
  3311 
  3371         ].
  3373         ].
  3372     ].                   
  3374     ].                   
  3373     tokenValue := token := string asSymbol.
  3375     tokenValue := token := string asSymbol.
  3374     tokenType := #Symbol.
  3376     tokenType := #Symbol.
  3375     ^ tokenType
  3377     ^ tokenType
       
  3378 
       
  3379     "Modified (format): / 18-06-2017 / 16:31:56 / cg"
  3376 !
  3380 !
  3377 
  3381 
  3378 nextToken
  3382 nextToken
  3379     "return the next token from the source-stream"
  3383     "return the next token from the source-stream"
  3380 
  3384