1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 #include <precomp.h>
23 #include <adoc/cx_a_std.hxx>
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <adoc/cx_a_sub.hxx>
28 #include <x_parse.hxx>
29 #include <tools/tkpchars.hxx>
30 #include <adoc/tk_attag.hxx>
31 #include <adoc/tk_docw.hxx>
32 #include <tokens/tokdeal.hxx>
33 
34 
35 
36 namespace adoc {
37 
38 
39 const intt C_nStatusSize = 128;
40 const intt C_nCppInitialNrOfStati = 400;
41 
42 
43 const uintt nF_fin_Error = 1;
44 const uintt nF_fin_Ignore = 2;
45 const uintt nF_fin_LineStart = 3;
46 const uintt nF_fin_Eol = 4;
47 const uintt nF_fin_Eof = 5;
48 const uintt nF_fin_AnyWord = 6;
49 const uintt nF_fin_Whitespace = 7;
50 
51 const uintt nF_goto_AtTag = 20;
52 const uintt nF_goto_CheckStar = 21;
53 
TCF_DocWord(const char * text)54 DYN TextToken * TCF_DocWord(const char * text) { return new Tok_DocWord(text); }
55 
TCF_atstd_ATT(const char *)56 DYN TextToken * TCF_atstd_ATT(const char * ) { return new Tok_at_std(ary::info::atid_ATT); }
TCF_atstd_author(const char *)57 DYN TextToken * TCF_atstd_author(const char * ) { return new Tok_at_std(ary::info::atid_author); }
TCF_atstd_change(const char *)58 DYN TextToken * TCF_atstd_change(const char * ) { return new Tok_at_std(ary::info::atid_change); }
TCF_atstd_collab(const char *)59 DYN TextToken * TCF_atstd_collab(const char * ) { return new Tok_at_std(ary::info::atid_collab); }
TCF_atstd_contact(const char *)60 DYN TextToken * TCF_atstd_contact(const char * ) { return new Tok_at_std(ary::info::atid_contact); }
TCF_atstd_copyright(const char *)61 DYN TextToken * TCF_atstd_copyright(const char * ) { return new Tok_at_std(ary::info::atid_copyright); }
TCF_atstd_descr(const char *)62 DYN TextToken * TCF_atstd_descr(const char * ) { return new Tok_at_std(ary::info::atid_descr); }
TCF_atstd_docdate(const char *)63 DYN TextToken * TCF_atstd_docdate(const char * ) { return new Tok_at_std(ary::info::atid_docdate); }
TCF_atstd_derive(const char *)64 DYN TextToken * TCF_atstd_derive(const char * ) { return new Tok_at_std(ary::info::atid_derive); }
TCF_atstd_instance(const char *)65 DYN TextToken * TCF_atstd_instance(const char * ) { return new Tok_at_std(ary::info::atid_instance); }
TCF_atstd_life(const char *)66 DYN TextToken * TCF_atstd_life(const char * ) { return new Tok_at_std(ary::info::atid_life); }
TCF_atstd_multi(const char *)67 DYN TextToken * TCF_atstd_multi(const char * ) { return new Tok_at_std(ary::info::atid_multi); }
TCF_atstd_onerror(const char *)68 DYN TextToken * TCF_atstd_onerror(const char * ) { return new Tok_at_std(ary::info::atid_onerror); }
TCF_atstd_persist(const char *)69 DYN TextToken * TCF_atstd_persist(const char * ) { return new Tok_at_std(ary::info::atid_persist); }
TCF_atstd_postcond(const char *)70 DYN TextToken * TCF_atstd_postcond(const char * ) { return new Tok_at_std(ary::info::atid_postcond); }
TCF_atstd_precond(const char *)71 DYN TextToken * TCF_atstd_precond(const char * ) { return new Tok_at_std(ary::info::atid_precond); }
TCF_atstd_responsibility(const char *)72 DYN TextToken * TCF_atstd_responsibility(const char * ) { return new Tok_at_std(ary::info::atid_resp); }
TCF_atstd_return(const char *)73 DYN TextToken * TCF_atstd_return(const char * ) { return new Tok_at_std(ary::info::atid_return); }
TCF_atstd_short(const char *)74 DYN TextToken * TCF_atstd_short(const char * ) { return new Tok_at_std(ary::info::atid_short); }
TCF_atstd_todo(const char *)75 DYN TextToken * TCF_atstd_todo(const char * ) { return new Tok_at_std(ary::info::atid_todo); }
TCF_atstd_version(const char *)76 DYN TextToken * TCF_atstd_version(const char * ) { return new Tok_at_std(ary::info::atid_version); }
77 
TCF_at_base(const char *)78 DYN TextToken * TCF_at_base(const char *) { return new Tok_at_base; }
TCF_at_exception(const char *)79 DYN TextToken * TCF_at_exception(const char *) { return new Tok_at_exception; }
TCF_at_impl(const char *)80 DYN TextToken * TCF_at_impl(const char *) { return new Tok_at_impl; }
TCF_at_interface(const char *)81 DYN TextToken * TCF_at_interface(const char *) { return new Tok_at_interface; }
TCF_at_key(const char *)82 DYN TextToken * TCF_at_key(const char *) { return new Tok_at_key; }
TCF_at_param(const char *)83 DYN TextToken * TCF_at_param(const char *) { return new Tok_at_param; }
TCF_at_see(const char *)84 DYN TextToken * TCF_at_see(const char *) { return new Tok_at_see; }
TCF_at_template(const char *)85 DYN TextToken * TCF_at_template(const char *) { return new Tok_at_template; }
TCF_at_internal(const char *)86 DYN TextToken * TCF_at_internal(const char *) { return new Tok_at_internal; }
TCF_at_obsolete(const char *)87 DYN TextToken * TCF_at_obsolete(const char *) { return new Tok_at_obsolete; }
TCF_at_module(const char *)88 DYN TextToken * TCF_at_module(const char *) { return new Tok_at_module; }
TCF_at_file(const char *)89 DYN TextToken * TCF_at_file(const char *) { return new Tok_at_file; }
TCF_at_gloss(const char *)90 DYN TextToken * TCF_at_gloss(const char *) { return new Tok_at_gloss; }
TCF_at_global(const char *)91 DYN TextToken * TCF_at_global(const char *) { return new Tok_at_global; }
TCF_at_include(const char *)92 DYN TextToken * TCF_at_include(const char *) { return new Tok_at_include; }
TCF_at_label(const char *)93 DYN TextToken * TCF_at_label(const char *) { return new Tok_at_label; }
TCF_at_since(const char *)94 DYN TextToken * TCF_at_since(const char *) { return new Tok_at_since; }
TCF_at_HTML(const char *)95 DYN TextToken * TCF_at_HTML(const char *) { return new Tok_at_HTML; }
TCF_at_NOHTML(const char *)96 DYN TextToken * TCF_at_NOHTML(const char *) { return new Tok_at_NOHTML; }
97 DYN TextToken * TCF_Whitespace(const char * i_sText);
TCF_EoDocu(const char *)98 DYN TextToken * TCF_EoDocu(const char *) { return new Tok_EoDocu; }
TCF_EoLine(const char *)99 DYN TextToken * TCF_EoLine(const char *) { return new Tok_Eol; }
TCF_Eof(const char *)100 DYN TextToken * TCF_Eof(const char *) { return new Tok_Eof; }
101 
102 
103 
104 
Context_AdocStd()105 Context_AdocStd::Context_AdocStd()
106 	:	aStateMachine(C_nStatusSize, C_nCppInitialNrOfStati),
107 		pDealer(0),
108 		pParentContext(0),
109 		pFollowUpContext(0),
110 		pCx_LineStart(0),
111 		pCx_CheckStar(0),
112 		pCx_AtTagCompletion(0),
113 		pNewToken(0),
114 		bIsMultiline(false)
115 {
116 	pCx_LineStart = new Cx_LineStart(*this);
117 	pCx_CheckStar = new Cx_CheckStar(*this);
118 	pCx_AtTagCompletion = new Cx_AtTagCompletion(*this);
119 
120 	SetupStateMachine();
121 }
122 
123 void
SetParentContext(TkpContext & io_rParentContext,const char *)124 Context_AdocStd::SetParentContext( TkpContext & io_rParentContext,
125 								   const char * )
126 {
127 	pFollowUpContext = pParentContext = &io_rParentContext;
128 	pCx_CheckStar->Set_End_FollowUpContext(io_rParentContext);
129 }
130 
~Context_AdocStd()131 Context_AdocStd::~Context_AdocStd()
132 {
133 }
134 
135 void
AssignDealer(TokenDealer & o_rDealer)136 Context_AdocStd::AssignDealer( TokenDealer & o_rDealer )
137 {
138     pDealer = &o_rDealer;
139 	pCx_LineStart->AssignDealer(o_rDealer);
140 	pCx_CheckStar->AssignDealer(o_rDealer);
141 	pCx_AtTagCompletion->AssignDealer(o_rDealer);
142 }
143 
144 void
ReadCharChain(CharacterSource & io_rText)145 Context_AdocStd::ReadCharChain( CharacterSource & io_rText )
146 {
147 	csv_assert(pParentContext != 0);
148 	pNewToken = 0;
149 
150 	TextToken::F_CRTOK  fTokenCreateFunction = 0;
151 	StmBoundsStatus & rBound = aStateMachine.GetCharChain(fTokenCreateFunction, io_rText);
152 
153 	// !!!
154 	// 	 The order of the next two lines is essential, because
155 	//   pFollowUpContext may be changed by PerformStatusFunction() also,
156 	//   which then MUST override the previous assignment.
157 	pFollowUpContext = rBound.FollowUpContext();
158 	PerformStatusFunction(rBound.StatusFunctionNr(), fTokenCreateFunction, io_rText);
159 }
160 
161 bool
PassNewToken()162 Context_AdocStd::PassNewToken()
163 {
164 	if (pNewToken)
165 	{
166 		pNewToken.Release()->DealOut(*pDealer);
167 		return true;
168 	}
169 	return false;
170 }
171 
172 TkpContext &
FollowUpContext()173 Context_AdocStd::FollowUpContext()
174 {
175 	csv_assert(pFollowUpContext != 0);
176 	return *pFollowUpContext;
177 }
178 
179 void
PerformStatusFunction(uintt i_nStatusSignal,F_CRTOK i_fTokenCreateFunction,CharacterSource & io_rText)180 Context_AdocStd::PerformStatusFunction( uintt				i_nStatusSignal,
181 										F_CRTOK		        i_fTokenCreateFunction,
182 										CharacterSource &	io_rText )
183 {
184 	switch (i_nStatusSignal)
185 	{
186 		case nF_fin_Error:
187         {
188             char cCC = io_rText.CurChar();
189             String sChar( &cCC, 1 );
190 			throw X_Parser(X_Parser::x_InvalidChar, sChar, String ::Null_(), 0);
191 		}	// no break, because of throw
192 		case nF_fin_Ignore:
193 			io_rText.CutToken();
194 			pNewToken = 0;
195 			break;
196 		case nF_fin_LineStart:
197 			csv_assert(i_fTokenCreateFunction != 0);
198 			pNewToken = (*i_fTokenCreateFunction)(io_rText.CutToken());
199 			break;
200 		case nF_fin_Eol:
201 			io_rText.CutToken();
202 			pDealer->Deal_Eol();
203 			if ( bIsMultiline )
204 			{
205 				pNewToken = TCF_EoLine(0);
206 				pFollowUpContext = pCx_LineStart.Ptr();
207 			}
208 			else
209 			{
210 				pNewToken = TCF_EoDocu(0);
211 				pFollowUpContext = pParentContext;
212 			}
213 			break;
214 		case nF_fin_Eof:
215 			pNewToken = TCF_Eof(0);
216 			break;
217 		case nF_fin_AnyWord:
218 			if (i_fTokenCreateFunction != 0)
219 				pNewToken = (*i_fTokenCreateFunction)(io_rText.CutToken());
220 			else
221 				pNewToken = TCF_DocWord(io_rText.CutToken());
222 			break;
223         case nF_fin_Whitespace:
224 			pNewToken = TCF_Whitespace(io_rText.CutToken());
225             break;
226 		case nF_goto_AtTag:
227 			pNewToken = 0;
228 			pCx_AtTagCompletion->SetCurToken(i_fTokenCreateFunction);
229 			break;
230 		case nF_goto_CheckStar:
231 			pNewToken = 0;
232 			pCx_CheckStar->SetCanBeEnd( bIsMultiline );
233 			break;
234 		default:
235         {
236             char cCC = io_rText.CurChar();
237             String  sChar( &cCC, 1 );
238 			throw X_Parser(X_Parser::x_InvalidChar, sChar, String::Null_(), 0);
239         }
240 	}	// end switch (i_nStatusSignal)
241 }
242 
243 void
SetupStateMachine()244 Context_AdocStd::SetupStateMachine()
245 {
246 	// Besondere Array-Stati (kein Tokenabschluss oder Kontextwechsel):
247 //	const INT16	bas = 0;		// Base-Status
248 	const INT16	wht = 1;		// Whitespace-Status
249 	const INT16	awd = 2;        // Any-Word-Read-Status
250 
251 	// Kontextwechsel-Stati:
252 	const INT16	goto_CheckStar = 3;
253 	const INT16 goto_AtTag = 4;
254 
255 	// Tokenfinish-Stati:
256 	const INT16 finError = 5;
257 //	const INT16 finIgnore = 6;
258 	const INT16 finEol = 7;
259 	const INT16 finEof = 8;
260 	const INT16 finAnyWord = 9;
261     const INT16 finWhitespace = 10;
262 
263 	// Konstanten zur Benutzung in der Tabelle:
264 	const INT16 fof = finEof;
265 	const INT16 err = finError;
266 	const INT16 faw = finAnyWord;
267 //	const INT16 fig = finIgnore;
268 	const INT16 fwh = finWhitespace;
269 
270 	/// The '0's  will be replaced by calls of AddToken().
271 
272 	const INT16 A_nTopStatus[C_nStatusSize] =
273 	//  0	1	2	3	4	5	6	7	8	9  10  11  12  13  14  15
274 	{fof,err,err,err,err,err,err,err,err,wht,  0,wht,wht,  0,err,err,
275 	 err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31
276 	 wht,awd,awd,awd,awd,awd,awd,awd,awd,awd,  0,awd,awd,awd,awd,awd,
277 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63
278 	   0,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,
279 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95
280 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,
281 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd  // ... 127
282 	};
283 
284 	const INT16 A_nWhitespaceStatus[C_nStatusSize] =
285 	// 	0	1	2	3	4	5	6	7	8	9  10  11  12  13  14  15
286 	{fof,err,err,err,err,err,err,err,err,wht,fwh,wht,wht,fwh,err,err,
287 	 err,err,err,err,err,err,err,err,err,err,fof,err,err,err,err,err, // ... 31
288 	 wht,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,
289 	 fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 63
290 	 fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,
291 	 fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh, // ... 95
292 	 fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,
293 	 fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh,fwh  // ... 127
294 	};
295 
296 	const INT16 A_nWordStatus[C_nStatusSize] =
297 	// 	0	1	2	3	4	5	6	7	8	9  10  11  12  13  14  15
298 	{faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err,
299 	 err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31
300 	 faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd,
301 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63
302 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,
303 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95
304 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,
305 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd  // ... 127
306 	};
307 
308 	const INT16 A_nAtTagDefStatus[C_nStatusSize] =
309 	// 	0	1	2	3	4	5	6	7	8	9  10  11  12  13  14  15
310 	{faw,err,err,err,err,err,err,err,err,faw,faw,faw,faw,faw,err,err,
311 	 err,err,err,err,err,err,err,err,err,err,faw,err,err,err,err,err, // ... 31
312 	 faw,awd,awd,awd,awd,awd,awd,awd,awd,awd,faw,awd,awd,awd,awd,awd,
313 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 63
314 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,
315 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd, // ... 95
316 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,
317 	 awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd,awd  // ... 127
318 	};
319 
320 	const INT16 A_nPunctDefStatus[C_nStatusSize] =
321 	// 	0	1	2	3	4	5	6	7	8	9  10  11  12  13  14  15
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, // 16 ...
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, // 48 ...
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, // 80 ...
328 	 err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,
329 	 err,err,err,err,err,err,err,err,err,err,err,err,err,err,err,err  // 112 ...
330 	};
331 
332 	DYN StmArrayStatus * dpStatusTop
333 			= new StmArrayStatus( C_nStatusSize, A_nTopStatus, 0, true);
334 	DYN StmArrayStatus * dpStatusWhite
335 			= new StmArrayStatus( C_nStatusSize, A_nWhitespaceStatus, 0, true);
336 	DYN StmArrayStatus * dpStatusWord
337 			= new StmArrayStatus( C_nStatusSize, A_nWordStatus, TCF_DocWord, true);
338 
339 	DYN StmBoundsStatus *  	dpBst_goto_CheckStar
340 			= new StmBoundsStatus( *this, *pCx_CheckStar, nF_goto_CheckStar, true );
341 	DYN StmBoundsStatus *  	dpBst_goto_AtTag
342 			= new StmBoundsStatus( *this, *pCx_AtTagCompletion, nF_goto_AtTag, true );
343 
344 	DYN StmBoundsStatus *  	dpBst_finError
345 			= new StmBoundsStatus( *this, TkpContext::Null_(), nF_fin_Error, true );
346 	DYN StmBoundsStatus *  	dpBst_finIgnore
347 			= new StmBoundsStatus( *this, *this, nF_fin_Ignore, true);
348 	DYN StmBoundsStatus *  	dpBst_finEol
349 			= new StmBoundsStatus( *this, *pCx_LineStart, nF_fin_Eol, false);
350 	DYN StmBoundsStatus *  	dpBst_finEof
351 			= new StmBoundsStatus(  *this, TkpContext::Null_(), nF_fin_Eof, false);
352 	DYN StmBoundsStatus *  	dpBst_finAnyWord
353 			= new StmBoundsStatus( *this, *this, nF_fin_AnyWord, true);
354 	DYN StmBoundsStatus *  	dpBst_finWhitespace
355 			= new StmBoundsStatus( *this, *this, nF_fin_Whitespace, true);
356 
357 	// dpMain aufbauen:
358 	aStateMachine.AddStatus(dpStatusTop);
359 	aStateMachine.AddStatus(dpStatusWhite);
360 	aStateMachine.AddStatus(dpStatusWord);
361 
362 	aStateMachine.AddStatus(dpBst_goto_CheckStar);
363 	aStateMachine.AddStatus(dpBst_goto_AtTag);
364 
365 	aStateMachine.AddStatus(dpBst_finError);
366 	aStateMachine.AddStatus(dpBst_finIgnore);
367 	aStateMachine.AddStatus(dpBst_finEol);
368 	aStateMachine.AddStatus(dpBst_finEof);
369 	aStateMachine.AddStatus(dpBst_finAnyWord);
370 	aStateMachine.AddStatus(dpBst_finWhitespace);
371 
372 	aStateMachine.AddToken( "*",		0,	  	            A_nPunctDefStatus, goto_CheckStar );
373 	aStateMachine.AddToken( "@ATT",		TCF_atstd_ATT,	  	A_nAtTagDefStatus, goto_AtTag );
374 	aStateMachine.AddToken( "@att",		TCF_atstd_ATT,	  	A_nAtTagDefStatus, goto_AtTag );
375 	aStateMachine.AddToken( "@ATTENTION",
376                                 		TCF_atstd_ATT,	  	A_nAtTagDefStatus, goto_AtTag );
377 	aStateMachine.AddToken( "@attention",
378                                 		TCF_atstd_ATT,	  	A_nAtTagDefStatus, goto_AtTag );
379 	aStateMachine.AddToken( "@author",  TCF_atstd_author, 	A_nAtTagDefStatus, goto_AtTag );
380 	aStateMachine.AddToken( "@change",  TCF_atstd_change, 	A_nAtTagDefStatus, goto_AtTag );
381 	aStateMachine.AddToken( "@collab",  TCF_atstd_collab, 	A_nAtTagDefStatus, goto_AtTag );
382 	aStateMachine.AddToken( "@collaborator",
383                                         TCF_atstd_collab, 	A_nAtTagDefStatus, goto_AtTag );
384 	aStateMachine.AddToken( "@contact", TCF_atstd_contact, 	A_nAtTagDefStatus, goto_AtTag );
385 	aStateMachine.AddToken( "@copyright",TCF_atstd_copyright, A_nAtTagDefStatus, goto_AtTag );
386 	aStateMachine.AddToken( "@descr", 	TCF_atstd_descr,  	A_nAtTagDefStatus, goto_AtTag );
387 	aStateMachine.AddToken( "@docdate",	TCF_atstd_docdate,  A_nAtTagDefStatus, goto_AtTag );
388 	aStateMachine.AddToken( "@derive", 	TCF_atstd_derive,   A_nAtTagDefStatus, goto_AtTag );
389 	aStateMachine.AddToken( "@instance",TCF_atstd_instance, A_nAtTagDefStatus, goto_AtTag );
390 	aStateMachine.AddToken( "@life", 	TCF_atstd_life,     A_nAtTagDefStatus, goto_AtTag );
391 	aStateMachine.AddToken( "@lifecycle",
392                                         TCF_atstd_life,     A_nAtTagDefStatus, goto_AtTag );
393 	aStateMachine.AddToken( "@multi",	TCF_atstd_multi,    A_nAtTagDefStatus, goto_AtTag );
394 	aStateMachine.AddToken( "@multiplicity",
395                                         TCF_atstd_multi,    A_nAtTagDefStatus, goto_AtTag );
396 	aStateMachine.AddToken( "@onerror",	TCF_atstd_onerror,  A_nAtTagDefStatus, goto_AtTag );
397 	aStateMachine.AddToken( "@persist",	TCF_atstd_persist,  A_nAtTagDefStatus, goto_AtTag );
398 	aStateMachine.AddToken( "@postcond",TCF_atstd_postcond,A_nAtTagDefStatus, goto_AtTag );
399 	aStateMachine.AddToken( "@precond",	TCF_atstd_precond,  A_nAtTagDefStatus, goto_AtTag );
400 	aStateMachine.AddToken( "@resp",	TCF_atstd_responsibility,
401                                                             A_nAtTagDefStatus, goto_AtTag );
402 	aStateMachine.AddToken( "@responsibility",
403                                         TCF_atstd_return,   A_nAtTagDefStatus, goto_AtTag );
404 	aStateMachine.AddToken( "@return",	TCF_atstd_return,   A_nAtTagDefStatus, goto_AtTag );
405 	aStateMachine.AddToken( "@short",	TCF_atstd_short,    A_nAtTagDefStatus, goto_AtTag );
406 	aStateMachine.AddToken( "@todo",	TCF_atstd_todo,     A_nAtTagDefStatus, goto_AtTag );
407 	aStateMachine.AddToken( "@version",	TCF_atstd_version, 	A_nAtTagDefStatus, goto_AtTag );
408 
409 	aStateMachine.AddToken( "@base",	TCF_at_base,       	A_nAtTagDefStatus, goto_AtTag );
410 	aStateMachine.AddToken( "@exception",TCF_at_exception, 	A_nAtTagDefStatus, goto_AtTag );
411 	aStateMachine.AddToken( "@impl",	TCF_at_impl,       	A_nAtTagDefStatus, goto_AtTag );
412 	aStateMachine.AddToken( "@key",	    TCF_at_key,        	A_nAtTagDefStatus, goto_AtTag );
413 	aStateMachine.AddToken( "@param",	TCF_at_param,   	A_nAtTagDefStatus, goto_AtTag );
414 	aStateMachine.AddToken( "@see",	    TCF_at_see,   		A_nAtTagDefStatus, goto_AtTag );
415 	aStateMachine.AddToken( "@seealso", TCF_at_see,   		A_nAtTagDefStatus, goto_AtTag );
416 	aStateMachine.AddToken( "@since",	TCF_at_since,   	A_nAtTagDefStatus, goto_AtTag );
417 	aStateMachine.AddToken( "@tpl",	    TCF_at_template,   	A_nAtTagDefStatus, goto_AtTag );
418 	aStateMachine.AddToken( "@tplparam",
419                                         TCF_at_template,   	A_nAtTagDefStatus, goto_AtTag );
420 
421 	aStateMachine.AddToken( "@interface",TCF_at_interface,  A_nAtTagDefStatus, goto_AtTag );
422 	aStateMachine.AddToken( "@internal",TCF_at_internal,   	A_nAtTagDefStatus, goto_AtTag );
423 	aStateMachine.AddToken( "@obsolete",TCF_at_obsolete,   	A_nAtTagDefStatus, goto_AtTag );
424 	aStateMachine.AddToken( "@deprecated",TCF_at_obsolete, 	A_nAtTagDefStatus, goto_AtTag );
425 
426 	aStateMachine.AddToken( "@module",	TCF_at_module,   	A_nAtTagDefStatus, goto_AtTag );
427 	aStateMachine.AddToken( "@file",	TCF_at_file,   		A_nAtTagDefStatus, goto_AtTag );
428 	aStateMachine.AddToken( "@gloss",	TCF_at_gloss,   	A_nAtTagDefStatus, goto_AtTag );
429 	aStateMachine.AddToken( "@global#",	TCF_at_global,   	A_nAtTagDefStatus, goto_AtTag );
430 	aStateMachine.AddToken( "@include#",TCF_at_include,   	A_nAtTagDefStatus, goto_AtTag );
431 	aStateMachine.AddToken( "@#",	   	TCF_at_label,   	A_nAtTagDefStatus, goto_AtTag );
432 
433 	aStateMachine.AddToken( "@HTML",	TCF_at_HTML,   	    A_nAtTagDefStatus, goto_AtTag );
434 	aStateMachine.AddToken( "@NOHTML",	TCF_at_NOHTML,   	A_nAtTagDefStatus, goto_AtTag );
435 
436 	aStateMachine.AddToken( "\r\n",	    0,         			A_nPunctDefStatus, finEol );
437 	aStateMachine.AddToken( "\n",       0,           		A_nPunctDefStatus, finEol );
438 	aStateMachine.AddToken( "\r",       0,           		A_nPunctDefStatus, finEol );
439 };
440 
441 void
SetMode_IsMultiLine(bool i_bTrue)442 Context_AdocStd::SetMode_IsMultiLine( bool	i_bTrue )
443 {
444 	bIsMultiline = i_bTrue;
445 }
446 
447 DYN TextToken *
TCF_Whitespace(const char * i_sText)448 TCF_Whitespace(const char * i_sText)
449 {
450     UINT8 nSize = static_cast<UINT8>(strlen(i_sText));
451     for ( const char * pTab = strchr(i_sText,'\t');
452           pTab != 0;
453           pTab = strchr(pTab+1,'\t') )
454     {
455      	nSize += 3;
456     }
457 
458     return new Tok_Whitespace(nSize);
459 }
460 
461 
462 }   // namespace adoc
463 
464 
465 /*
466 @ATT[ENTION]
467 @author
468 @change[s]
469 @collab[orators]
470 @contact
471 @copyright
472 @descr
473 @devstat[e]
474 @docdate
475 @derive
476 @instance
477 @life[cycle]
478 @multi[plicity]
479 @onerror
480 @persist[ence]
481 @postcond
482 @precond
483 @return
484 @short
485 @todo
486 
487 @module
488 @file
489 @gloss[ary]
490 
491 
492 @base <BasisklassenName>
493 @exception <ExceptionName>
494 @impl[ements] <IDL-Construct>
495 @key[words]|[s]
496 @param <FunctionParameterName> [<Range of valid values>]
497 @see[also]
498 @templ[ate] <FormalTemplateParameterName>
499 
500 @internal
501 @obsolete
502 
503 @#<Label>
504 
505 @global#<Label> Global comment.
506 @include#<Label>
507 
508 
509 */
510 
511