1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: cx_c_std.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include "cx_c_std.hxx"
35 // NOT FULLY DECLARED SERVICES
36 #include "all_toks.hxx"
37 #include "cx_c_pp.hxx"
38 #include "cx_c_sub.hxx"
39 #include <tools/tkpchars.hxx>
40 #include <tokens/tkpstama.hxx>
41 #include <x_parse.hxx>
42 #include "c_dealer.hxx"
48 const intt C_nCppInitialNrOfStati
= 600;
49 const intt C_nStatusSize
= 128;
53 const uintt nF_fin_Error
= 1;
54 const uintt nF_fin_CreateWithoutText
= 2;
55 const uintt nF_fin_CreateWithText
= 3;
56 const uintt nF_fin_Ignore
= 4;
57 const uintt nF_fin_EOL
= 5;
58 const uintt nF_fin_EOF
= 6;
59 const uintt nF_fin_Bezeichner
= 7;
61 const uintt nF_goto_Preprocessor
= 10;
62 const uintt nF_goto_Comment
= 11;
63 const uintt nF_goto_Docu
= 12;
64 const uintt nF_goto_Const
= 13;
65 const uintt nF_goto_UnblockMacro
= 14;
67 // Token create functions for the state machine:
68 DYN TextToken
* TCF_Identifier(const char * text
) { return new Tok_Identifier(text
); }
70 DYN TextToken
* TCF_operator(const char *) { return new Tok_operator
; }
71 DYN TextToken
* TCF_class(const char *) { return new Tok_class
; }
72 DYN TextToken
* TCF_struct(const char *) { return new Tok_struct
; }
73 DYN TextToken
* TCF_union(const char *) { return new Tok_union
; }
74 DYN TextToken
* TCF_enum(const char *) { return new Tok_enum
; }
75 DYN TextToken
* TCF_typedef(const char *) { return new Tok_typedef
; }
76 DYN TextToken
* TCF_public(const char *) { return new Tok_public
; }
77 DYN TextToken
* TCF_protected(const char *) { return new Tok_protected
; }
78 DYN TextToken
* TCF_private(const char *) { return new Tok_private
; }
79 DYN TextToken
* TCF_template(const char *) { return new Tok_template
; }
80 DYN TextToken
* TCF_virtual(const char *) { return new Tok_virtual
; }
81 DYN TextToken
* TCF_friend(const char *) { return new Tok_friend
; }
82 DYN TextToken
* TCF_Tilde(const char *) { return new Tok_Tilde
; }
83 DYN TextToken
* TCF_const(const char *) { return new Tok_const
; }
84 DYN TextToken
* TCF_volatile(const char *) { return new Tok_volatile
; }
85 DYN TextToken
* TCF_extern(const char *) { return new Tok_extern
; }
86 DYN TextToken
* TCF_static(const char *) { return new Tok_static
; }
87 DYN TextToken
* TCF_mutable(const char *) { return new Tok_mutable
; }
88 DYN TextToken
* TCF_register(const char *) { return new Tok_register
; }
89 DYN TextToken
* TCF_inline(const char *) { return new Tok_inline
; }
90 DYN TextToken
* TCF_explicit(const char *) { return new Tok_explicit
; }
91 DYN TextToken
* TCF_namespace(const char *) { return new Tok_namespace
; }
92 DYN TextToken
* TCF_using(const char *) { return new Tok_using
; }
93 DYN TextToken
* TCF_throw(const char *) { return new Tok_throw
; }
94 DYN TextToken
* TCF_SwBracketOpen(const char *) { return new Tok_SwBracket_Left
; }
95 DYN TextToken
* TCF_SwBracketClose(const char *) { return new Tok_SwBracket_Right
; }
96 DYN TextToken
* TCF_ArBracketOpen(const char *) { return new Tok_ArrayBracket_Left
; }
97 DYN TextToken
* TCF_ArBracketClose(const char *) { return new Tok_ArrayBracket_Right
; }
98 DYN TextToken
* TCF_BracketOpen(const char *) { return new Tok_Bracket_Left
; }
99 DYN TextToken
* TCF_BracketClose(const char *) { return new Tok_Bracket_Right
; }
100 DYN TextToken
* TCF_DblColon(const char *) { return new Tok_DoubleColon
; }
101 DYN TextToken
* TCF_Semikolon(const char *) { return new Tok_Semicolon
; }
102 DYN TextToken
* TCF_Komma(const char *) { return new Tok_Comma
; }
103 DYN TextToken
* TCF_Colon(const char *) { return new Tok_Colon
; }
104 DYN TextToken
* TCF_Zuweisung(const char *) { return new Tok_Assign
; }
105 DYN TextToken
* TCF_Smaller(const char *) { return new Tok_Less
; }
106 DYN TextToken
* TCF_Bigger(const char *) { return new Tok_Greater
; }
107 DYN TextToken
* TCF_Stern(const char *) { return new Tok_Asterix
; }
108 DYN TextToken
* TCF_Ampersand(const char *) { return new Tok_AmpersAnd
; }
109 DYN TextToken
* TCF_Ellipse(const char *) { return new Tok_Ellipse
; }
110 DYN TextToken
* TCF_typename(const char *) { return new Tok_typename
; }
113 DYN TextToken
* TCF_Operator(const char * text
) { return new Tok_Operator(text
); }
115 DYN TextToken
* TCF_BuiltInType(const char * text
) { return new Tok_BuiltInType(text
); }
116 DYN TextToken
* TCF_TypeModifier(const char * text
) { return new Tok_TypeSpecializer(text
); }
118 DYN TextToken
* TCF_Eof(const char *) { return new Tok_Eof
; }
122 Context_CppStd::Context_CppStd( DYN
autodoc::TkpDocuContext
& let_drContext_Docu
)
124 aStateMachine(C_nStatusSize
,C_nCppInitialNrOfStati
),
125 pDocuContext(&let_drContext_Docu
),
127 pContext_Preprocessor(0),
128 pContext_ConstString(0),
129 pContext_ConstChar(0),
130 pContext_ConstNumeric(0),
131 pContext_UnblockMacro(0)
133 pDocuContext
->SetParentContext(*this,"*/");
135 pContext_Comment
= new Context_Comment(*this);
136 pContext_Preprocessor
= new Context_Preprocessor(*this);
137 pContext_ConstString
= new Context_ConstString(*this);
138 pContext_ConstChar
= new Context_ConstChar(*this);
139 pContext_ConstNumeric
= new Context_ConstNumeric(*this);
140 pContext_UnblockMacro
= new Context_UnblockMacro(*this);
145 Context_CppStd::~Context_CppStd()
150 Context_CppStd::ReadCharChain( CharacterSource
& io_rText
)
154 TextToken::F_CRTOK fTokenCreateFunction
= 0;
155 StmBoundsStatus
& rBound
= aStateMachine
.GetCharChain(fTokenCreateFunction
, io_rText
);
158 // The order of the next two lines is essential, because
159 // pFollowUpContext may be changed by PerformStatusFunction() also,
160 // which then MUST override the previous assignment.
161 SetFollowUpContext(rBound
.FollowUpContext());
162 PerformStatusFunction(rBound
.StatusFunctionNr(), fTokenCreateFunction
, io_rText
);
166 Context_CppStd::AssignDealer( Distributor
& o_rDealer
)
168 Cx_Base::AssignDealer(o_rDealer
);
170 pDocuContext
->AssignDealer(o_rDealer
);
171 pContext_Comment
->AssignDealer(o_rDealer
);
172 pContext_Preprocessor
->AssignDealer(o_rDealer
);
173 pContext_ConstString
->AssignDealer(o_rDealer
);
174 pContext_ConstChar
->AssignDealer(o_rDealer
);
175 pContext_ConstNumeric
->AssignDealer(o_rDealer
);
176 pContext_UnblockMacro
->AssignDealer(o_rDealer
);
180 Context_CppStd::PerformStatusFunction( uintt i_nStatusSignal
,
181 F_CRTOK i_fTokenCreateFunction
,
182 CharacterSource
& io_rText
)
184 switch (i_nStatusSignal
)
186 case nF_fin_CreateWithoutText
:
188 csv_assert(i_fTokenCreateFunction
!= 0);
189 SetNewToken( (*i_fTokenCreateFunction
)(0) );
191 case nF_fin_CreateWithText
:
192 csv_assert(i_fTokenCreateFunction
!= 0);
193 SetNewToken( (*i_fTokenCreateFunction
)(io_rText
.CutToken()) );
206 SetNewToken( TCF_Eof(0) );
208 case nF_fin_Bezeichner
:
209 SetNewToken( TCF_Identifier(io_rText
.CutToken()) );
212 case nF_goto_Preprocessor
:
216 case nF_goto_Comment
:
218 pContext_Comment
->SetMode_IsMultiLine( io_rText
.CutToken()[1] == '*' );
222 pDocuContext
->SetMode_IsMultiLine( io_rText
.CutToken()[1] == '*' );
227 case nF_goto_UnblockMacro
:
234 char cCC
= io_rText
.CurChar();
235 String
sCurChar( &cCC
, 1 );
236 throw X_Parser( X_Parser::x_InvalidChar
, sCurChar
, String::Null_(), 0 );
238 } // end switch (i_nStatusSignal)
242 Context_CppStd::SetupStateMachine()
244 // Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel):
245 // const INT16 top = 0; // Top-Status
246 const INT16 wht
= 1; // Whitespace-überlese-Status
247 const INT16 bez
= 2; // Bezeichner-lese-Status
249 // Tokenfinish-Stati:
250 const INT16 finError
= 3;
251 const INT16 finIgnore
= 4;
252 const INT16 finBezeichner
= 5;
253 const INT16 finKeyword
= 6;
254 const INT16 finPunctuation
= 7;
255 const INT16 finBiType
= 8;
256 const INT16 finTypeModifier
= 9;
257 const INT16 finEOL
= 10;
258 const INT16 finEOF
= 11;
260 // Kontextwechsel-Stati:
261 const INT16 gotoComment
= 12;
262 const INT16 gotoDocu
= 13;
263 const INT16 gotoPreprocessor
= 14;
264 const INT16 gotoConstString
= 15;
265 const INT16 gotoConstChar
= 16;
266 const INT16 gotoConstNumeric
= 17;
267 const INT16 gotoUnblockMacro
= 18;
269 // Abbreviations to be used in status tables:
270 const INT16 err
= finError
;
271 const INT16 fig
= finIgnore
;
272 const INT16 fbz
= finBezeichner
;
273 const INT16 fof
= finEOF
;
274 const INT16 cst
= gotoConstString
;
275 const INT16 cch
= gotoConstChar
;
276 const INT16 cnr
= gotoConstNumeric
;
279 /// Zeros - '0' - will be replaced by AddToken().
281 const INT16 A_nTopStatus
[C_nStatusSize
] =
282 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
283 {fof
,err
,err
,err
,err
,err
,err
,err
,err
,wht
, 0,wht
,wht
, 0,err
,err
,
284 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,fof
,err
,err
,err
,err
,err
, // 16 ...
285 wht
, 0,cst
, 0,err
, 0, 0,cch
, 0, 0, 0, 0, 0, 0, 0, 0,
286 cnr
,cnr
,cnr
,cnr
,cnr
,cnr
,cnr
,cnr
,cnr
,cnr
, 0, 0, 0, 0, 0, 0, // 48 ...
287 0,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,
288 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
, 0, 0, 0, 0,bez
, // 80 ...
289 0,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,
290 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
, 0, 0, 0, 0,err
, // 80 ...
293 const INT16 A_nWhitespaceStatus
[C_nStatusSize
] =
294 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
295 {fof
,err
,err
,err
,err
,err
,err
,err
,err
,wht
,fig
,wht
,wht
,fig
,err
,err
,
296 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,fof
,err
,err
,err
,err
,err
, // 16 ...
297 wht
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,
298 fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
, // 48 ...
299 fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,
300 fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
, // 80 ...
301 fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,
302 fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,fig
,err
305 const INT16 A_nBezeichnerStatus
[C_nStatusSize
] =
306 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
307 {fbz
,err
,err
,err
,err
,err
,err
,err
,err
,fbz
,fbz
,fbz
,fbz
,fbz
,err
,err
,
308 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,fbz
,err
,err
,err
,err
,err
, // 16 ...
309 fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,
310 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
, // 48 ...
311 fbz
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,
312 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,fbz
,fbz
,fbz
,fbz
,bez
, // 80 ...
313 fbz
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,
314 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,fbz
,fbz
,fbz
,fbz
,err
318 const INT16 A_nOperatorDefStatus
[C_nStatusSize
] =
319 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
320 {err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,
321 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
, // 16 ...
322 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,
323 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
, // 48 ...
324 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,
325 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
, // 80 ...
326 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,
327 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,err
330 const INT16 A_nBezDefStatus
[C_nStatusSize
] =
331 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
332 {fbz
,err
,err
,err
,err
,err
,err
,err
,err
,fbz
,fbz
,fbz
,fbz
,fbz
,err
,err
,
333 err
,err
,err
,err
,err
,err
,err
,err
,err
,err
,fbz
,err
,err
,err
,err
,err
, // 16 ...
334 fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
,
335 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,fbz
,fbz
,fbz
,fbz
,fbz
,fbz
, // 48 ...
336 fbz
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,
337 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,fbz
,fbz
,fbz
,fbz
,bez
, // 80 ...
338 fbz
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,
339 bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,bez
,fbz
,fbz
,fbz
,fbz
,err
342 DYN StmArrayStatus
* dpStatusTop
343 = new StmArrayStatus( C_nStatusSize
, A_nTopStatus
, 0, true);
344 DYN StmArrayStatus
* dpStatusWhite
345 = new StmArrayStatus( C_nStatusSize
, A_nWhitespaceStatus
, 0, true);
346 DYN StmArrayStatus
* dpStatusBez
347 = new StmArrayStatus( C_nStatusSize
, A_nBezeichnerStatus
, TCF_Identifier
, true);
349 DYN StmBoundsStatus
* dpBst_finError
350 = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Error
, true );
351 DYN StmBoundsStatus
* dpBst_finIgnore
352 = new StmBoundsStatus( *this, *this, nF_fin_Ignore
, true );
353 DYN StmBoundsStatus
* dpBst_finBezeichner
354 = new StmBoundsStatus( *this, *this, nF_fin_Bezeichner
, true );
355 DYN StmBoundsStatus
* dpBst_finKeyword
356 = new StmBoundsStatus( *this, *this, nF_fin_CreateWithoutText
, false );
357 DYN StmBoundsStatus
* dpBst_finPunctuation
358 = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText
, false );
359 DYN StmBoundsStatus
* dpBst_finBiType
360 = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText
, false );
361 DYN StmBoundsStatus
* dpBst_finTypeModifier
362 = new StmBoundsStatus( *this, *this, nF_fin_CreateWithText
, false );
363 DYN StmBoundsStatus
* dpBst_finEOL
364 = new StmBoundsStatus( *this, *this, nF_fin_EOL
, false );
365 DYN StmBoundsStatus
* dpBst_finEOF
366 = new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_EOF
, false );
368 DYN StmBoundsStatus
* dpBst_gotoComment
369 = new StmBoundsStatus( *this, *pContext_Comment
, nF_goto_Comment
, false );
370 DYN StmBoundsStatus
* dpBst_gotoDocu
371 = new StmBoundsStatus( *this, *pDocuContext
, nF_goto_Docu
, false );
372 DYN StmBoundsStatus
* dpBst_gotoPreprocessor
373 = new StmBoundsStatus( *this, *pContext_Preprocessor
, nF_goto_Preprocessor
, false );
374 DYN StmBoundsStatus
* dpBst_gotoConstString
375 = new StmBoundsStatus( *this, *pContext_ConstString
, nF_goto_Const
, false );
376 DYN StmBoundsStatus
* dpBst_gotoConstChar
377 = new StmBoundsStatus( *this, *pContext_ConstChar
, nF_goto_Const
, false );
378 DYN StmBoundsStatus
* dpBst_gotoConstNumeric
379 = new StmBoundsStatus( *this, *pContext_ConstNumeric
, nF_goto_Const
, false );
380 DYN StmBoundsStatus
* dpBst_gotoUnblockMacro
381 = new StmBoundsStatus( *this, *pContext_UnblockMacro
, nF_goto_UnblockMacro
, false );
384 aStateMachine
.AddStatus(dpStatusTop
);
386 aStateMachine
.AddStatus(dpStatusWhite
);
387 aStateMachine
.AddStatus(dpStatusBez
);
389 aStateMachine
.AddStatus(dpBst_finError
);
390 aStateMachine
.AddStatus(dpBst_finIgnore
);
391 aStateMachine
.AddStatus(dpBst_finBezeichner
);
392 aStateMachine
.AddStatus(dpBst_finKeyword
);
393 aStateMachine
.AddStatus(dpBst_finPunctuation
);
394 aStateMachine
.AddStatus(dpBst_finBiType
);
395 aStateMachine
.AddStatus(dpBst_finTypeModifier
);
396 aStateMachine
.AddStatus(dpBst_finEOL
);
397 aStateMachine
.AddStatus(dpBst_finEOF
);
399 aStateMachine
.AddStatus(dpBst_gotoComment
);
400 aStateMachine
.AddStatus(dpBst_gotoDocu
);
401 aStateMachine
.AddStatus(dpBst_gotoPreprocessor
);
402 aStateMachine
.AddStatus(dpBst_gotoConstString
);
403 aStateMachine
.AddStatus(dpBst_gotoConstChar
);
404 aStateMachine
.AddStatus(dpBst_gotoConstNumeric
);
405 aStateMachine
.AddStatus(dpBst_gotoUnblockMacro
);
409 // Keywords and other unique Tokens
410 aStateMachine
.AddToken("operator",TCF_operator
,A_nBezDefStatus
,finKeyword
);
411 aStateMachine
.AddToken("class",TCF_class
,A_nBezDefStatus
,finKeyword
);
412 aStateMachine
.AddToken("struct",TCF_struct
,A_nBezDefStatus
,finKeyword
);
413 aStateMachine
.AddToken("union",TCF_union
,A_nBezDefStatus
,finKeyword
);
414 aStateMachine
.AddToken("enum",TCF_enum
,A_nBezDefStatus
,finKeyword
);
415 aStateMachine
.AddToken("typedef",TCF_typedef
,A_nBezDefStatus
,finKeyword
);
416 aStateMachine
.AddToken("public",TCF_public
,A_nBezDefStatus
,finKeyword
);
417 aStateMachine
.AddToken("protected",TCF_protected
,A_nBezDefStatus
,finKeyword
);
418 aStateMachine
.AddToken("private",TCF_private
,A_nBezDefStatus
,finKeyword
);
419 aStateMachine
.AddToken("template",TCF_template
,A_nBezDefStatus
,finKeyword
);
420 aStateMachine
.AddToken("virtual",TCF_virtual
,A_nBezDefStatus
,finKeyword
);
421 aStateMachine
.AddToken("friend",TCF_friend
,A_nBezDefStatus
,finKeyword
);
422 aStateMachine
.AddToken("~",TCF_Tilde
,A_nOperatorDefStatus
,finKeyword
);
423 aStateMachine
.AddToken("const",TCF_const
,A_nBezDefStatus
,finKeyword
);
424 aStateMachine
.AddToken("volatile",TCF_volatile
,A_nBezDefStatus
,finKeyword
);
425 aStateMachine
.AddToken("extern",TCF_extern
,A_nBezDefStatus
,finKeyword
);
426 aStateMachine
.AddToken("static",TCF_static
,A_nBezDefStatus
,finKeyword
);
427 aStateMachine
.AddToken("mutable",TCF_mutable
,A_nBezDefStatus
,finKeyword
);
428 aStateMachine
.AddToken("register",TCF_register
,A_nBezDefStatus
,finKeyword
);
429 aStateMachine
.AddToken("inline",TCF_inline
,A_nBezDefStatus
,finKeyword
);
430 aStateMachine
.AddToken("explicit",TCF_explicit
,A_nBezDefStatus
,finKeyword
);
431 aStateMachine
.AddToken("namespace",TCF_namespace
,A_nBezDefStatus
,finKeyword
);
432 aStateMachine
.AddToken("using",TCF_using
,A_nBezDefStatus
,finKeyword
);
433 aStateMachine
.AddToken("throw",TCF_throw
,A_nBezDefStatus
,finKeyword
);
434 aStateMachine
.AddToken("{",TCF_SwBracketOpen
,A_nOperatorDefStatus
,finKeyword
);
435 aStateMachine
.AddToken("}",TCF_SwBracketClose
,A_nOperatorDefStatus
,finKeyword
);
436 aStateMachine
.AddToken("[",TCF_ArBracketOpen
,A_nOperatorDefStatus
,finKeyword
);
437 aStateMachine
.AddToken("]",TCF_ArBracketClose
,A_nOperatorDefStatus
,finKeyword
);
438 aStateMachine
.AddToken("(",TCF_BracketOpen
,A_nOperatorDefStatus
,finKeyword
);
439 aStateMachine
.AddToken(")",TCF_BracketClose
,A_nOperatorDefStatus
,finKeyword
);
440 aStateMachine
.AddToken("::",TCF_DblColon
,A_nOperatorDefStatus
,finKeyword
);
441 aStateMachine
.AddToken(";",TCF_Semikolon
,A_nOperatorDefStatus
,finKeyword
);
442 aStateMachine
.AddToken(",",TCF_Komma
,A_nOperatorDefStatus
,finKeyword
);
443 aStateMachine
.AddToken(":",TCF_Colon
,A_nOperatorDefStatus
,finKeyword
);
444 aStateMachine
.AddToken("=",TCF_Zuweisung
,A_nOperatorDefStatus
,finKeyword
);
445 aStateMachine
.AddToken("<",TCF_Smaller
,A_nOperatorDefStatus
,finKeyword
);
446 aStateMachine
.AddToken(">",TCF_Bigger
,A_nOperatorDefStatus
,finKeyword
);
447 aStateMachine
.AddToken("*",TCF_Stern
,A_nOperatorDefStatus
,finKeyword
);
448 aStateMachine
.AddToken("&",TCF_Ampersand
,A_nOperatorDefStatus
,finKeyword
);
449 aStateMachine
.AddToken("...",TCF_Ellipse
,A_nOperatorDefStatus
,finKeyword
);
450 aStateMachine
.AddToken("typename",TCF_typename
,A_nOperatorDefStatus
,finKeyword
);
453 aStateMachine
.AddToken("==",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
454 aStateMachine
.AddToken("!=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
455 aStateMachine
.AddToken("<=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
456 aStateMachine
.AddToken(">=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
457 aStateMachine
.AddToken("&&",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
458 aStateMachine
.AddToken("||",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
459 aStateMachine
.AddToken("!",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
460 aStateMachine
.AddToken("new",TCF_Operator
,A_nBezDefStatus
,finPunctuation
);
461 aStateMachine
.AddToken("delete",TCF_Operator
,A_nBezDefStatus
,finPunctuation
);
462 aStateMachine
.AddToken("sizeof",TCF_Operator
,A_nBezDefStatus
,finPunctuation
);
463 aStateMachine
.AddToken("typeid",TCF_Operator
,A_nBezDefStatus
,finPunctuation
);
464 aStateMachine
.AddToken("+",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
465 aStateMachine
.AddToken("-",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
466 aStateMachine
.AddToken("/",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
467 aStateMachine
.AddToken("%",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
468 aStateMachine
.AddToken("^",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
469 aStateMachine
.AddToken("|",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
470 aStateMachine
.AddToken("<<",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
471 aStateMachine
.AddToken(">>",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
472 aStateMachine
.AddToken(".",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
473 aStateMachine
.AddToken("->",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
474 aStateMachine
.AddToken("?",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
475 aStateMachine
.AddToken("+=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
476 aStateMachine
.AddToken("-=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
477 aStateMachine
.AddToken("*=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
478 aStateMachine
.AddToken("/=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
479 aStateMachine
.AddToken("%=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
480 aStateMachine
.AddToken("&=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
481 aStateMachine
.AddToken("|=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
482 aStateMachine
.AddToken("^=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
483 aStateMachine
.AddToken("<<=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
484 aStateMachine
.AddToken(">>=",TCF_Operator
,A_nOperatorDefStatus
,finPunctuation
);
487 aStateMachine
.AddToken("char", TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
488 aStateMachine
.AddToken("short", TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
489 aStateMachine
.AddToken("int", TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
490 aStateMachine
.AddToken("long", TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
491 aStateMachine
.AddToken("float", TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
492 aStateMachine
.AddToken("double",TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
493 aStateMachine
.AddToken("wchar_t",TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
494 aStateMachine
.AddToken("size_t",TCF_BuiltInType
, A_nBezDefStatus
, finBiType
);
497 aStateMachine
.AddToken("signed", TCF_TypeModifier
, A_nBezDefStatus
, finTypeModifier
);
498 aStateMachine
.AddToken("unsigned", TCF_TypeModifier
, A_nBezDefStatus
, finTypeModifier
);
501 aStateMachine
.AddToken("auto", 0, A_nBezDefStatus
, finIgnore
);
502 aStateMachine
.AddToken("_cdecl", 0, A_nBezDefStatus
, finIgnore
);
503 aStateMachine
.AddToken("__cdecl", 0, A_nBezDefStatus
, finIgnore
);
504 aStateMachine
.AddToken("__stdcall", 0, A_nBezDefStatus
, finIgnore
);
505 aStateMachine
.AddToken("__fastcall",0, A_nBezDefStatus
, finIgnore
);
506 aStateMachine
.AddToken("/**/", 0, A_nOperatorDefStatus
,finIgnore
);
509 aStateMachine
.AddToken("#", 0, A_nOperatorDefStatus
, gotoPreprocessor
);
510 aStateMachine
.AddToken("#undef",0, A_nOperatorDefStatus
, gotoPreprocessor
);
511 aStateMachine
.AddToken("#unblock-",
512 0, A_nOperatorDefStatus
, gotoUnblockMacro
);
513 aStateMachine
.AddToken("/*", 0, A_nOperatorDefStatus
, gotoComment
);
514 aStateMachine
.AddToken("//", 0, A_nOperatorDefStatus
, gotoComment
);
515 aStateMachine
.AddToken("/**", 0, A_nOperatorDefStatus
, gotoDocu
);
516 aStateMachine
.AddToken("///", 0, A_nOperatorDefStatus
, gotoDocu
);
520 aStateMachine
.AddToken("\r\n", 0, A_nOperatorDefStatus
, finEOL
);
521 aStateMachine
.AddToken("\n", 0, A_nOperatorDefStatus
, finEOL
);
522 aStateMachine
.AddToken("\r", 0, A_nOperatorDefStatus
, finEOL
);
523 // To ignore in some cases(may be only at preprocessor?), but
524 // linecount has to be incremented.
525 aStateMachine
.AddToken("\\\r\n",0, A_nOperatorDefStatus
, finEOL
);
526 aStateMachine
.AddToken("\\\n", 0, A_nOperatorDefStatus
, finEOL
);
527 aStateMachine
.AddToken("\\\r", 0, A_nOperatorDefStatus
, finEOL
);