summaryrefslogtreecommitdiff
path: root/MLKReader.m
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <matthias@benkard.de>2008-06-19 20:15:06 +0200
committerMatthias Andreas Benkard <matthias@benkard.de>2008-06-19 20:15:06 +0200
commitbc49c6720e20a64dc8708e96df89b616c90e4ddf (patch)
tree843f6bcabd3275fef35dd629fdda8a91ef0bec8f /MLKReader.m
parent8337945090fe3fd0e142fda4dd98bb3fca23fbf5 (diff)
Fix the reader's token recognition code.
Diffstat (limited to 'MLKReader.m')
-rw-r--r--MLKReader.m17
1 files changed, 15 insertions, 2 deletions
diff --git a/MLKReader.m b/MLKReader.m
index 2341d32..779ffdd 100644
--- a/MLKReader.m
+++ b/MLKReader.m
@@ -29,6 +29,7 @@
#import "MLKFloat.h"
#import "MLKInteger.h"
#import "MLKRatio.h"
+#import "MLKStringInputStream.h"
#import <Foundation/NSArray.h>
#import <Foundation/NSRange.h>
@@ -106,13 +107,14 @@
if ([readtable isConstituentCharacter:ch])
{
+ //NSLog (@"--> Constituent");
token = [NSMutableString stringWithCapacity:8];
- [token appendFormat:@"%C", [readtable charWithReadtableCase:
- [stream readChar]]];
+ [token appendFormat:@"%C", [readtable charWithReadtableCase:ch]];
}
while (![stream isEOF])
{
+ //NSLog (@"...");
ch = [stream readChar];
if ([readtable isConstituentCharacter:ch] ||
[readtable isNonTerminatingMacroCharacter:ch] ||
@@ -150,6 +152,7 @@
}
}
+ //NSLog (@"--> Interpret token: %@", token);
return [self interpretToken:token readtable:readtable];
}
@@ -450,4 +453,14 @@
return symbol;
}
}
+
++(id) readFromString:(NSString *)string
+{
+ return [self readFromStream:[[MLKStringInputStream alloc]
+ initWithString:string]
+ eofError:YES
+ eofValue:nil
+ recursive:NO
+ preserveWhitespace:NO];
+}
@end