1 {*********************************************************}
3 { Zeos Database Objects }
4 { String tokenizing classes for Interbase }
6 { Originally written by Sergey Seroukhov }
8 {*********************************************************}
10 {@********************************************************}
11 { Copyright (c) 1999-2012 Zeos Development Group }
13 { License Agreement: }
15 { This library is distributed in the hope that it will be }
16 { useful, but WITHOUT ANY WARRANTY; without even the }
17 { implied warranty of MERCHANTABILITY or FITNESS FOR }
18 { A PARTICULAR PURPOSE. See the GNU Lesser General }
19 { Public License for more details. }
21 { The source code of the ZEOS Libraries and packages are }
22 { distributed under the Library GNU General Public }
23 { License (see the file COPYING / COPYING.ZEOS) }
24 { with the following modification: }
25 { As a special exception, the copyright holders of this }
26 { library give you permission to link this library with }
27 { independent modules to produce an executable, }
28 { regardless of the license terms of these independent }
29 { modules, and to copy and distribute the resulting }
30 { executable under terms of your choice, provided that }
31 { you also meet, for each linked independent module, }
32 { the terms and conditions of the license of that module. }
33 { An independent module is a module which is not derived }
34 { from or based on this library. If you modify this }
35 { library, you may extend this exception to your version }
36 { of the library, but you are not obligated to do so. }
37 { If you do not wish to do so, delete this exception }
38 { statement from your version. }
41 { The project web site is located on: }
42 { http://zeos.firmos.at (FORUM) }
43 { http://sourceforge.net/p/zeoslib/tickets/ (BUGTRACKER)}
44 { svn://svn.code.sf.net/p/zeoslib/code-0/trunk (SVN) }
46 { http://www.sourceforge.net/projects/zeoslib. }
49 { Zeos Development Group. }
50 {********************************************************@}
59 Classes, ZTokenizer, ZGenericSqlToken, ZPostgreSqlToken;
63 {** Implements a Interbase-specific number state object. }
64 TZInterbaseNumberState = class (TZPostgreSQLNumberState)
67 {** Implements a Interbase-specific quote string state object. }
68 TZInterbaseQuoteState = class (TZGenericSQLQuoteState)
72 This state will either delegate to a comment-handling
73 state, or return a token with just a slash in it.
75 TZInterbaseCommentState = class (TZCCommentState)
78 {** Implements a symbol state object. }
79 TZInterbaseSymbolState = class (TZSymbolState)
84 {** Implements a word state object. }
85 TZInterbaseWordState = class (TZGenericSQLWordState)
90 {** Implements a default tokenizer object. }
91 TZInterbaseTokenizer = class (TZTokenizer)
98 { TZInterbaseSymbolState }
101 Creates this Interbase-specific symbol state object.
103 constructor TZInterbaseSymbolState.Create;
114 { TZInterbaseWordState }
117 Constructs this Interbase-specific word state object.
119 constructor TZInterbaseWordState.Create;
121 SetWordChars(#0, #255, False);
122 SetWordChars('a', 'z', True);
123 SetWordChars('A', 'Z', True);
124 SetWordChars('0', '9', True);
125 SetWordChars('_', '_', True);
126 SetWordChars('$', '$', True);
129 { TZInterbaseTokenizer }
131 { TZInterbaseTokenizer }
133 constructor TZInterbaseTokenizer.Create;
135 EscapeState := TZEscapeState.Create;
136 WhitespaceState := TZWhitespaceState.Create;
138 SymbolState := TZInterbaseSymbolState.Create;
139 NumberState := TZInterbaseNumberState.Create;
140 QuoteState := TZInterbaseQuoteState.Create;
141 WordState := TZInterbaseWordState.Create;
142 CommentState := TZInterbaseCommentState.Create;
144 SetCharacterState(#0, #32, WhitespaceState);
145 SetCharacterState(#33, #191, SymbolState);
146 SetCharacterState(#192, High(Char), WordState);
148 SetCharacterState('a', 'z', WordState);
149 SetCharacterState('A', 'Z', WordState);
150 SetCharacterState('_', '_', WordState);
151 SetCharacterState('$', '$', WordState);
153 SetCharacterState('0', '9', NumberState);
154 SetCharacterState('.', '.', NumberState);
156 SetCharacterState('"', '"', QuoteState);
157 SetCharacterState(#39, #39, QuoteState);
159 SetCharacterState('/', '/', CommentState);