Character.st
changeset 2214 2c73e6907cbc
parent 2124 6238280f6120
child 2561 205ee33decf9
--- a/Character.st	Mon Jan 20 22:35:59 1997 +0100
+++ b/Character.st	Tue Jan 21 11:13:19 1997 +0100
@@ -131,6 +131,38 @@
     self error:'invalid ascii code for character'
 ! !
 
+!Character class methodsFor:'accessing untypeable characters'!
+
+endOfInput
+	"Answer the Character representing ctrl-d ."
+
+	^self value: 4
+!
+
+leftParenthesis
+	"Answer the Character representing a left parenthesis."
+
+	^self value: 40
+!
+
+period
+	"Answer the Character representing a carriage period."
+
+	^self value: 46
+!
+
+poundSign
+	"Answer the Character representing a pound sign."
+
+	^self value: 35
+!
+
+rightParenthesis
+	"Answer the Character representing a right parenthesis."
+
+	^self value: 41
+! !
+
 !Character class methodsFor:'constants'!
 
 backspace
@@ -276,6 +308,20 @@
     "catch instvar access - asciivalue may not be changed"
 
     self error:'Characters may not be modified'
+!
+
+newDigitValue
+	"Answer 0-9 if the receiver is $0-$9, 10-35 if it is $A-$Z, and < 0 otherwise. 
+	This is used to parse literal numbers of radix 2-36."
+
+	| code value |
+	code := self asInteger.
+	value := code - $0 asInteger.
+	value <= 9 ifTrue: [^value].
+	value := code - $A asInteger.
+	(value >= 0 and: [value < 26])
+		ifTrue: [^value + 10].
+	^-1
 ! !
 
 !Character methodsFor:'arithmetic'!
@@ -588,6 +634,11 @@
      ^ self
 !
 
+copyUpToLast: char 
+
+	^self
+!
+
 deepCopy
     "return a deep copy of myself
      reimplemented since characters are unique"
@@ -640,15 +691,17 @@
 !Character methodsFor:'national testing'!
 
 isNationalAlphaNumeric
-    "return true, if the receiver is a letter in the
+    "return true, if the receiver is a letter or digit in the
      current language (Language variable)"
 
     "stupid - should be configurable from a table ...
      ... good thing is, that iso8859 puts all national
-	 characters above 16rC0"
+         characters above 16rC0"
 
     self isLetterOrDigit ifTrue:[^ true].
-    ^ self asciiValue between:16rC0 and:16rFF
+    ^ self isNationalLetter
+
+    "Modified: 21.1.1997 / 11:10:54 / cg"
 !
 
 isNationalLetter
@@ -657,10 +710,17 @@
 
     "stupid - should be configurable from a table ...
      ... good thing is, that iso8859 puts all national
-	 characters above 16rC0"
+         characters above 16rC0"
+
+    |ascii|
 
     self isLetter ifTrue:[^ true].
-    ^ self asciiValue between:16rC0 and:16rFF
+    (asciivalue between:16rC0 and:16rD6) ifTrue:[^ true].
+    (asciivalue between:16rD8 and:16rF6) ifTrue:[^ true].
+    (asciivalue between:16rF8 and:16rFF) ifTrue:[^ true].
+    ^ false.
+
+    "Modified: 21.1.1997 / 11:13:02 / cg"
 ! !
 
 !Character methodsFor:'printing & storing'!
@@ -700,6 +760,13 @@
     ^ self asString
 !
 
+reconstructOn:aStream
+    aStream nextPut:$$; nextPut:self
+
+    "Created: 6.2.1996 / 09:46:12 / stefan"
+    "Modified: 6.2.1996 / 10:57:35 / stefan"
+!
+
 storeOn:aStream
     "store myself on aStream"
 
@@ -926,5 +993,5 @@
 !Character class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.40 1997-01-10 15:03:41 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Character.st,v 1.41 1997-01-21 10:13:19 cg Exp $'
 ! !