ANTLRUnbufferedTokenStream.h revision 324c4644fee44b9898524c09511bd33c3f12e2df
19a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// 29a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// ANTLRUnbufferedTokenStream.h 39a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// ANTLR 49a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// 59a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Created by Alan Condit on 7/12/10. 69a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// [The "BSD licence"] 79a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Copyright (c) 2010 Alan Condit 89a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// All rights reserved. 99a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// 109a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// Redistribution and use in source and binary forms, with or without 119a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// modification, are permitted provided that the following conditions 129a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// are met: 13e5abc854f3dc47de16067c2a41476c39b7626722henrik.lundin@webrtc.org// 1. Redistributions of source code must retain the above copyright 149a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// notice, this list of conditions and the following disclaimer. 159a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// 2. Redistributions in binary form must reproduce the above copyright 169a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// notice, this list of conditions and the following disclaimer in the 179a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// documentation and/or other materials provided with the distribution. 189a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// 3. The name of the author may not be used to endorse or promote products 199a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// derived from this software without specific prior written permission. 209a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// 219a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 229a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 239a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 249a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 259a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 269a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 27045e45efeca8776975254550137ec65268aadb54turaj@webrtc.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 289a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 299a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 309a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org// THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 319a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 329a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#import <Cocoa/Cocoa.h> 339a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#import "ANTLRRuntimeException.h" 349a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#import "ANTLRTokenSource.h" 359a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org#import "ANTLRLookaheadStream.h" 360e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org#import "ANTLRToken.h" 370e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org 389a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org@interface ANTLRUnbufferedTokenStream : ANTLRLookaheadStream { 399a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org id<ANTLRTokenSource> tokenSource; 409a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org NSInteger tokenIndex; // simple counter to set token index in tokens 410e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org NSInteger channel; 420e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org} 430e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org 440e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org@property (retain, getter=getTokenSource, setter=setTokenSource:) id<ANTLRTokenSource> tokenSource; 450e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org@property (getter=getTokenIndex, setter=setTokenIndex) NSInteger tokenIndex; 460e2cb2989ce31ddd9069045a86ef4a9a781dddd3henrik.lundin@webrtc.org@property (getter=getChannel, setter=setChannel:) NSInteger channel; 47d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org 48d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org+ (ANTLRUnbufferedTokenStream *)newANTLRUnbufferedTokenStream:(id<ANTLRTokenSource>)aTokenSource; 49d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (id) init; 50d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (id) initWithTokenSource:(id<ANTLRTokenSource>)aTokenSource; 51d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org 52d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (id<ANTLRToken>)nextElement; 53d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (BOOL)isEOF:(id<ANTLRToken>) aToken; 54d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (id<ANTLRTokenSource>)getTokenSource; 55d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (NSString *)toStringFromStart:(NSInteger)aStart ToEnd:(NSInteger)aStop; 56d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (NSString *)toStringFromToken:(id<ANTLRToken>)aStart ToEnd:(id<ANTLRToken>)aStop; 57d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (NSInteger)LA:(NSInteger)anIdx; 58d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (id<ANTLRToken>)objectAtIndex:(NSInteger)anIdx; 59d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org- (NSString *)getSourceName; 60d60fc6a759089cdb8edf09d76244d03a52bcbb59henrik.lundin@webrtc.org 619a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org 629a400812ca0006d12e538d465ab6728a8ecd07aahenrik.lundin@webrtc.org@end 63