From bc49c6720e20a64dc8708e96df89b616c90e4ddf Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Thu, 19 Jun 2008 20:15:06 +0200 Subject: Fix the reader's token recognition code. --- MLKReader.m | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'MLKReader.m') 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 #import @@ -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 -- cgit v1.2.3