help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-smalltalk] [PATCH] TokenStream dies


From: Paolo Bonzini
Subject: [Help-smalltalk] [PATCH] TokenStream dies
Date: Wed, 23 May 2007 17:38:13 +0200
User-agent: Thunderbird 2.0.0.0 (Macintosh/20070326)

Not anymore needed, we have the ANSI method #subStrings.

(Daniele, you don't have to pass it through the converter either).

Paolo
2007-05-23  Paolo Bonzini  <address@hidden>

        * kernel/Class.st: Don't use TokenStream.
        * kernel/Metaclass.st: Don't use TokenStream.
        * kernel/TokenStream.st: Move it...
        * examples/TokenStream.st: ... here.

        * compiler/STLoaderObjs.st: Don't use TokenStream.

        * libgst/lib.c: Remove TokenStream.st.  Fix pasto.
        * libgst/dict.c: Remove TokenStream and _gst_token_stream_class.
        * libgst/dict.h: Remove _gst_token_stream_class.


--- orig/compiler/STLoaderObjs.st
+++ mod/compiler/STLoaderObjs.st
@@ -701,7 +701,7 @@ instVarNames
 !
 
 instanceVariableNames: ivn
-    instVars := (TokenStream on: ivn) contents.
+    instVars := ivn subStrings.
 !
 
 superclass
@@ -990,9 +990,9 @@ superclass: sup name: s instanceVariable
     shape := sh.
     environment := loader currentNamespace.
     class := LoadedMetaclass new for: self.
-    instVars := (TokenStream on: ivn) contents.
-    classVars := (TokenStream on: cvn) contents.
-    sharedPools := (TokenStream on: pd) contents.
+    instVars := ivn subStrings.
+    classVars := cvn subStrings.
+    sharedPools := pd subStrings.
     superclass addSubclass: self.
     environment at: name put: self.
 ! !


--- orig/examples/README
+++ mod/examples/README
@@ -99,6 +99,8 @@ William Lount which fields are more impo
 Tokenizer.st   An abstract base class for lexical analyzers.
 by me/sbb
 
+TokenStream.st  Formerly a part of the class hierarchy.  Now replaced with
+by sbb          CharacterArray>>#subStrings.
 
 The `modules' directory contains some of the simplest packages that one could
 write for GNU Smalltalk, but nevertheless useful and interesting...  currently


--- orig/kernel/TokenStream.st
+++ mod/examples/TokenStream.st
@@ -8,7 +8,7 @@
 
 "======================================================================
 |
-| Copyright 1988,92,94,95,99,2000,2001
+| Copyright 1988,92,94,95,99,2000,2001,2007
 | Free Software Foundation, Inc.
 | Written by Steve Byrne.
 |
@@ -40,8 +40,7 @@ Stream subclass: #TokenStream
 !
 
 TokenStream comment:
-'I am not a typical part of the Smalltalk kernel class hierarchy.
-I operate on a stream of characters and return distinct whitespace-delimited
+'I operate on a stream of characters and return distinct whitespace-delimited
 groups of characters; I am used to parse the parameters of class-creation
 methods.
 


--- orig/kernel/ClassDesc.st
+++ mod/kernel/ClassDesc.st
@@ -450,9 +450,8 @@ parseInstanceVariableString: variableStr
 !
 
 parseVariableString: aString
-    | stream tokens |
-    stream := TokenStream on: aString.
-    tokens := stream contents.
+    | tokens |
+    tokens := aString subStrings asArray.
     tokens do: [ :token | self validateIdentifier: token ].
     ^tokens
 ! !


--- orig/kernel/Metaclass.st
+++ mod/kernel/Metaclass.st
@@ -445,9 +445,8 @@ initMetaclass: superclass
 !
 
 parsePools: aString in: aNamespace
-    | stream tokens |
-    stream := TokenStream on: aString.
-    tokens := stream contents.
+    | tokens |
+    tokens := aString subStrings asArray.
     ^tokens collect: [ :poolName |
        (poolName substrings: $.) inject: aNamespace into: [ :namespace :key |
            self validateIdentifier: key.


--- orig/libgst/dict.c
+++ mod/libgst/dict.c
@@ -162,7 +162,6 @@ OOP _gst_sym_link_class = NULL;
 OOP _gst_symbol_class = NULL;
 OOP _gst_system_dictionary_class = NULL;
 OOP _gst_time_class = NULL;
-OOP _gst_token_stream_class = NULL;
 OOP _gst_true_class = NULL;
 OOP _gst_undefined_object_class = NULL;
 OOP _gst_unicode_character_class = NULL;
@@ -589,10 +588,6 @@ static const class_definition class_info
    ISP_FIXED, false, 0,
    "Stream", NULL, NULL, NULL },
 
-  {&_gst_token_stream_class, &_gst_stream_class,
-   ISP_FIXED, false, 1,
-   "TokenStream", "charStream", NULL, NULL },
-
   {&_gst_positionable_stream_class, &_gst_stream_class,
    ISP_FIXED, false, 4,
    "PositionableStream", "collection ptr endPtr access", NULL, NULL },


--- orig/libgst/lib.c
+++ mod/libgst/lib.c
@@ -360,7 +360,6 @@ static const char standard_files[] = {
   "WriteStream.st\0"
   "RWStream.st\0"
   "ByteStream.st\0"
-  "TokenStream.st\0"
   "UndefObject.st\0"
   "ProcSched.st\0"
   "Delay.st\0"
@@ -734,7 +733,7 @@ load_standard_files (void)
       char *fullFileName = find_kernel_file (fileName, "", KERNEL_USER_DIR);
       if (!fullFileName)
        {
-         _gst_errorf ("can't find system file '%s'", fullFileName);
+         _gst_errorf ("can't find system file '%s'", fileName);
          _gst_errorf ("image bootstrap failed, use option --kernel-directory");
          return 1;
        }


--- orig/packages.xml.in
+++ mod/packages.xml.in
@@ -624,6 +624,7 @@
 <disabled-package>
   <name>Examples</name>
   <directory>examples</directory>
+  <file>TokenStream.st</file>
   <file>LazyCollection.st</file>
   <file>Man.st</file>
   <file>Tetris.st</file>
@@ -719,7 +720,6 @@
   <file>FileStream.st</file>
   <file>Security.st</file>
   <file>OrderColl.st</file>
-  <file>TokenStream.st</file>
   <file>CFuncs.st</file>
   <file>Float.st</file>
   <file>PkgLoader.st</file>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]