9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 Object subclass:#Scanner |
13 Object subclass:#Scanner |
14 instanceVariableNames:'source collectedSource token tokenType tokenPosition tokenValue |
14 instanceVariableNames:'source collectedSource token tokenType tokenPosition tokenValue |
15 tokenName tokenLineNr tokenRadix hereChar peekChar peekChar2 |
15 tokenName tokenLineNr tokenRadix hereChar peekChar peekChar2 |
16 requestor exitBlock errorFlag ignoreErrors ignoreWarnings |
16 requestor exitBlock errorFlag ignoreErrors ignoreWarnings |
17 saveComments currentComments warnSTXSpecialComment |
17 saveComments currentComments warnSTXSpecialComment |
18 warnUnderscoreInIdentifier warnOldStyleAssignment outStream |
18 warnUnderscoreInIdentifier warnOldStyleAssignment outStream |
19 outCol' |
19 outCol' |
20 classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings |
20 classVariableNames:'TypeArray ActionArray AllowUnderscoreInIdentifier Warnings |
21 WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier' |
21 WarnSTXSpecials WarnOldStyleAssignment WarnUnderscoreInIdentifier' |
22 poolDictionaries:'' |
22 poolDictionaries:'' |
23 category:'System-Compiler' |
23 category:'System-Compiler' |
24 ! |
24 ! |
25 |
25 |
26 !Scanner class methodsFor:'documentation'! |
26 !Scanner class methodsFor:'documentation'! |
27 |
27 |
28 copyright |
28 copyright |
880 |
880 |
881 |firstChar secondChar thirdChar string p| |
881 |firstChar secondChar thirdChar string p| |
882 |
882 |
883 firstChar := source next. |
883 firstChar := source next. |
884 secondChar := source peek. |
884 secondChar := source peek. |
885 (firstChar == $-) ifTrue:[ |
885 ((firstChar == $-) and:[secondChar notNil]) ifTrue:[ |
886 secondChar isDigit ifTrue:[ |
886 secondChar isDigit ifTrue:[ |
887 self nextNumber. |
887 self nextNumber. |
888 tokenValue := tokenValue negated. |
888 tokenValue := tokenValue negated. |
889 ^ tokenType |
889 ^ tokenType |
890 ] |
890 ] |
891 ]. |
891 ]. |
892 string := firstChar asString. |
892 string := firstChar asString. |
893 secondChar notNil ifTrue:[ |
893 secondChar notNil ifTrue:[ |
894 ((TypeArray at:(secondChar asciiValue)) == #special) ifTrue:[ |
894 ((TypeArray at:(secondChar asciiValue)) == #special) ifTrue:[ |
895 (secondChar == $-) ifTrue:[ |
895 (secondChar == $-) ifTrue:[ |
896 "special- look if minus belongs to number following" |
896 "special- look if minus belongs to number following" |
897 p := source position. |
897 p := source position. |
898 source next. |
898 source next. |
899 thirdChar := source peek. |
899 thirdChar := source peek. |
900 source position:p. |
900 source position:p. |
901 thirdChar isDigit ifTrue:[ |
901 thirdChar isDigit ifTrue:[ |
902 tokenName := string. |
902 tokenName := string. |
903 tokenType := #BinaryOperator. |
903 tokenType := #BinaryOperator. |
904 ^ tokenType |
904 ^ tokenType |
905 ] |
905 ] |
906 ]. |
906 ]. |
907 source next. |
907 source next. |
908 string := string copyWith:secondChar |
908 string := string copyWith:secondChar |
909 ]. |
909 ]. |
910 ]. |
910 ]. |
911 tokenName := string. |
911 tokenName := string. |
912 tokenType := #BinaryOperator. |
912 tokenType := #BinaryOperator. |
913 ^ tokenType |
913 ^ tokenType |
|
914 |
|
915 "Modified: 12.4.1996 / 15:05:19 / cg" |
914 ! |
916 ! |
915 |
917 |
916 nextString |
918 nextString |
917 |nextChar string pos |
919 |nextChar string pos |
918 index "{ Class: SmallInteger }" |
920 index "{ Class: SmallInteger }" |