1// 2// ANTLRInputStream.m 3// ANTLR 4// 5// Created by Alan Condit on 2/21/11. 6// Copyright 2011 Alan's MachineWorks. All rights reserved. 7// 8 9#import <Foundation/Foundation.h> 10#import "ANTLRInputStream.h" 11 12 13@implementation ANTLRInputStream 14 15@synthesize encoding; 16 17+ (id) newANTLRInputStream 18{ 19 return [[ANTLRInputStream alloc] init]; 20} 21 22+ (id) newANTLRInputStream:(NSInputStream *)anInput 23{ 24 return [[ANTLRInputStream alloc] initWithInput:anInput size:ANTLRReaderStream.INITIAL_BUFFER_SIZE readBufferSize:ANTLRReaderStream.READ_BUFFER_SIZE encoding:NSASCIIStringEncoding]; 25} 26 27+ (id) newANTLRInputStream:(NSInputStream *)anInput size:(NSInteger)theSize 28{ 29 return [[ANTLRInputStream alloc] initWithInput:anInput size:theSize readBufferSize:ANTLRReaderStream.READ_BUFFER_SIZE encoding:NSASCIIStringEncoding]; 30} 31 32+ (id) newANTLRInputStream:(NSInputStream *)anInput encoding:(NSStringEncoding)theEncoding 33{ 34 return [[ANTLRInputStream alloc] initWithInput:anInput size:ANTLRReaderStream.INITIAL_BUFFER_SIZE readBufferSize:ANTLRReaderStream.READ_BUFFER_SIZE encoding:theEncoding]; 35} 36 37+ (id) newANTLRInputStream:(NSInputStream *)anInput 38 size:(NSInteger)theSize 39 readBufferSize:(NSInteger)theRBSize 40 encoding:(NSStringEncoding)theEncoding 41{ 42 return [[ANTLRInputStream alloc] initWithInput:anInput size:theSize readBufferSize:theRBSize encoding:theEncoding]; 43} 44 45- (id) init 46{ 47 self = [super init]; 48 return self; 49} 50 51- (id) initWithInput:(NSInputStream *)anInput 52 size:(NSInteger)theSize 53 readBufferSize:(NSInteger)theRBSize 54 encoding:(NSStringEncoding)theEncoding 55{ 56 self = [super initWithReader:anInput size:theSize readBufferSize:theRBSize]; 57 if ( self != nil ) { 58 //[self load:theSize readBufferSize:theRBSize]; // load called in super class 59 } 60 return self; 61} 62 63@end 64