FreeBASIC  0.91.0
symb-keyword.bas
Go to the documentation of this file.
1 '' symbol table module for keywords
2 ''
3 '' chng: sep/2004 written [v1ctor]
4 '' jan/2005 updated to use real linked-lists [v1ctor]
5 
6 
7 #include once "fb.bi"
8 #include once "fbint.bi"
9 #include once "hash.bi"
10 #include once "list.bi"
11 
13  KWD_OPTION_DEFAULT = &h00000000
14  KWD_OPTION_NO_QB = &h00000001
15  KWD_OPTION_STRSUFFIX = &h00000002
16  KWD_OPTION_QB_ONLY = &h00000004
17 end enum
18 
19 type SYMBKWD
20  name as const zstring ptr
21  id as integer
22  class as integer
24 end type
25 
26 '' keywords: name, id (token), class, option
27 dim shared kwdTb( 0 to FB_TOKENS-1 ) as SYMBKWD => _
28 { _
29  ( @"AND" , FB_TK_AND , FB_TKCLASS_OPERATOR ), _
30  ( @"OR" , FB_TK_OR , FB_TKCLASS_OPERATOR ), _
31  ( @"ANDALSO" , FB_TK_ANDALSO , FB_TKCLASS_OPERATOR ), _
32  ( @"ORELSE" , FB_TK_ORELSE , FB_TKCLASS_OPERATOR ), _
33  ( @"XOR" , FB_TK_XOR , FB_TKCLASS_OPERATOR ), _
34  ( @"EQV" , FB_TK_EQV , FB_TKCLASS_OPERATOR ), _
35  ( @"IMP" , FB_TK_IMP , FB_TKCLASS_OPERATOR ), _
36  ( @"NOT" , FB_TK_NOT , FB_TKCLASS_OPERATOR ), _
37  ( @"MOD" , FB_TK_MOD , FB_TKCLASS_OPERATOR ), _
38  ( @"SHL" , FB_TK_SHL , FB_TKCLASS_OPERATOR , KWD_OPTION_NO_QB ), _
39  ( @"SHR" , FB_TK_SHR , FB_TKCLASS_OPERATOR , KWD_OPTION_NO_QB ), _
40  ( @"NEW" , FB_TK_NEW , FB_TKCLASS_OPERATOR , KWD_OPTION_NO_QB ), _
41  ( @"DELETE" , FB_TK_DELETE , FB_TKCLASS_OPERATOR , KWD_OPTION_NO_QB ), _
42  ( @"REM" , FB_TK_REM , FB_TKCLASS_KEYWORD ), _
43  ( @"DIM" , FB_TK_DIM , FB_TKCLASS_KEYWORD ), _
44  ( @"ABS" , FB_TK_ABS , FB_TKCLASS_KEYWORD ), _
45  ( @"SGN" , FB_TK_SGN , FB_TKCLASS_KEYWORD ), _
46  ( @"FIX" , FB_TK_FIX , FB_TKCLASS_KEYWORD ), _
47  ( @"FRAC" , FB_TK_FRAC , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
48  ( @"INT" , FB_TK_INT , FB_TKCLASS_KEYWORD ), _
49  ( @"STATIC" , FB_TK_STATIC , FB_TKCLASS_KEYWORD ), _
50  ( @"SHARED" , FB_TK_SHARED , FB_TKCLASS_KEYWORD ), _
51  ( @"BYTE" , FB_TK_BYTE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
52  ( @"UBYTE" , FB_TK_UBYTE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
53  ( @"SHORT" , FB_TK_SHORT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
54  ( @"USHORT" , FB_TK_USHORT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
55  ( @"INTEGER" , FB_TK_INTEGER , FB_TKCLASS_KEYWORD ), _
56  ( @"UINTEGER" , FB_TK_UINT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
57  ( @"LONG" , FB_TK_LONG , FB_TKCLASS_KEYWORD ), _
58  ( @"ULONG" , FB_TK_ULONG , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
59  ( @"LONGINT" , FB_TK_LONGINT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
60  ( @"ULONGINT" , FB_TK_ULONGINT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
61  ( @"SINGLE" , FB_TK_SINGLE , FB_TKCLASS_KEYWORD ), _
62  ( @"DOUBLE" , FB_TK_DOUBLE , FB_TKCLASS_KEYWORD ), _
63  ( @"STRING" , FB_TK_STRING , FB_TKCLASS_KEYWORD , KWD_OPTION_STRSUFFIX ), _
64  ( @"ZSTRING" , FB_TK_ZSTRING , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
65  ( @"WSTRING" , FB_TK_WSTRING , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
66  ( @"UNSIGNED" , FB_TK_UNSIGNED , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
67  ( @"ANY" , FB_TK_ANY , FB_TKCLASS_KEYWORD ), _
68  ( @"PTR" , FB_TK_PTR , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
69  ( @"POINTER" , FB_TK_POINTER , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
70  ( @"TYPEOF" , FB_TK_TYPEOF , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
71  ( @"WHILE" , FB_TK_WHILE , FB_TKCLASS_KEYWORD ), _
72  ( @"UNTIL" , FB_TK_UNTIL , FB_TKCLASS_KEYWORD ), _
73  ( @"WEND" , FB_TK_WEND , FB_TKCLASS_KEYWORD ), _
74  ( @"CONTINUE" , FB_TK_CONTINUE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
75  ( @"CBYTE" , FB_TK_CBYTE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
76  ( @"CSHORT" , FB_TK_CSHORT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
77  ( @"CINT" , FB_TK_CINT , FB_TKCLASS_KEYWORD ), _
78  ( @"CLNG" , FB_TK_CLNG , FB_TKCLASS_KEYWORD ), _
79  ( @"CLNGINT" , FB_TK_CLNGINT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
80  ( @"CUBYTE" , FB_TK_CUBYTE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
81  ( @"CUSHORT" , FB_TK_CUSHORT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
82  ( @"CUINT" , FB_TK_CUINT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
83  ( @"CULNG" , FB_TK_CULNG , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
84  ( @"CULNGINT" , FB_TK_CULNGINT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
85  ( @"CSNG" , FB_TK_CSNG , FB_TKCLASS_KEYWORD ), _
86  ( @"CDBL" , FB_TK_CDBL , FB_TKCLASS_KEYWORD ), _
87  ( @"CSIGN" , FB_TK_CSIGN , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
88  ( @"CUNSG" , FB_TK_CUNSG , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
89  ( @"CPTR" , FB_TK_CPTR , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
90  ( @"CAST" , FB_TK_CAST , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
91  ( @"CALL" , FB_TK_CALL , FB_TKCLASS_KEYWORD ), _
92  ( @"BYVAL" , FB_TK_BYVAL , FB_TKCLASS_KEYWORD ), _
93  ( @"BYREF" , FB_TK_BYREF , FB_TKCLASS_KEYWORD ), _
94  ( @"AS" , FB_TK_AS , FB_TKCLASS_KEYWORD ), _
95  ( @"DECLARE" , FB_TK_DECLARE , FB_TKCLASS_KEYWORD ), _
96  ( @"GOTO" , FB_TK_GOTO , FB_TKCLASS_KEYWORD ), _
97  ( @"CONST" , FB_TK_CONST , FB_TKCLASS_KEYWORD ), _
98  ( @"FOR" , FB_TK_FOR , FB_TKCLASS_KEYWORD ), _
99  ( @"STEP" , FB_TK_STEP , FB_TKCLASS_KEYWORD ), _
100  ( @"NEXT" , FB_TK_NEXT , FB_TKCLASS_KEYWORD ), _
101  ( @"TO" , FB_TK_TO , FB_TKCLASS_KEYWORD ), _
102  ( @"TYPE" , FB_TK_TYPE , FB_TKCLASS_KEYWORD ), _
103  ( @"UNION" , FB_TK_UNION , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
104  ( @"END" , FB_TK_END , FB_TKCLASS_KEYWORD ), _
105  ( @"SUB" , FB_TK_SUB , FB_TKCLASS_KEYWORD ), _
106  ( @"FUNCTION" , FB_TK_FUNCTION , FB_TKCLASS_KEYWORD ), _
107  ( @"CDECL" , FB_TK_CDECL , FB_TKCLASS_KEYWORD ), _
108  ( @"STDCALL" , FB_TK_STDCALL , FB_TKCLASS_KEYWORD ), _
109  ( @"PASCAL" , FB_TK_PASCAL , FB_TKCLASS_KEYWORD ), _
110  ( @"ALIAS" , FB_TK_ALIAS , FB_TKCLASS_KEYWORD ), _
111  ( @"LIB" , FB_TK_LIB , FB_TKCLASS_KEYWORD ), _
112  ( @"LET" , FB_TK_LET , FB_TKCLASS_KEYWORD ), _
113  ( @"EXIT" , FB_TK_EXIT , FB_TKCLASS_KEYWORD ), _
114  ( @"DO" , FB_TK_DO , FB_TKCLASS_KEYWORD ), _
115  ( @"LOOP" , FB_TK_LOOP , FB_TKCLASS_KEYWORD ), _
116  ( @"RETURN" , FB_TK_RETURN , FB_TKCLASS_KEYWORD ), _
117  ( @"IF" , FB_TK_IF , FB_TKCLASS_KEYWORD ), _
118  ( @"THEN" , FB_TK_THEN , FB_TKCLASS_KEYWORD ), _
119  ( @"ELSE" , FB_TK_ELSE , FB_TKCLASS_KEYWORD ), _
120  ( @"ELSEIF" , FB_TK_ELSEIF , FB_TKCLASS_KEYWORD ), _
121  ( @"ENDIF" , FB_TK_ENDIF , FB_TKCLASS_KEYWORD ), _
122  ( @"SELECT" , FB_TK_SELECT , FB_TKCLASS_KEYWORD ), _
123  ( @"CASE" , FB_TK_CASE , FB_TKCLASS_KEYWORD ), _
124  ( @"IS" , FB_TK_IS , FB_TKCLASS_KEYWORD ), _
125  ( @"USING" , FB_TK_USING , FB_TKCLASS_KEYWORD ), _
126  ( @"LEN" , FB_TK_LEN , FB_TKCLASS_QUIRKWD ), _
127  ( @"PEEK" , FB_TK_PEEK , FB_TKCLASS_KEYWORD ), _
128  ( @"POKE" , FB_TK_POKE , FB_TKCLASS_KEYWORD ), _
129  ( @"SWAP" , FB_TK_SWAP , FB_TKCLASS_KEYWORD ), _
130  ( @"COMMON" , FB_TK_COMMON , FB_TKCLASS_KEYWORD ), _
131  ( @"ENUM" , FB_TK_ENUM , FB_TKCLASS_KEYWORD ), _
132  ( @"ASM" , FB_TK_ASM , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
133  ( @"EXTERN" , FB_TK_EXTERN , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
134  ( @"WITH" , FB_TK_WITH , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
135  ( @"SCOPE" , FB_TK_SCOPE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
136  ( @"PUBLIC" , FB_TK_PUBLIC , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
137  ( @"PRIVATE" , FB_TK_PRIVATE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
138  ( @"PROTECTED" , FB_TK_PROTECTED , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
139  ( @"PROCPTR" , FB_TK_PROCPTR , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
140  ( @"NAMESPACE" , FB_TK_NAMESPACE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
141  ( @"EXPORT" , FB_TK_EXPORT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
142  ( @"IMPORT" , FB_TK_IMPORT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
143  ( @"OVERLOAD" , FB_TK_OVERLOAD , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
144  ( @"CONSTRUCTOR", FB_TK_CONSTRUCTOR , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
145  ( @"DESTRUCTOR" , FB_TK_DESTRUCTOR , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
146  ( @"OPERATOR" , FB_TK_OPERATOR , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
147  ( @"PROPERTY" , FB_TK_PROPERTY , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
148  ( @"CLASS" , FB_TK_CLASS , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
149  ( @"EXTENDS" , FB_TK_EXTENDS , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
150  ( @"IMPLEMENTS" , FB_TK_IMPLEMENTS , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
151  ( @"BASE" , FB_TK_BASE , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
152  ( @"VIRTUAL" , FB_TK_VIRTUAL , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
153  ( @"ABSTRACT" , FB_TK_ABSTRACT , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
154  ( @"VAR" , FB_TK_VAR , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
155  ( @"IIF" , FB_TK_IIF , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
156  ( @"VA_FIRST" , FB_TK_VA_FIRST , FB_TKCLASS_KEYWORD , KWD_OPTION_NO_QB ), _
157  ( @"DATA" , FB_TK_DATA , FB_TKCLASS_QUIRKWD ), _
158  ( @"FIELD" , FB_TK_FIELD , FB_TKCLASS_QUIRKWD ), _
159  ( @"LOCAL" , FB_TK_LOCAL , FB_TKCLASS_QUIRKWD ), _
160  ( @"DEFINED" , FB_TK_DEFINED , FB_TKCLASS_QUIRKWD ), _
161  ( @"SIZEOF" , FB_TK_SIZEOF , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
162  ( @"STRPTR" , FB_TK_STRPTR , FB_TKCLASS_QUIRKWD ), _
163  ( @"VARPTR" , FB_TK_VARPTR , FB_TKCLASS_QUIRKWD ), _
164  ( @"DYNAMIC" , FB_TK_DYNAMIC , FB_TKCLASS_QUIRKWD ), _
165  ( @"INCLUDE" , FB_TK_INCLUDE , FB_TKCLASS_QUIRKWD ), _
166  ( @"GOSUB" , FB_TK_GOSUB , FB_TKCLASS_QUIRKWD ), _
167  ( @"DEFBYTE" , FB_TK_DEFBYTE , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
168  ( @"DEFUBYTE" , FB_TK_DEFUBYTE , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
169  ( @"DEFSHORT" , FB_TK_DEFSHORT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
170  ( @"DEFUSHORT" , FB_TK_DEFUSHORT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
171  ( @"DEFINT" , FB_TK_DEFINT , FB_TKCLASS_QUIRKWD ), _
172  ( @"DEFUINT" , FB_TK_DEFUINT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
173  ( @"DEFLNG" , FB_TK_DEFLNG , FB_TKCLASS_QUIRKWD ), _
174  ( @"DEFULNG" , FB_TK_DEFULNG , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
175  ( @"DEFLONGINT" , FB_TK_DEFLNGINT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
176  ( @"DEFULONGINT", FB_TK_DEFULNGINT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
177  ( @"DEFSNG" , FB_TK_DEFSNG , FB_TKCLASS_QUIRKWD ), _
178  ( @"DEFDBL" , FB_TK_DEFDBL , FB_TKCLASS_QUIRKWD ), _
179  ( @"DEFSTR" , FB_TK_DEFSTR , FB_TKCLASS_QUIRKWD ), _
180  ( @"OPTION" , FB_TK_OPTION , FB_TKCLASS_QUIRKWD ), _
181  ( @"EXPLICIT" , FB_TK_EXPLICIT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
182  ( @"SADD" , FB_TK_SADD , FB_TKCLASS_QUIRKWD ), _
183  ( @"ON" , FB_TK_ON , FB_TKCLASS_QUIRKWD ), _
184  ( @"ERROR" , FB_TK_ERROR , FB_TKCLASS_QUIRKWD ), _
185  ( @"SIN" , FB_TK_SIN , FB_TKCLASS_QUIRKWD ), _
186  ( @"ASIN" , FB_TK_ASIN , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
187  ( @"COS" , FB_TK_COS , FB_TKCLASS_QUIRKWD ), _
188  ( @"ACOS" , FB_TK_ACOS , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
189  ( @"TAN" , FB_TK_TAN , FB_TKCLASS_QUIRKWD ), _
190  ( @"ATN" , FB_TK_ATN , FB_TKCLASS_QUIRKWD ), _
191  ( @"SQR" , FB_TK_SQR , FB_TKCLASS_QUIRKWD ), _
192  ( @"LOG" , FB_TK_LOG , FB_TKCLASS_QUIRKWD ), _
193  ( @"EXP" , FB_TK_EXP , FB_TKCLASS_QUIRKWD ), _
194  ( @"ATAN2" , FB_TK_ATAN2 , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
195  ( @"RESUME" , FB_TK_RESUME , FB_TKCLASS_QUIRKWD ), _
196  ( @"ERR" , FB_TK_ERR , FB_TKCLASS_QUIRKWD ), _
197  ( @"REDIM" , FB_TK_REDIM , FB_TKCLASS_QUIRKWD ), _
198  ( @"ERASE" , FB_TK_ERASE , FB_TKCLASS_QUIRKWD ), _
199  ( @"LBOUND" , FB_TK_LBOUND , FB_TKCLASS_QUIRKWD ), _
200  ( @"UBOUND" , FB_TK_UBOUND , FB_TKCLASS_QUIRKWD ), _
201  ( @"STR" , FB_TK_STR , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
202  ( @"CVD" , FB_TK_CVD , FB_TKCLASS_QUIRKWD ), _
203  ( @"CVS" , FB_TK_CVS , FB_TKCLASS_QUIRKWD ), _
204  ( @"CVI" , FB_TK_CVI , FB_TKCLASS_QUIRKWD ), _
205  ( @"CVL" , FB_TK_CVL , FB_TKCLASS_QUIRKWD ), _
206  ( @"CVSHORT" , FB_TK_CVSHORT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
207  ( @"CVLONGINT" , FB_TK_CVLONGINT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
208  ( @"MKD" , FB_TK_MKD , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
209  ( @"MKS" , FB_TK_MKS , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
210  ( @"MKI" , FB_TK_MKI , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
211  ( @"MKL" , FB_TK_MKL , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
212  ( @"MKSHORT" , FB_TK_MKSHORT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
213  ( @"MKLONGINT" , FB_TK_MKLONGINT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
214  ( @"WSTR" , FB_TK_WSTR , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
215  ( @"MID" , FB_TK_MID , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
216  ( @"INSTR" , FB_TK_INSTR , FB_TKCLASS_QUIRKWD ), _
217  ( @"INSTRREV" , FB_TK_INSTRREV , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
218  ( @"TRIM" , FB_TK_TRIM , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
219  ( @"RTRIM" , FB_TK_RTRIM , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
220  ( @"LTRIM" , FB_TK_LTRIM , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
221  ( @"LCASE" , FB_TK_LCASE , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
222  ( @"UCASE" , FB_TK_UCASE , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
223  ( @"RESTORE" , FB_TK_RESTORE , FB_TKCLASS_QUIRKWD ), _
224  ( @"READ" , FB_TK_READ , FB_TKCLASS_QUIRKWD ), _
225  ( @"PRINT" , FB_TK_PRINT , FB_TKCLASS_QUIRKWD ), _
226  ( @"LPRINT" , FB_TK_LPRINT , FB_TKCLASS_QUIRKWD ), _
227  ( @"OPEN" , FB_TK_OPEN , FB_TKCLASS_QUIRKWD ), _
228  ( @"CLOSE" , FB_TK_CLOSE , FB_TKCLASS_QUIRKWD ), _
229  ( @"SEEK" , FB_TK_SEEK , FB_TKCLASS_QUIRKWD ), _
230  ( @"PUT" , FB_TK_PUT , FB_TKCLASS_QUIRKWD ), _
231  ( @"GET" , FB_TK_GET , FB_TKCLASS_QUIRKWD ), _
232  ( @"ACCESS" , FB_TK_ACCESS , FB_TKCLASS_QUIRKWD ), _
233  ( @"WRITE" , FB_TK_WRITE , FB_TKCLASS_QUIRKWD ), _
234  ( @"LOCK" , FB_TK_LOCK , FB_TKCLASS_QUIRKWD ), _
235  ( @"INPUT" , FB_TK_INPUT , FB_TKCLASS_QUIRKWD ), _
236  ( @"WINPUT" , FB_TK_WINPUT , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
237  ( @"OUTPUT" , FB_TK_OUTPUT , FB_TKCLASS_QUIRKWD ), _
238  ( @"BINARY" , FB_TK_BINARY , FB_TKCLASS_QUIRKWD ), _
239  ( @"RANDOM" , FB_TK_RANDOM , FB_TKCLASS_QUIRKWD ), _
240  ( @"APPEND" , FB_TK_APPEND , FB_TKCLASS_QUIRKWD ), _
241  ( @"ENCODING" , FB_TK_ENCODING , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
242  ( @"NAME" , FB_TK_NAME , FB_TKCLASS_QUIRKWD ), _
243  ( @"WIDTH" , FB_TK_WIDTH , FB_TKCLASS_QUIRKWD ), _
244  ( @"COLOR" , FB_TK_COLOR , FB_TKCLASS_QUIRKWD ), _
245  ( @"PRESERVE" , FB_TK_PRESERVE , FB_TKCLASS_QUIRKWD ), _
246  ( @"SPC" , FB_TK_SPC , FB_TKCLASS_QUIRKWD ), _
247  ( @"TAB" , FB_TK_TAB , FB_TKCLASS_QUIRKWD ), _
248  ( @"LINE" , FB_TK_LINE , FB_TKCLASS_QUIRKWD ), _
249  ( @"VIEW" , FB_TK_VIEW , FB_TKCLASS_QUIRKWD ), _
250  ( @"UNLOCK" , FB_TK_UNLOCK , FB_TKCLASS_QUIRKWD ), _
251  ( @"CHR" , FB_TK_CHR , FB_TKCLASS_QUIRKWD , KWD_OPTION_STRSUFFIX ), _
252  ( @"WCHR" , FB_TK_WCHR , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
253  ( @"ASC" , FB_TK_ASC , FB_TKCLASS_QUIRKWD ), _
254  ( @"LSET" , FB_TK_LSET , FB_TKCLASS_QUIRKWD ), _
255  ( @"RSET" , FB_TK_RSET , FB_TKCLASS_QUIRKWD ), _
256  ( @"PSET" , FB_TK_PSET , FB_TKCLASS_QUIRKWD ), _
257  ( @"PRESET" , FB_TK_PRESET , FB_TKCLASS_QUIRKWD ), _
258  ( @"POINT" , FB_TK_POINT , FB_TKCLASS_QUIRKWD ), _
259  ( @"CIRCLE" , FB_TK_CIRCLE , FB_TKCLASS_QUIRKWD ), _
260  ( @"WINDOW" , FB_TK_WINDOW , FB_TKCLASS_QUIRKWD ), _
261  ( @"PALETTE" , FB_TK_PALETTE , FB_TKCLASS_QUIRKWD ), _
262  ( @"SCREEN" , FB_TK_SCREEN , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
263  ( @"SCREEN" , FB_TK_SCREENQB , FB_TKCLASS_QUIRKWD , KWD_OPTION_QB_ONLY ), _
264  ( @"PAINT" , FB_TK_PAINT , FB_TKCLASS_QUIRKWD ), _
265  ( @"DRAW" , FB_TK_DRAW , FB_TKCLASS_QUIRKWD ), _
266  ( @"IMAGECREATE", FB_TK_IMAGECREATE , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
267  ( @"THREADCALL" , FB_TK_THREADCALL , FB_TKCLASS_QUIRKWD , KWD_OPTION_NO_QB ), _
268  ( NULL ) _
269 }
270 
271 '':::::
273 
274  dim as integer i = 0
275  do until( kwdTb(i).name = NULL )
276 
277  '' add the '__' prefix if the kwd wasn't present in QB and we are in '-lang qb' mode
278  dim as const zstring ptr kname = kwdTb(i).name
279  if( (kwdTb(i).opt and KWD_OPTION_NO_QB) <> 0 ) then
280  if( fbLangIsSet( FB_LANG_QB ) ) then
281  static as string tmp
282  tmp = "__" + *kname
283  kname = strptr( tmp )
284  end if
285  end if
286 
287  if( (kwdTb(i).opt and KWD_OPTION_QB_ONLY) <> 0 ) then
288  if( fbLangIsSet( FB_LANG_QB ) = FALSE ) then
289  '' skip QB-only keywords when not in -lang qb
290  i += 1
291  continue do
292  end if
293  end if
294 
295  '' QB quirks..
296  if( (kwdTb(i).opt and KWD_OPTION_STRSUFFIX) <> 0 ) then
297  symbAddKeyword( kname, _
298  kwdTb(i).id, _
299  kwdTb(i).class, _
300  NULL, _
301  FB_DATATYPE_STRING, _
302  FB_SYMBATTRIB_SUFFIXED )
303  else
304  symbAddKeyword( kname, kwdTb(i).id, kwdTb(i).class )
305  end if
306 
307  i += 1
308  loop
309 
310 end sub
311 
312 '':::::
313 function symbAddKeyword _
314  ( _
315  byval symbol as const zstring ptr, _
316  byval id as integer, _
317  byval class_ as integer, _
318  byval hashtb as FBHASHTB ptr, _
319  byval dtype as integer, _
320  byval attrib as FB_SYMBATTRIB _
321  ) as FBSYMBOL ptr
322 
323  dim as FBSYMBOL ptr k = any
324 
325  k = symbNewSymbol( FB_SYMBOPT_DOHASH or FB_SYMBOPT_PRESERVECASE, _
326  NULL, _
327  @symbGetGlobalTb( ), hashtb, _
328  FB_SYMBCLASS_KEYWORD, _
329  symbol, NULL, _
330  dtype, NULL, _
331  attrib )
332  if( k = NULL ) then
333  return NULL
334  end if
335 
336  ''
337  k->key.id = id
338  k->key.tkclass = class_
339 
340  function = k
341 
342 end function
343 
344 function symbKeywordGetText( byval tk as integer ) as const zstring ptr
345  '' This is super slow, but as long as it's only used for error
346  '' reporting it does not matter.
347  '' (TODO: sort the keyword table to match FB_TOKEN enum)
348  for i as integer = lbound( kwdTb ) to ubound( kwdTb )
349  if( kwdTb(i).id = tk ) then
350  return kwdTb(i).name
351  end if
352  next
353  function = @""
354 end function
355