Skip to content
Newer
Older
100644 39 lines (33 sloc) 2.04 KB
ee99867 @ccgus oh geeze
authored Mar 4, 2009
1 //
2 // TDSymbolState.h
3 // TDParseKit
4 //
5 // Created by Todd Ditchendorf on 1/20/06.
6 // Copyright 2008 Todd Ditchendorf. All rights reserved.
7 //
8
9 #import <Foundation/Foundation.h>
10 #import "TDTokenizerState.h"
11
12 @class TDSymbolRootNode;
13
14 /*!
15 @class TDSymbolState
16 @brief The idea of a symbol is a character that stands on its own, such as an ampersand or a parenthesis.
17 @details <p>The idea of a symbol is a character that stands on its own, such as an ampersand or a parenthesis. For example, when tokenizing the expression (isReady)& (isWilling) , a typical tokenizer would return 7 tokens, including one for each parenthesis and one for the ampersand. Thus a series of symbols such as )&( becomes three tokens, while a series of letters such as isReady becomes a single word token.</p>
18 <p>Multi-character symbols are an exception to the rule that a symbol is a standalone character. For example, a tokenizer may want less-than-or-equals to tokenize as a single token. This class provides a method for establishing which multi-character symbols an object of this class should treat as single symbols. This allows, for example, "cat <= dog" to tokenize as three tokens, rather than splitting the less-than and equals symbols into separate tokens.</p>
19 <p>By default, this state recognizes the following multi- character symbols: <tt>!=</tt>, <tt>:-</tt>, <tt><=</tt>, <tt>>=</tt></p>
20 */
21 @interface TDSymbolState : TDTokenizerState {
22 TDSymbolRootNode *rootNode;
23 NSMutableArray *addedSymbols;
24 }
25
26 /*!
27 @brief Adds the given string as a multi-character symbol.
28 @param s a multi-character symbol that should be recognized as a single symbol token by this state
29 */
30 - (void)add:(NSString *)s;
31
32 /*!
33 @brief Removes the given string as a multi-character symbol.
34 @details If <tt>s</tt> was never added as a multi-character symbol, this has no effect.
35 @param s a multi-character symbol that should no longer be recognized as a single symbol token by this state
36 */
37 - (void)remove:(NSString *)s;
38 @end
Something went wrong with that request. Please try again.