# HG changeset patch # User Stefan Vogel # Date 1078513416 -3600 # Node ID b844ef2acd37c9a47a56060a2e18823347c230eb # Parent a6b8a7a14f403a5a9ee5e82aa9fd2645140ddd71 Use #codePoint instead of deprecated #asciiValue diff -r a6b8a7a14f40 -r b844ef2acd37 Scanner.st --- a/Scanner.st Wed Mar 03 22:08:55 2004 +0100 +++ b/Scanner.st Fri Mar 05 20:03:36 2004 +0100 @@ -1,5 +1,3 @@ -"{ Encoding: utf8 }" - " COPYRIGHT (c) 1989 by Claus Gittinger All Rights Reserved @@ -154,47 +152,47 @@ "/ #(9 10 12 13 26 32) do: [:i | TypeArray at:(i+1) put: #separator]. block := [:s :char | s nextNumber]. - ($0 asciiValue) to:($9 asciiValue) do:[:index | + ($0 codePoint) to:($9 codePoint) do:[:index | ActionArray at:index put:block ]. block := [:s :char | s nextSpecial]. self binarySelectorCharacters do:[:binop | - TypeArray at:(binop asciiValue) put:#special. - ActionArray at:(binop asciiValue) put:block + TypeArray at:(binop codePoint) put:#special. + ActionArray at:(binop codePoint) put:block ]. "/ that one is a special case (both binarySelector AND syntax). - TypeArray at:($| asciiValue) put:nil. + TypeArray at:($| codePoint) put:nil. block := [:s :char | s nextToken:char]. #( $; $. $( $) $[ $] $^ $| $_ ${ $} ) do:[:ch | - ActionArray at:(ch asciiValue) put:block + ActionArray at:(ch codePoint) put:block ]. block := [:s :char | s nextIdentifier]. - ($a asciiValue) to:($z asciiValue) do:[:index | + ($a codePoint) to:($z codePoint) do:[:index | ActionArray at:index put:block ]. - ($A asciiValue) to:($Z asciiValue) do:[:index | + ($A codePoint) to:($Z codePoint) do:[:index | ActionArray at:index put:block ]. AllowUnderscoreInIdentifier ifTrue:[ - ActionArray at:$_ asciiValue put:block + ActionArray at:$_ codePoint put:block ]. "kludge: action is characterToken, but type is special" - TypeArray at:($| asciiValue) put:#special. + TypeArray at:($| codePoint) put:#special. "kludge: action is nextColonOrAssign, but type is special" - TypeArray at:($: asciiValue) put:#special. - - ActionArray at:($' asciiValue) put:[:s :char | s nextString]. - ActionArray at:($$ asciiValue) put:[:s :char | s nextCharacter]. - ActionArray at:($# asciiValue) put:[:s :char | s nextHash]. - ActionArray at:($!! asciiValue) put:[:s :char | s nextExcla]. - ActionArray at:($% asciiValue) put:[:s :char | s nextPrimitive]. - ActionArray at:($: asciiValue) put:[:s :char | s nextColonOrAssign] + TypeArray at:($: codePoint) put:#special. + + ActionArray at:($' codePoint) put:[:s :char | s nextString]. + ActionArray at:($$ codePoint) put:[:s :char | s nextCharacter]. + ActionArray at:($# codePoint) put:[:s :char | s nextHash]. + ActionArray at:($!! codePoint) put:[:s :char | s nextExcla]. + ActionArray at:($% codePoint) put:[:s :char | s nextPrimitive]. + ActionArray at:($: codePoint) put:[:s :char | s nextColonOrAssign] " Scanner setupActions @@ -1854,11 +1852,11 @@ ^ tokenType ]. - ((typeArray at:(nextChar asciiValue)) == #special) ifTrue:[ + ((typeArray at:(nextChar codePoint)) == #special) ifTrue:[ string := source next asString. nextChar := source peek. nextChar notNil ifTrue:[ - ((typeArray at:(nextChar asciiValue)) == #special) ifTrue:[ + ((typeArray at:(nextChar codePoint)) == #special) ifTrue:[ source next. string := string copyWith:nextChar ] @@ -2272,7 +2270,7 @@ ]. string := firstChar asString. secondChar notNil ifTrue:[ - ((typeArray at:(secondChar asciiValue)) == #special) ifTrue:[ + ((typeArray at:(secondChar codePoint)) == #special) ifTrue:[ (secondChar == $-) ifTrue:[ "special- look if minus belongs to number following" p := source position1Based. @@ -2294,7 +2292,7 @@ thirdChar := source peekOrNil. thirdChar notNil ifTrue:[ - ((typeArray at:(thirdChar asciiValue)) == #special) ifTrue:[ + ((typeArray at:(thirdChar codePoint)) == #special) ifTrue:[ (thirdChar == $-) ifTrue:[ "special- look if minus belongs to number following" p := source position1Based. @@ -2372,8 +2370,8 @@ ]. inString ifTrue:[ nextChar notNil ifTrue:[ - nextChar asciiValue > 255 ifTrue:[ - string bitsPerCharacter < nextChar asString bitsPerCharacter ifTrue:[ + nextChar codePoint > 255 ifTrue:[ + string bitsPerCharacter < nextChar bitsPerCharacter ifTrue:[ string := string asUnicodeString. ]. ]. @@ -2479,8 +2477,8 @@ tokenPosition := source position1Based. tokenLineNr := lineNr. - (v := ch asciiValue) == 0 ifTrue:[ - v := Character space asciiValue + (v := ch codePoint) == 0 ifTrue:[ + v := Character space codePoint ]. v <= 16rFF ifTrue:[ actionBlock := actionArray at:v. @@ -2686,7 +2684,7 @@ !Scanner class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.183 2004-03-03 21:08:55 cg Exp $' + ^ '$Header: /cvs/stx/stx/libcomp/Scanner.st,v 1.184 2004-03-05 19:03:36 stefan Exp $' ! ! Scanner initialize!