1 | //-----------------------------------------------------------
|
---|
2 | // Copyright Christian Arnault LAL-Orsay CNRS
|
---|
3 | // arnault@lal.in2p3.fr
|
---|
4 | // Modified by garonne@lal.in2p3.fr
|
---|
5 | // See the complete license in cmt_license.txt "http://www.cecill.info".
|
---|
6 | //-----------------------------------------------------------
|
---|
7 |
|
---|
8 | #include "cmt_syntax.h"
|
---|
9 | #include "cmt.h"
|
---|
10 | #include "cmt_symbol.h"
|
---|
11 | #include "cmt_constituent.h"
|
---|
12 | #include "cmt_pattern.h"
|
---|
13 | #include "cmt_error.h"
|
---|
14 | #include "cmt_branch.h"
|
---|
15 | #include "cmt_error.h"
|
---|
16 | #include "cmt_script.h"
|
---|
17 | #include "cmt_language.h"
|
---|
18 | #include "cmt_project.h"
|
---|
19 | #include "cmt_cmtpath_pattern.h"
|
---|
20 |
|
---|
21 |
|
---|
22 | class KwdAction : public Kwd
|
---|
23 | {
|
---|
24 | public:
|
---|
25 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
26 | Use* use,
|
---|
27 | const cmt_string& file_name,
|
---|
28 | int line_number)
|
---|
29 | {
|
---|
30 | Symbol::action (words, CommandAction, use);
|
---|
31 | }
|
---|
32 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
33 | Project* project,
|
---|
34 | const cmt_string& file_name,
|
---|
35 | int line_number)
|
---|
36 | {}
|
---|
37 | };
|
---|
38 |
|
---|
39 | class KwdAlias : public Kwd
|
---|
40 | {
|
---|
41 | public:
|
---|
42 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
43 | Use* use,
|
---|
44 | const cmt_string& file_name,
|
---|
45 | int line_number)
|
---|
46 | {
|
---|
47 | Symbol::action (words, CommandAlias, use);
|
---|
48 | }
|
---|
49 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
50 | Project* project,
|
---|
51 | const cmt_string& file_name,
|
---|
52 | int line_number)
|
---|
53 | {}
|
---|
54 |
|
---|
55 | };
|
---|
56 |
|
---|
57 | class KwdApplication : public Kwd
|
---|
58 | {
|
---|
59 | public:
|
---|
60 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
61 | Use* use,
|
---|
62 | const cmt_string& file_name,
|
---|
63 | int line_number)
|
---|
64 | {
|
---|
65 | if (use == &(Use::current ()))
|
---|
66 | {
|
---|
67 | Constituent::action (Application, words);
|
---|
68 | }
|
---|
69 | }
|
---|
70 |
|
---|
71 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
72 | Project* project,
|
---|
73 | const cmt_string& file_name,
|
---|
74 | int line_number)
|
---|
75 | {}
|
---|
76 |
|
---|
77 | };
|
---|
78 |
|
---|
79 | class KwdApplyPattern : public Kwd
|
---|
80 | {
|
---|
81 | public:
|
---|
82 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
83 | Use* use,
|
---|
84 | const cmt_string& file_name,
|
---|
85 | int line_number)
|
---|
86 | {
|
---|
87 | ApplyPattern::action (words, use);
|
---|
88 | }
|
---|
89 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
90 | Project* project,
|
---|
91 | const cmt_string& file_name,
|
---|
92 | int line_number)
|
---|
93 | {}
|
---|
94 |
|
---|
95 | };
|
---|
96 |
|
---|
97 | class KwdApplyTag : public Kwd
|
---|
98 | {
|
---|
99 | public:
|
---|
100 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
101 | Use* use,
|
---|
102 | const cmt_string& file_name,
|
---|
103 | int line_number)
|
---|
104 | {
|
---|
105 | Tag::action_apply (words, use);
|
---|
106 | }
|
---|
107 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
108 | Project* project,
|
---|
109 | const cmt_string& file_name,
|
---|
110 | int line_number)
|
---|
111 | {
|
---|
112 | action (words, project->m_use, file_name, line_number);
|
---|
113 | }
|
---|
114 |
|
---|
115 | };
|
---|
116 |
|
---|
117 | //----------------------------------------------------------
|
---|
118 | class KwdAuthor : public Kwd
|
---|
119 | {
|
---|
120 | public:
|
---|
121 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
122 | Use* use,
|
---|
123 | const cmt_string& file_name,
|
---|
124 | int line_number)
|
---|
125 | {
|
---|
126 | use->author_action (words);
|
---|
127 |
|
---|
128 | }
|
---|
129 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
130 | Project* project,
|
---|
131 | const cmt_string& file_name,
|
---|
132 | int line_number)
|
---|
133 | {
|
---|
134 | cmt_string author;
|
---|
135 | project->project_author_action (words);
|
---|
136 | }
|
---|
137 | };
|
---|
138 | //----------------------------------------------------------
|
---|
139 |
|
---|
140 |
|
---|
141 | class KwdBranches : public Kwd
|
---|
142 | {
|
---|
143 | public:
|
---|
144 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
145 | Use* use,
|
---|
146 | const cmt_string& file_name,
|
---|
147 | int line_number)
|
---|
148 | {
|
---|
149 | if (use == &(Use::current ()))
|
---|
150 | {
|
---|
151 | Branch::action (words);
|
---|
152 | }
|
---|
153 | }
|
---|
154 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
155 | Project* project,
|
---|
156 | const cmt_string& file_name,
|
---|
157 | int line_number)
|
---|
158 | {}
|
---|
159 |
|
---|
160 | };
|
---|
161 |
|
---|
162 | class KwdBuildStrategy : public Kwd
|
---|
163 | {
|
---|
164 | public:
|
---|
165 | bool decode (const cmt_string& w, cmt_string& strategy, cmt_string& value)
|
---|
166 | {
|
---|
167 | bool result = true;
|
---|
168 |
|
---|
169 | value = w;
|
---|
170 | Symbol::expand(value);
|
---|
171 |
|
---|
172 |
|
---|
173 | if (value == "prototypes")
|
---|
174 | {
|
---|
175 | strategy = "BuildPrototypes";
|
---|
176 | }
|
---|
177 | else if (value == "no_prototypes")
|
---|
178 | {
|
---|
179 | strategy = "BuildPrototypes";
|
---|
180 | }
|
---|
181 | else if ((value == "with_installarea") || (value == "with_install_area"))
|
---|
182 | {
|
---|
183 | value = "with_installarea";
|
---|
184 | strategy = "InstallArea";
|
---|
185 | }
|
---|
186 | else if ((value == "without_installarea") || (value == "without_install_area"))
|
---|
187 | {
|
---|
188 | value = "without_installarea";
|
---|
189 | strategy = "InstallArea";
|
---|
190 | }
|
---|
191 | else
|
---|
192 | {
|
---|
193 | result = false;
|
---|
194 | }
|
---|
195 |
|
---|
196 | return (result);
|
---|
197 | }
|
---|
198 |
|
---|
199 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
200 | Use* use,
|
---|
201 | const cmt_string& file_name,
|
---|
202 | int line_number)
|
---|
203 | {
|
---|
204 | cmt_string cmtpath;
|
---|
205 | cmt_string offset;
|
---|
206 |
|
---|
207 | use->get_cmtpath_and_offset (cmtpath, offset);
|
---|
208 |
|
---|
209 | Project* p = Project::find_by_cmtpath (cmtpath);
|
---|
210 |
|
---|
211 | for (int i = 1; i < words.size (); i++)
|
---|
212 | {
|
---|
213 | const cmt_string& w = words[i];
|
---|
214 |
|
---|
215 | cmt_string strategy;
|
---|
216 | cmt_string value;
|
---|
217 |
|
---|
218 | bool in_error = false;
|
---|
219 |
|
---|
220 | if (decode (w, strategy, value))
|
---|
221 | {
|
---|
222 | if (p != 0) p->set_strategy (strategy, value, use->get_package_name ());
|
---|
223 | }
|
---|
224 | else
|
---|
225 | {
|
---|
226 | in_error = true;
|
---|
227 |
|
---|
228 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
|
---|
229 | }
|
---|
230 | }
|
---|
231 | }
|
---|
232 |
|
---|
233 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
234 | Project* project,
|
---|
235 | const cmt_string& file_name,
|
---|
236 | int line_number)
|
---|
237 | {
|
---|
238 | for (int i = 1; i < words.size (); i++)
|
---|
239 | {
|
---|
240 | const cmt_string& w = words[i];
|
---|
241 |
|
---|
242 | cmt_string strategy;
|
---|
243 | cmt_string value;
|
---|
244 |
|
---|
245 | bool in_error = false;
|
---|
246 |
|
---|
247 | if (decode (w, strategy, value))
|
---|
248 | {
|
---|
249 | if (project != 0) project->set_strategy (strategy, value, "");
|
---|
250 | }
|
---|
251 | else
|
---|
252 | {
|
---|
253 | in_error = true;
|
---|
254 |
|
---|
255 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
|
---|
256 | }
|
---|
257 | }
|
---|
258 | }
|
---|
259 | };
|
---|
260 |
|
---|
261 | class KwdCleanupScript : public Kwd
|
---|
262 | {
|
---|
263 | public:
|
---|
264 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
265 | Use* use,
|
---|
266 | const cmt_string& file_name,
|
---|
267 | int line_number)
|
---|
268 | {
|
---|
269 | Script::action (words, CleanupScript, use);
|
---|
270 | Symbol::action (words, CommandCleanupScript, use);
|
---|
271 | }
|
---|
272 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
273 | Project* project,
|
---|
274 | const cmt_string& file_name,
|
---|
275 | int line_number)
|
---|
276 | {}
|
---|
277 | };
|
---|
278 |
|
---|
279 | class KwdCmtPathPattern : public Kwd
|
---|
280 | {
|
---|
281 | public:
|
---|
282 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
283 | Use* use,
|
---|
284 | const cmt_string& /*file_name*/,
|
---|
285 | int /*line_number*/)
|
---|
286 | {
|
---|
287 | CmtPathPattern::action (words, use);
|
---|
288 | }
|
---|
289 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
290 | Project* project,
|
---|
291 | const cmt_string& file_name,
|
---|
292 | int line_number)
|
---|
293 | {}
|
---|
294 |
|
---|
295 | };
|
---|
296 |
|
---|
297 | class KwdCmtPathPatternRevert : public Kwd
|
---|
298 | {
|
---|
299 | public:
|
---|
300 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
301 | Use* use,
|
---|
302 | const cmt_string& /*file_name*/,
|
---|
303 | int /*line_number*/)
|
---|
304 | {
|
---|
305 | CmtPathPattern::action (words, use, true);
|
---|
306 | }
|
---|
307 |
|
---|
308 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
309 | Project* project,
|
---|
310 | const cmt_string& file_name,
|
---|
311 | int line_number)
|
---|
312 | {}
|
---|
313 | };
|
---|
314 |
|
---|
315 | class KwdContainer : public Kwd
|
---|
316 | {
|
---|
317 | public:
|
---|
318 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
319 | Use* use,
|
---|
320 | const cmt_string& file_name,
|
---|
321 | int line_number)
|
---|
322 | {
|
---|
323 | }
|
---|
324 |
|
---|
325 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
326 | Project* project,
|
---|
327 | const cmt_string& file_name,
|
---|
328 | int line_number)
|
---|
329 | {
|
---|
330 | project->container_action (words[1], words[2]);
|
---|
331 | }
|
---|
332 | };
|
---|
333 |
|
---|
334 | class KwdDocument : public Kwd
|
---|
335 | {
|
---|
336 | public:
|
---|
337 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
338 | Use* use,
|
---|
339 | const cmt_string& file_name,
|
---|
340 | int line_number)
|
---|
341 | {
|
---|
342 | if (use == &(Use::current ()))
|
---|
343 | {
|
---|
344 | Constituent::action (Document, words);
|
---|
345 | }
|
---|
346 | }
|
---|
347 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
348 | Project* project,
|
---|
349 | const cmt_string& file_name,
|
---|
350 | int line_number)
|
---|
351 | {}
|
---|
352 |
|
---|
353 | };
|
---|
354 |
|
---|
355 | class KwdEndPrivate : public Kwd
|
---|
356 | {
|
---|
357 | public:
|
---|
358 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
359 | Use* use,
|
---|
360 | const cmt_string& file_name,
|
---|
361 | int line_number)
|
---|
362 | {
|
---|
363 | if (use != &(Use::current ()))
|
---|
364 | {
|
---|
365 | use->pop_scope_section ();
|
---|
366 | }
|
---|
367 | }
|
---|
368 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
369 | Project* project,
|
---|
370 | const cmt_string& file_name,
|
---|
371 | int line_number)
|
---|
372 | {}
|
---|
373 | };
|
---|
374 |
|
---|
375 | class KwdEndPublic : public Kwd
|
---|
376 | {
|
---|
377 | public:
|
---|
378 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
379 | Use* use,
|
---|
380 | const cmt_string& file_name,
|
---|
381 | int line_number)
|
---|
382 | {
|
---|
383 | if (use != &(Use::current ()))
|
---|
384 | {
|
---|
385 | use->pop_scope_section ();
|
---|
386 | }
|
---|
387 | }
|
---|
388 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
389 | Project* project,
|
---|
390 | const cmt_string& file_name,
|
---|
391 | int line_number)
|
---|
392 | {}
|
---|
393 | };
|
---|
394 |
|
---|
395 | class KwdIgnorePattern : public Kwd
|
---|
396 | {
|
---|
397 | public:
|
---|
398 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
399 | Use* use,
|
---|
400 | const cmt_string& file_name,
|
---|
401 | int line_number)
|
---|
402 | {
|
---|
403 | IgnorePattern::action (words, use);
|
---|
404 | }
|
---|
405 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
406 | Project* project,
|
---|
407 | const cmt_string& file_name,
|
---|
408 | int line_number)
|
---|
409 | {}
|
---|
410 |
|
---|
411 | };
|
---|
412 |
|
---|
413 | class KwdIncludeDirs : public Kwd
|
---|
414 | {
|
---|
415 | public:
|
---|
416 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
417 | Use* use,
|
---|
418 | const cmt_string& file_name,
|
---|
419 | int line_number)
|
---|
420 | {
|
---|
421 | Include::action (words, use);
|
---|
422 | }
|
---|
423 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
424 | Project* project,
|
---|
425 | const cmt_string& file_name,
|
---|
426 | int line_number)
|
---|
427 | {}
|
---|
428 |
|
---|
429 | };
|
---|
430 |
|
---|
431 | class KwdIncludePath : public Kwd
|
---|
432 | {
|
---|
433 | public:
|
---|
434 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
435 | Use* use,
|
---|
436 | const cmt_string& file_name,
|
---|
437 | int line_number)
|
---|
438 | {
|
---|
439 | if (words.size () > 1)
|
---|
440 | {
|
---|
441 | use->set_include_path (words[1]);
|
---|
442 | }
|
---|
443 | }
|
---|
444 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
445 | Project* project,
|
---|
446 | const cmt_string& file_name,
|
---|
447 | int line_number)
|
---|
448 | {}
|
---|
449 |
|
---|
450 | };
|
---|
451 |
|
---|
452 | class KwdLanguage : public Kwd
|
---|
453 | {
|
---|
454 | public:
|
---|
455 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
456 | Use* use,
|
---|
457 | const cmt_string& file_name,
|
---|
458 | int line_number)
|
---|
459 | {
|
---|
460 | Language::action (words);
|
---|
461 | }
|
---|
462 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
463 | Project* project,
|
---|
464 | const cmt_string& file_name,
|
---|
465 | int line_number)
|
---|
466 | {}
|
---|
467 |
|
---|
468 | };
|
---|
469 |
|
---|
470 | class KwdLibrary : public Kwd
|
---|
471 | {
|
---|
472 | public:
|
---|
473 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
474 | Use* use,
|
---|
475 | const cmt_string& file_name,
|
---|
476 | int line_number)
|
---|
477 | {
|
---|
478 | if (use == &(Use::current ()))
|
---|
479 | {
|
---|
480 | Constituent::action (Library, words);
|
---|
481 | }
|
---|
482 | }
|
---|
483 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
484 | Project* project,
|
---|
485 | const cmt_string& file_name,
|
---|
486 | int line_number)
|
---|
487 | {}
|
---|
488 | };
|
---|
489 |
|
---|
490 | class KwdMacro : public Kwd
|
---|
491 | {
|
---|
492 | public:
|
---|
493 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
494 | Use* use,
|
---|
495 | const cmt_string& file_name,
|
---|
496 | int line_number)
|
---|
497 | {
|
---|
498 | Symbol::action (words, CommandMacro, use);
|
---|
499 | }
|
---|
500 |
|
---|
501 |
|
---|
502 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
503 | Project* project,
|
---|
504 | const cmt_string& file_name,
|
---|
505 | int line_number)
|
---|
506 | {
|
---|
507 | action (words, project->m_use, file_name, line_number);
|
---|
508 | }
|
---|
509 | };
|
---|
510 |
|
---|
511 | class KwdMacroPrepend : public Kwd
|
---|
512 | {
|
---|
513 | public:
|
---|
514 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
515 | Use* use,
|
---|
516 | const cmt_string& file_name,
|
---|
517 | int line_number)
|
---|
518 | {
|
---|
519 | Symbol::action (words, CommandMacroPrepend, use);
|
---|
520 | }
|
---|
521 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
522 | Project* project,
|
---|
523 | const cmt_string& file_name,
|
---|
524 | int line_number)
|
---|
525 | {
|
---|
526 | action (words, project->m_use, file_name, line_number);
|
---|
527 | }
|
---|
528 | };
|
---|
529 |
|
---|
530 | class KwdMacroAppend : public Kwd
|
---|
531 | {
|
---|
532 | public:
|
---|
533 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
534 | Use* use,
|
---|
535 | const cmt_string& file_name,
|
---|
536 | int line_number)
|
---|
537 | {
|
---|
538 | Symbol::action (words, CommandMacroAppend, use);
|
---|
539 | }
|
---|
540 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
541 | Project* project,
|
---|
542 | const cmt_string& file_name,
|
---|
543 | int line_number)
|
---|
544 | {
|
---|
545 | action (words, project->m_use, file_name, line_number);
|
---|
546 | }
|
---|
547 | };
|
---|
548 |
|
---|
549 | class KwdMacroRemove : public Kwd
|
---|
550 | {
|
---|
551 | public:
|
---|
552 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
553 | Use* use,
|
---|
554 | const cmt_string& file_name,
|
---|
555 | int line_number)
|
---|
556 | {
|
---|
557 | Symbol::action (words, CommandMacroRemove, use);
|
---|
558 | }
|
---|
559 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
560 | Project* project,
|
---|
561 | const cmt_string& file_name,
|
---|
562 | int line_number)
|
---|
563 | {
|
---|
564 | action (words, project->m_use, file_name, line_number);
|
---|
565 | }
|
---|
566 | };
|
---|
567 |
|
---|
568 | class KwdMacroRemoveRegexp : public Kwd
|
---|
569 | {
|
---|
570 | public:
|
---|
571 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
572 | Use* use,
|
---|
573 | const cmt_string& file_name,
|
---|
574 | int line_number)
|
---|
575 | {
|
---|
576 | Symbol::action (words, CommandMacroRemoveRegexp, use);
|
---|
577 | }
|
---|
578 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
579 | Project* project,
|
---|
580 | const cmt_string& file_name,
|
---|
581 | int line_number)
|
---|
582 | {
|
---|
583 | action (words, project->m_use, file_name, line_number);
|
---|
584 | }
|
---|
585 | };
|
---|
586 |
|
---|
587 | class KwdMacroRemoveAll : public Kwd
|
---|
588 | {
|
---|
589 | public:
|
---|
590 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
591 | Use* use,
|
---|
592 | const cmt_string& file_name,
|
---|
593 | int line_number)
|
---|
594 | {
|
---|
595 | Symbol::action (words, CommandMacroRemoveAll, use);
|
---|
596 | }
|
---|
597 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
598 | Project* project,
|
---|
599 | const cmt_string& file_name,
|
---|
600 | int line_number)
|
---|
601 | {
|
---|
602 | action (words, project->m_use, file_name, line_number);
|
---|
603 | }
|
---|
604 | };
|
---|
605 |
|
---|
606 | class KwdMacroRemoveAllRegexp : public Kwd
|
---|
607 | {
|
---|
608 | public:
|
---|
609 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
610 | Use* use,
|
---|
611 | const cmt_string& file_name,
|
---|
612 | int line_number)
|
---|
613 | {
|
---|
614 | Symbol::action (words, CommandMacroRemoveAllRegexp, use);
|
---|
615 | }
|
---|
616 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
617 | Project* project,
|
---|
618 | const cmt_string& file_name,
|
---|
619 | int line_number)
|
---|
620 | {
|
---|
621 | action (words, project->m_use, file_name, line_number);
|
---|
622 | }
|
---|
623 | };
|
---|
624 |
|
---|
625 | class KwdMakeFragment : public Kwd
|
---|
626 | {
|
---|
627 | public:
|
---|
628 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
629 | Use* use,
|
---|
630 | const cmt_string& file_name,
|
---|
631 | int line_number)
|
---|
632 | {
|
---|
633 | Fragment::action (words, use);
|
---|
634 | }
|
---|
635 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
636 | Project* project,
|
---|
637 | const cmt_string& file_name,
|
---|
638 | int line_number)
|
---|
639 | {}
|
---|
640 | };
|
---|
641 |
|
---|
642 | class KwdManager : public Kwd
|
---|
643 | {
|
---|
644 | public:
|
---|
645 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
646 | Use* use,
|
---|
647 | const cmt_string& file_name,
|
---|
648 | int line_number)
|
---|
649 | {
|
---|
650 | use->manager_action (words);
|
---|
651 | }
|
---|
652 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
653 | Project* project,
|
---|
654 | const cmt_string& file_name,
|
---|
655 | int line_number)
|
---|
656 | {}
|
---|
657 | };
|
---|
658 |
|
---|
659 | class KwdPackage : public Kwd
|
---|
660 | {
|
---|
661 | public:
|
---|
662 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
663 | Use* use,
|
---|
664 | const cmt_string& file_name,
|
---|
665 | int line_number)
|
---|
666 | {
|
---|
667 | /*
|
---|
668 | if (words.size () > 1)
|
---|
669 | {
|
---|
670 | if (use == &(Use::current()))
|
---|
671 | {
|
---|
672 | m_current_package = words[1];
|
---|
673 | build_prefix (m_current_package, m_current_prefix);
|
---|
674 |
|
---|
675 | if ((use->get_package_name () != "") &&
|
---|
676 | (use->get_package_name () != m_current_package))
|
---|
677 | {
|
---|
678 | if (!m_quiet)
|
---|
679 | {
|
---|
680 | // cerr << "#CMT> package name mismatch in requirements of " <<
|
---|
681 | // use->get_package_name () << " " <<
|
---|
682 | // use->version << " line #" << line_number;
|
---|
683 | // cerr << " : " << m_current_package << " versus " <<
|
---|
684 | // use->get_package_name () << endl;
|
---|
685 | }
|
---|
686 | }
|
---|
687 |
|
---|
688 | use->set (m_current_package,
|
---|
689 | m_current_version,
|
---|
690 | m_current_path,
|
---|
691 | "",
|
---|
692 | "");
|
---|
693 |
|
---|
694 | use->change_path (m_current_path);
|
---|
695 | use->style = m_current_style;
|
---|
696 | }
|
---|
697 | }
|
---|
698 | */
|
---|
699 | }
|
---|
700 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
701 | Project* project,
|
---|
702 | const cmt_string& file_name,
|
---|
703 | int line_number)
|
---|
704 | {}
|
---|
705 | };
|
---|
706 |
|
---|
707 | class KwdPath : public Kwd
|
---|
708 | {
|
---|
709 | public:
|
---|
710 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
711 | Use* use,
|
---|
712 | const cmt_string& file_name,
|
---|
713 | int line_number)
|
---|
714 | {
|
---|
715 | Symbol::action (words, CommandPath, use);
|
---|
716 | }
|
---|
717 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
718 | Project* project,
|
---|
719 | const cmt_string& file_name,
|
---|
720 | int line_number)
|
---|
721 | {}
|
---|
722 |
|
---|
723 | };
|
---|
724 |
|
---|
725 | class KwdPathAppend : public Kwd
|
---|
726 | {
|
---|
727 | public:
|
---|
728 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
729 | Use* use,
|
---|
730 | const cmt_string& file_name,
|
---|
731 | int line_number)
|
---|
732 | {
|
---|
733 | Symbol::action (words, CommandPathAppend, use);
|
---|
734 | }
|
---|
735 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
736 | Project* project,
|
---|
737 | const cmt_string& file_name,
|
---|
738 | int line_number)
|
---|
739 | {}
|
---|
740 | };
|
---|
741 |
|
---|
742 | class KwdPathPrepend : public Kwd
|
---|
743 | {
|
---|
744 | public:
|
---|
745 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
746 | Use* use,
|
---|
747 | const cmt_string& file_name,
|
---|
748 | int line_number)
|
---|
749 | {
|
---|
750 | Symbol::action (words, CommandPathPrepend, use);
|
---|
751 | }
|
---|
752 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
753 | Project* project,
|
---|
754 | const cmt_string& file_name,
|
---|
755 | int line_number)
|
---|
756 | {}
|
---|
757 | };
|
---|
758 |
|
---|
759 | class KwdPathRemove : public Kwd
|
---|
760 | {
|
---|
761 | public:
|
---|
762 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
763 | Use* use,
|
---|
764 | const cmt_string& file_name,
|
---|
765 | int line_number)
|
---|
766 | {
|
---|
767 | Symbol::action (words, CommandPathRemove, use);
|
---|
768 | }
|
---|
769 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
770 | Project* project,
|
---|
771 | const cmt_string& file_name,
|
---|
772 | int line_number)
|
---|
773 | {}
|
---|
774 | };
|
---|
775 |
|
---|
776 | class KwdPathRemoveRegexp : public Kwd
|
---|
777 | {
|
---|
778 | public:
|
---|
779 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
780 | Use* use,
|
---|
781 | const cmt_string& file_name,
|
---|
782 | int line_number)
|
---|
783 | {
|
---|
784 | Symbol::action (words, CommandPathRemoveRegexp, use);
|
---|
785 | }
|
---|
786 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
787 | Project* project,
|
---|
788 | const cmt_string& file_name,
|
---|
789 | int line_number)
|
---|
790 | {}
|
---|
791 | };
|
---|
792 |
|
---|
793 | class KwdPattern : public Kwd
|
---|
794 | {
|
---|
795 | public:
|
---|
796 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
797 | Use* use,
|
---|
798 | const cmt_string& file_name,
|
---|
799 | int line_number)
|
---|
800 | {
|
---|
801 | Pattern::action (words, use);
|
---|
802 | }
|
---|
803 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
804 | Project* project,
|
---|
805 | const cmt_string& file_name,
|
---|
806 | int line_number)
|
---|
807 | {}
|
---|
808 | };
|
---|
809 |
|
---|
810 | class KwdPrivate : public Kwd
|
---|
811 | {
|
---|
812 | public:
|
---|
813 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
814 | Use* use,
|
---|
815 | const cmt_string& file_name,
|
---|
816 | int line_number)
|
---|
817 | {
|
---|
818 | if (use != &(Use::current ()))
|
---|
819 | {
|
---|
820 | use->push_scope_section (ScopePrivate);
|
---|
821 | }
|
---|
822 | }
|
---|
823 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
824 | Project* project,
|
---|
825 | const cmt_string& file_name,
|
---|
826 | int line_number)
|
---|
827 | {}
|
---|
828 | };
|
---|
829 |
|
---|
830 | class KwdProject : public Kwd
|
---|
831 | {
|
---|
832 | public:
|
---|
833 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
834 | Use* use,
|
---|
835 | const cmt_string& file_name,
|
---|
836 | int line_number)
|
---|
837 | {
|
---|
838 | }
|
---|
839 |
|
---|
840 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
841 | Project* project,
|
---|
842 | const cmt_string& file_name,
|
---|
843 | int line_number)
|
---|
844 | {
|
---|
845 | }
|
---|
846 | };
|
---|
847 |
|
---|
848 | class KwdPublic : public Kwd
|
---|
849 | {
|
---|
850 | public:
|
---|
851 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
852 | Use* use,
|
---|
853 | const cmt_string& file_name,
|
---|
854 | int line_number)
|
---|
855 | {
|
---|
856 | if (use != &(Use::current ()))
|
---|
857 | {
|
---|
858 | use->push_scope_section (ScopePublic);
|
---|
859 | }
|
---|
860 | }
|
---|
861 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
862 | Project* project,
|
---|
863 | const cmt_string& file_name,
|
---|
864 | int line_number)
|
---|
865 | {}
|
---|
866 | };
|
---|
867 |
|
---|
868 | class KwdSet : public Kwd
|
---|
869 | {
|
---|
870 | public:
|
---|
871 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
872 | Use* use,
|
---|
873 | const cmt_string& file_name,
|
---|
874 | int line_number)
|
---|
875 | {
|
---|
876 | Symbol::action (words, CommandSet, use);
|
---|
877 | }
|
---|
878 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
879 | Project* project,
|
---|
880 | const cmt_string& file_name,
|
---|
881 | int line_number)
|
---|
882 | {}
|
---|
883 | };
|
---|
884 |
|
---|
885 | class KwdSetAppend : public Kwd
|
---|
886 | {
|
---|
887 | public:
|
---|
888 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
889 | Use* use,
|
---|
890 | const cmt_string& file_name,
|
---|
891 | int line_number)
|
---|
892 | {
|
---|
893 | Symbol::action (words, CommandSetAppend, use);
|
---|
894 | }
|
---|
895 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
896 | Project* project,
|
---|
897 | const cmt_string& file_name,
|
---|
898 | int line_number)
|
---|
899 | {}
|
---|
900 | };
|
---|
901 |
|
---|
902 | class KwdSetPrepend : public Kwd
|
---|
903 | {
|
---|
904 | public:
|
---|
905 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
906 | Use* use,
|
---|
907 | const cmt_string& file_name,
|
---|
908 | int line_number)
|
---|
909 | {
|
---|
910 | Symbol::action (words, CommandSetPrepend, use);
|
---|
911 | }
|
---|
912 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
913 | Project* project,
|
---|
914 | const cmt_string& file_name,
|
---|
915 | int line_number)
|
---|
916 | {}
|
---|
917 | };
|
---|
918 |
|
---|
919 | class KwdSetRemove : public Kwd
|
---|
920 | {
|
---|
921 | public:
|
---|
922 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
923 | Use* use,
|
---|
924 | const cmt_string& file_name,
|
---|
925 | int line_number)
|
---|
926 | {
|
---|
927 | Symbol::action (words, CommandSetRemove, use);
|
---|
928 | }
|
---|
929 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
930 | Project* project,
|
---|
931 | const cmt_string& file_name,
|
---|
932 | int line_number)
|
---|
933 | {}
|
---|
934 | };
|
---|
935 |
|
---|
936 | class KwdSetRemoveRegexp : public Kwd
|
---|
937 | {
|
---|
938 | public:
|
---|
939 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
940 | Use* use,
|
---|
941 | const cmt_string& file_name,
|
---|
942 | int line_number)
|
---|
943 | {
|
---|
944 | Symbol::action (words, CommandSetRemoveRegexp, use);
|
---|
945 | }
|
---|
946 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
947 | Project* project,
|
---|
948 | const cmt_string& file_name,
|
---|
949 | int line_number)
|
---|
950 | {}
|
---|
951 | };
|
---|
952 |
|
---|
953 | class KwdSetupScript : public Kwd
|
---|
954 | {
|
---|
955 | public:
|
---|
956 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
957 | Use* use,
|
---|
958 | const cmt_string& file_name,
|
---|
959 | int line_number)
|
---|
960 | {
|
---|
961 | Script::action (words, SetupScript, use);
|
---|
962 | Symbol::action (words, CommandSetupScript, use);
|
---|
963 | }
|
---|
964 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
965 | Project* project,
|
---|
966 | const cmt_string& file_name,
|
---|
967 | int line_number)
|
---|
968 | {}
|
---|
969 | };
|
---|
970 |
|
---|
971 | class KwdSetupStrategy : public Kwd
|
---|
972 | {
|
---|
973 | public:
|
---|
974 | bool decode (const cmt_string& w, cmt_string& strategy, cmt_string& value)
|
---|
975 | {
|
---|
976 | bool result = true;
|
---|
977 |
|
---|
978 | value = w;
|
---|
979 | Symbol::expand(value);
|
---|
980 |
|
---|
981 | if (value == "config")
|
---|
982 | {
|
---|
983 | strategy = "SetupConfig";
|
---|
984 | }
|
---|
985 | else if (value == "no_config")
|
---|
986 | {
|
---|
987 | strategy = "SetupConfig";
|
---|
988 | }
|
---|
989 | else if (value == "root")
|
---|
990 | {
|
---|
991 | strategy = "SetupRoot";
|
---|
992 | }
|
---|
993 | else if (value == "no_root")
|
---|
994 | {
|
---|
995 | strategy = "SetupRoot";
|
---|
996 | }
|
---|
997 | else if (value == "cleanup")
|
---|
998 | {
|
---|
999 | strategy = "SetupCleanup";
|
---|
1000 | }
|
---|
1001 | else if (value == "no_cleanup")
|
---|
1002 | {
|
---|
1003 | strategy = "SetupCleanup";
|
---|
1004 | }
|
---|
1005 | else
|
---|
1006 | {
|
---|
1007 | result = false;
|
---|
1008 | }
|
---|
1009 |
|
---|
1010 | return (result);
|
---|
1011 | }
|
---|
1012 |
|
---|
1013 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1014 | Use* use,
|
---|
1015 | const cmt_string& file_name,
|
---|
1016 | int line_number)
|
---|
1017 | {
|
---|
1018 | cmt_string cmtpath;
|
---|
1019 | cmt_string offset;
|
---|
1020 |
|
---|
1021 | use->get_cmtpath_and_offset (cmtpath, offset);
|
---|
1022 |
|
---|
1023 | Project* p = Project::find_by_cmtpath (cmtpath);
|
---|
1024 |
|
---|
1025 | for (int i = 1; i < words.size (); i++)
|
---|
1026 | {
|
---|
1027 | const cmt_string& w = words[i];
|
---|
1028 |
|
---|
1029 | cmt_string strategy;
|
---|
1030 | cmt_string value;
|
---|
1031 |
|
---|
1032 | bool in_error = false;
|
---|
1033 |
|
---|
1034 | if (decode (w, strategy, value))
|
---|
1035 | {
|
---|
1036 | if (p != 0) p->set_strategy (strategy, value, use->get_package_name ());
|
---|
1037 | }
|
---|
1038 | else
|
---|
1039 | {
|
---|
1040 | in_error = true;
|
---|
1041 |
|
---|
1042 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
|
---|
1043 | }
|
---|
1044 | }
|
---|
1045 | }
|
---|
1046 |
|
---|
1047 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1048 | Project* project,
|
---|
1049 | const cmt_string& file_name,
|
---|
1050 | int line_number)
|
---|
1051 | {
|
---|
1052 | for (int i = 1; i < words.size (); i++)
|
---|
1053 | {
|
---|
1054 | const cmt_string& w = words[i];
|
---|
1055 |
|
---|
1056 | cmt_string strategy;
|
---|
1057 | cmt_string value;
|
---|
1058 |
|
---|
1059 | bool in_error = false;
|
---|
1060 |
|
---|
1061 | if (decode (w, strategy, value))
|
---|
1062 | {
|
---|
1063 | if (project != 0) project->set_strategy (strategy, value, "");
|
---|
1064 | }
|
---|
1065 | else
|
---|
1066 | {
|
---|
1067 | in_error = true;
|
---|
1068 |
|
---|
1069 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
|
---|
1070 | }
|
---|
1071 | }
|
---|
1072 | }
|
---|
1073 | };
|
---|
1074 |
|
---|
1075 | class KwdStructureStrategy : public Kwd
|
---|
1076 | {
|
---|
1077 | public:
|
---|
1078 | bool decode (const cmt_string& w, cmt_string& strategy, cmt_string& value)
|
---|
1079 | {
|
---|
1080 | bool result = true;
|
---|
1081 |
|
---|
1082 | value = w;
|
---|
1083 | Symbol::expand(value);
|
---|
1084 |
|
---|
1085 |
|
---|
1086 | if (value == "with_version_directory")
|
---|
1087 | {
|
---|
1088 | strategy = "VersionDirectory";
|
---|
1089 | }
|
---|
1090 | else if (value == "without_version_directory")
|
---|
1091 | {
|
---|
1092 | strategy = "VersionDirectory";
|
---|
1093 | }
|
---|
1094 | else
|
---|
1095 | {
|
---|
1096 | result = false;
|
---|
1097 | }
|
---|
1098 |
|
---|
1099 | return (result);
|
---|
1100 | }
|
---|
1101 |
|
---|
1102 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1103 | Use* use,
|
---|
1104 | const cmt_string& file_name,
|
---|
1105 | int line_number)
|
---|
1106 | {
|
---|
1107 | cmt_string cmtpath;
|
---|
1108 | cmt_string offset;
|
---|
1109 |
|
---|
1110 | use->get_cmtpath_and_offset (cmtpath, offset);
|
---|
1111 |
|
---|
1112 | Project* p = Project::find_by_cmtpath (cmtpath);
|
---|
1113 |
|
---|
1114 | for (int i = 1; i < words.size (); i++)
|
---|
1115 | {
|
---|
1116 | const cmt_string& w = words[i];
|
---|
1117 |
|
---|
1118 | cmt_string strategy;
|
---|
1119 | cmt_string value;
|
---|
1120 |
|
---|
1121 | bool in_error = false;
|
---|
1122 |
|
---|
1123 | if (decode (w, strategy, value))
|
---|
1124 | {
|
---|
1125 | if (p != 0) p->set_strategy (strategy, value, use->get_package_name ());
|
---|
1126 | }
|
---|
1127 | else
|
---|
1128 | {
|
---|
1129 | in_error = true;
|
---|
1130 |
|
---|
1131 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
|
---|
1132 | }
|
---|
1133 | }
|
---|
1134 | }
|
---|
1135 |
|
---|
1136 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1137 | Project* project,
|
---|
1138 | const cmt_string& file_name,
|
---|
1139 | int line_number)
|
---|
1140 | {
|
---|
1141 | for (int i = 1; i < words.size (); i++)
|
---|
1142 | {
|
---|
1143 | const cmt_string& w = words[i];
|
---|
1144 |
|
---|
1145 | cmt_string strategy;
|
---|
1146 | cmt_string value;
|
---|
1147 |
|
---|
1148 | bool in_error = false;
|
---|
1149 |
|
---|
1150 | if (decode (w, strategy, value))
|
---|
1151 | {
|
---|
1152 | if (project != 0) project->set_strategy (strategy, value, "");
|
---|
1153 | }
|
---|
1154 | else
|
---|
1155 | {
|
---|
1156 | in_error = true;
|
---|
1157 |
|
---|
1158 | CmtError::set (CmtError::syntax_error, "ParseRequirements> bad strategy keyword");
|
---|
1159 | }
|
---|
1160 | }
|
---|
1161 | }
|
---|
1162 | };
|
---|
1163 |
|
---|
1164 | class KwdTag : public Kwd
|
---|
1165 | {
|
---|
1166 | public:
|
---|
1167 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1168 | Use* use,
|
---|
1169 | const cmt_string& file_name,
|
---|
1170 | int line_number)
|
---|
1171 | {
|
---|
1172 | Tag::action (words, use);
|
---|
1173 | }
|
---|
1174 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1175 | Project* project,
|
---|
1176 | const cmt_string& file_name,
|
---|
1177 | int line_number)
|
---|
1178 | {
|
---|
1179 | action (words, project->m_use, file_name, line_number);
|
---|
1180 | }
|
---|
1181 | };
|
---|
1182 |
|
---|
1183 | class KwdTagExclude : public Kwd
|
---|
1184 | {
|
---|
1185 | public:
|
---|
1186 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1187 | Use* use,
|
---|
1188 | const cmt_string& file_name,
|
---|
1189 | int line_number)
|
---|
1190 | {
|
---|
1191 | Tag::action_exclude (words, use);
|
---|
1192 | }
|
---|
1193 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1194 | Project* project,
|
---|
1195 | const cmt_string& file_name,
|
---|
1196 | int line_number)
|
---|
1197 | {
|
---|
1198 | action (words, project->m_use, file_name, line_number);
|
---|
1199 | }
|
---|
1200 | };
|
---|
1201 |
|
---|
1202 | class KwdUse : public Kwd
|
---|
1203 | {
|
---|
1204 | public:
|
---|
1205 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1206 | Use* use,
|
---|
1207 | const cmt_string& file_name,
|
---|
1208 | int line_number)
|
---|
1209 | {
|
---|
1210 | Use::action (words, use);
|
---|
1211 | }
|
---|
1212 |
|
---|
1213 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1214 | Project* project,
|
---|
1215 | const cmt_string& file_name,
|
---|
1216 | int line_number)
|
---|
1217 | {
|
---|
1218 | project->use_action (words[1], words[2]);
|
---|
1219 | }
|
---|
1220 | };
|
---|
1221 |
|
---|
1222 | class KwdVersionStrategy : public Kwd
|
---|
1223 | {
|
---|
1224 | public:
|
---|
1225 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1226 | Use* use,
|
---|
1227 | const cmt_string& file_name,
|
---|
1228 | int line_number)
|
---|
1229 | {
|
---|
1230 | cerr << "# Package " << use->get_package_name () <<
|
---|
1231 | " sets obsolescent version strategy" << endl;
|
---|
1232 | }
|
---|
1233 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1234 | Project* project,
|
---|
1235 | const cmt_string& file_name,
|
---|
1236 | int line_number)
|
---|
1237 | {}
|
---|
1238 | };
|
---|
1239 |
|
---|
1240 | class KwdVersion : public Kwd
|
---|
1241 | {
|
---|
1242 | public:
|
---|
1243 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1244 | Use* use,
|
---|
1245 | const cmt_string& file_name,
|
---|
1246 | int line_number)
|
---|
1247 | {
|
---|
1248 | }
|
---|
1249 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1250 | Project* project,
|
---|
1251 | const cmt_string& file_name,
|
---|
1252 | int line_number)
|
---|
1253 | {}
|
---|
1254 | };
|
---|
1255 |
|
---|
1256 | class KwdDefault : public Kwd
|
---|
1257 | {
|
---|
1258 | public:
|
---|
1259 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1260 | Use* use,
|
---|
1261 | const cmt_string& file_name,
|
---|
1262 | int line_number)
|
---|
1263 | {
|
---|
1264 | /*
|
---|
1265 | Unknown keyword : just ignore the line
|
---|
1266 | */
|
---|
1267 | if (!Cmt::get_quiet ())
|
---|
1268 | {
|
---|
1269 | cerr << "#CMT> bad syntax in requirements of " << use->get_package_name ()
|
---|
1270 | << " " << use->version << " line #" << line_number;
|
---|
1271 | cerr << " [" << words[0] << "...]" << endl;
|
---|
1272 | }
|
---|
1273 |
|
---|
1274 | CmtError::set (CmtError::syntax_error, "ParseRequirements> ");
|
---|
1275 | }
|
---|
1276 |
|
---|
1277 | void action (const CmtSystem::cmt_string_vector& words,
|
---|
1278 | Project* project,
|
---|
1279 | const cmt_string& file_name,
|
---|
1280 | int line_number)
|
---|
1281 | {}
|
---|
1282 | };
|
---|
1283 |
|
---|
1284 | SyntaxParser& SyntaxParser::instance ()
|
---|
1285 | {
|
---|
1286 | static SyntaxParser p;
|
---|
1287 |
|
---|
1288 | return (p);
|
---|
1289 | }
|
---|
1290 |
|
---|
1291 | /**
|
---|
1292 | * Parse the input file, rejecting comments and
|
---|
1293 | * rebuilding complete lines (from sections separated by
|
---|
1294 | * \ characters.
|
---|
1295 | *
|
---|
1296 | * Each reformatted line is parsed by filter_line
|
---|
1297 | */
|
---|
1298 | void SyntaxParser::parse_requirements (const cmt_string& file_name, Use* use)
|
---|
1299 | {
|
---|
1300 | SyntaxParser& me = instance ();
|
---|
1301 |
|
---|
1302 | if (use != 0)
|
---|
1303 | {
|
---|
1304 | cmt_string buffer;
|
---|
1305 |
|
---|
1306 | use->fill_standard_macros (buffer);
|
---|
1307 | AccessMode saved_current_access = Cmt::get_current_access ();
|
---|
1308 | Cmt::set_current_access (UserMode);
|
---|
1309 | me.do_parse_text (buffer, "", package_context, use, 0);
|
---|
1310 | Cmt::set_current_access (saved_current_access);
|
---|
1311 |
|
---|
1312 | //
|
---|
1313 | Project* p = use->get_project ();
|
---|
1314 | if (p != 0)
|
---|
1315 | {
|
---|
1316 | if (p->m_use !=0)
|
---|
1317 | {
|
---|
1318 | use->sub_uses.push_back (p->m_use);
|
---|
1319 | }
|
---|
1320 | }
|
---|
1321 | }
|
---|
1322 |
|
---|
1323 | me.do_parse_requirements (file_name, use);
|
---|
1324 |
|
---|
1325 | if (use != 0)
|
---|
1326 | {
|
---|
1327 | use->close_scope_sections ();
|
---|
1328 | }
|
---|
1329 | }
|
---|
1330 |
|
---|
1331 | /**
|
---|
1332 | */
|
---|
1333 | void SyntaxParser::parse_project_file_text (const cmt_string& text,
|
---|
1334 | const cmt_string& file_name,
|
---|
1335 | Project* project)
|
---|
1336 | {
|
---|
1337 | SyntaxParser& me = instance ();
|
---|
1338 | me.do_parse_text (text, file_name, project_context, 0, project);
|
---|
1339 | }
|
---|
1340 |
|
---|
1341 | /**
|
---|
1342 | * Parse a text, rejecting comments and
|
---|
1343 | * rebuilding complete lines (from sections separated by
|
---|
1344 | * \ characters.
|
---|
1345 | *
|
---|
1346 | * Each reformatted line is parsed by filter_line
|
---|
1347 | */
|
---|
1348 | void SyntaxParser::parse_requirements_text (const cmt_string& text,
|
---|
1349 | const cmt_string& file_name,
|
---|
1350 | Use* use)
|
---|
1351 | {
|
---|
1352 | SyntaxParser& me = instance ();
|
---|
1353 |
|
---|
1354 | /**
|
---|
1355 | *
|
---|
1356 | * We have to preserve m_current_access since it reflects whether
|
---|
1357 | * the current cmt action is run in the context of the current package.
|
---|
1358 | * (the opposite is when the cmt command specifies the current package
|
---|
1359 | * in its arguments -use=... therefore the pwd is NOT the directory
|
---|
1360 | * of the current package)
|
---|
1361 | *
|
---|
1362 | * m_current_access is Developer when pwd = current
|
---|
1363 | * User when pwd != current
|
---|
1364 | *
|
---|
1365 | * Therefore, as soon as we reach a used package, this must be switched to User
|
---|
1366 | *
|
---|
1367 | * On the other hand, Cmt::scope reflects the status of the public/private
|
---|
1368 | * statements. By default, we are in public context when entering a new requirements
|
---|
1369 | * file.
|
---|
1370 | *
|
---|
1371 | */
|
---|
1372 |
|
---|
1373 | AccessMode saved_current_access;
|
---|
1374 |
|
---|
1375 | saved_current_access = Cmt::get_current_access ();
|
---|
1376 |
|
---|
1377 | if (use == 0) use = &(Use::current ());
|
---|
1378 |
|
---|
1379 | if (use != &(Use::current ()))
|
---|
1380 | {
|
---|
1381 | if (Cmt::get_debug ())
|
---|
1382 | {
|
---|
1383 | cout << "parse_requirements_text> set UserMode" << endl;
|
---|
1384 | }
|
---|
1385 |
|
---|
1386 | Cmt::set_current_access (UserMode);
|
---|
1387 | }
|
---|
1388 | else
|
---|
1389 | {
|
---|
1390 | if (Cmt::get_debug ())
|
---|
1391 | {
|
---|
1392 | cout << "parse_requirements_text> set DeveloperMode" << endl;
|
---|
1393 | }
|
---|
1394 |
|
---|
1395 | Cmt::set_current_access (DeveloperMode);
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 | me.do_parse_text (text, file_name, package_context, use, 0);
|
---|
1399 |
|
---|
1400 | Cmt::set_current_access (saved_current_access);
|
---|
1401 | }
|
---|
1402 |
|
---|
1403 | /**
|
---|
1404 | * Apply the basic parser to one single line :
|
---|
1405 | *
|
---|
1406 | * o Append to global text if previous back_slash
|
---|
1407 | * o Split into words
|
---|
1408 | * o Apply the generic Select operator
|
---|
1409 | */
|
---|
1410 | void SyntaxParser::parse_requirements_line (const cmt_string& line,
|
---|
1411 | Use* use,
|
---|
1412 | const cmt_string& file_name,
|
---|
1413 | int line_number)
|
---|
1414 | {
|
---|
1415 | SyntaxParser& me = instance ();
|
---|
1416 | me.do_parse_line (line, file_name, line_number, package_context, use, 0);
|
---|
1417 | }
|
---|
1418 |
|
---|
1419 | SyntaxParser::SyntaxParser ()
|
---|
1420 | {
|
---|
1421 | m_keywords.add ("action", new KwdAction ());
|
---|
1422 | m_keywords.add ("alias", new KwdAlias ());
|
---|
1423 | m_keywords.add ("application", new KwdApplication ());
|
---|
1424 | m_keywords.add ("apply_pattern", new KwdApplyPattern ());
|
---|
1425 | m_keywords.add ("apply_tag", new KwdApplyTag ());
|
---|
1426 | m_keywords.add ("author", new KwdAuthor ());
|
---|
1427 | m_keywords.add ("branches", new KwdBranches ());
|
---|
1428 | m_keywords.add ("build_strategy", new KwdBuildStrategy ());
|
---|
1429 | m_keywords.add ("cleanup_script", new KwdCleanupScript ());
|
---|
1430 | m_keywords.add ("cmtpath_pattern", new KwdCmtPathPattern ());
|
---|
1431 | m_keywords.add ("cmtpath_pattern_reverse", new KwdCmtPathPatternRevert ());
|
---|
1432 | m_keywords.add ("document", new KwdDocument ());
|
---|
1433 | m_keywords.add ("end_private", new KwdEndPrivate ());
|
---|
1434 | m_keywords.add ("end_public", new KwdEndPublic ());
|
---|
1435 | m_keywords.add ("ignore_pattern", new KwdIgnorePattern ());
|
---|
1436 | m_keywords.add ("include_dirs", new KwdIncludeDirs ());
|
---|
1437 | m_keywords.add ("include_path", new KwdIncludePath ());
|
---|
1438 | m_keywords.add ("language", new KwdLanguage ());
|
---|
1439 | m_keywords.add ("library", new KwdLibrary ());
|
---|
1440 | m_keywords.add ("macro", new KwdMacro ());
|
---|
1441 | m_keywords.add ("macro+", new KwdMacroAppend ());
|
---|
1442 | m_keywords.add ("macro_prepend", new KwdMacroPrepend ());
|
---|
1443 | m_keywords.add ("macro_append", new KwdMacroAppend ());
|
---|
1444 | m_keywords.add ("macro_remove", new KwdMacroRemove ());
|
---|
1445 | m_keywords.add ("macro_remove_regexp", new KwdMacroRemoveRegexp ());
|
---|
1446 | m_keywords.add ("macro_remove_all", new KwdMacroRemoveAll ());
|
---|
1447 | m_keywords.add ("macro_remove_all_regexp", new KwdMacroRemoveAllRegexp ());
|
---|
1448 | m_keywords.add ("make_fragment", new KwdMakeFragment ());
|
---|
1449 | m_keywords.add ("manager", new KwdManager ());
|
---|
1450 | m_keywords.add ("package", new KwdPackage ());
|
---|
1451 | m_keywords.add ("path", new KwdPath ());
|
---|
1452 | m_keywords.add ("path_append", new KwdPathAppend ());
|
---|
1453 | m_keywords.add ("path_prepend", new KwdPathPrepend ());
|
---|
1454 | m_keywords.add ("path_remove", new KwdPathRemove ());
|
---|
1455 | m_keywords.add ("path_remove_regexp", new KwdPathRemoveRegexp ());
|
---|
1456 | m_keywords.add ("pattern", new KwdPattern ());
|
---|
1457 | m_keywords.add ("public", new KwdPublic ());
|
---|
1458 | m_keywords.add ("private", new KwdPrivate ());
|
---|
1459 | m_keywords.add ("project", new KwdProject ());
|
---|
1460 | m_keywords.add ("set", new KwdSet ());
|
---|
1461 | m_keywords.add ("set_append", new KwdSetAppend ());
|
---|
1462 | m_keywords.add ("set_prepend", new KwdSetPrepend ());
|
---|
1463 | m_keywords.add ("set_remove", new KwdSetRemove ());
|
---|
1464 | m_keywords.add ("set_remove_regexp", new KwdSetRemoveRegexp ());
|
---|
1465 | m_keywords.add ("setup_script", new KwdSetupScript ());
|
---|
1466 | m_keywords.add ("setup_strategy", new KwdSetupStrategy ());
|
---|
1467 | m_keywords.add ("structure_strategy", new KwdStructureStrategy ());
|
---|
1468 | m_keywords.add ("tag", new KwdTag ());
|
---|
1469 | m_keywords.add ("tag_exclude", new KwdTagExclude ());
|
---|
1470 | m_keywords.add ("use", new KwdUse ());
|
---|
1471 | m_keywords.add ("version_strategy", new KwdVersionStrategy ());
|
---|
1472 | m_keywords.add ("version", new KwdVersion ());
|
---|
1473 |
|
---|
1474 | // Project
|
---|
1475 | m_project_keywords.add ("author", new KwdAuthor());
|
---|
1476 | m_project_keywords.add ("apply_tag", new KwdApplyTag ());
|
---|
1477 | m_project_keywords.add ("build_strategy", new KwdBuildStrategy ());
|
---|
1478 | m_project_keywords.add ("container", new KwdContainer ());
|
---|
1479 |
|
---|
1480 | m_project_keywords.add ("macro", new KwdMacro ());
|
---|
1481 | m_project_keywords.add ("macro+", new KwdMacroAppend ());
|
---|
1482 | m_project_keywords.add ("macro_prepend", new KwdMacroPrepend ());
|
---|
1483 | m_project_keywords.add ("macro_append", new KwdMacroAppend ());
|
---|
1484 | m_project_keywords.add ("macro_remove", new KwdMacroRemove ());
|
---|
1485 | m_project_keywords.add ("macro_remove_regexp", new KwdMacroRemoveRegexp ());
|
---|
1486 | m_project_keywords.add ("macro_remove_all", new KwdMacroRemoveAll ());
|
---|
1487 | m_project_keywords.add ("macro_remove_all_regexp", new KwdMacroRemoveAllRegexp ());
|
---|
1488 |
|
---|
1489 | m_project_keywords.add ("tag", new KwdTag ());
|
---|
1490 | m_project_keywords.add ("tag_exclude", new KwdTagExclude ());
|
---|
1491 |
|
---|
1492 | m_project_keywords.add ("project", new KwdProject ());
|
---|
1493 | m_project_keywords.add ("setup_strategy", new KwdSetupStrategy ());
|
---|
1494 | m_project_keywords.add ("structure_strategy", new KwdStructureStrategy ());
|
---|
1495 | m_project_keywords.add ("use", new KwdUse ());
|
---|
1496 | }
|
---|
1497 |
|
---|
1498 | void SyntaxParser::do_parse_requirements (const cmt_string& file_name, Use* use)
|
---|
1499 | {
|
---|
1500 | cmt_string actual_file_name = file_name;
|
---|
1501 | cmt_string text;
|
---|
1502 |
|
---|
1503 | CmtError::clear ();
|
---|
1504 |
|
---|
1505 | if (!CmtSystem::test_file (actual_file_name))
|
---|
1506 | {
|
---|
1507 | actual_file_name = "..";
|
---|
1508 | actual_file_name += CmtSystem::file_separator ();
|
---|
1509 | actual_file_name += "cmt";
|
---|
1510 | actual_file_name += CmtSystem::file_separator ();
|
---|
1511 | actual_file_name += file_name;
|
---|
1512 |
|
---|
1513 | if (!CmtSystem::test_file (actual_file_name))
|
---|
1514 | {
|
---|
1515 | actual_file_name = "..";
|
---|
1516 | actual_file_name += CmtSystem::file_separator ();
|
---|
1517 | actual_file_name += "mgr";
|
---|
1518 | actual_file_name += CmtSystem::file_separator ();
|
---|
1519 | actual_file_name += file_name;
|
---|
1520 |
|
---|
1521 | if (!CmtSystem::test_file (actual_file_name))
|
---|
1522 | {
|
---|
1523 | return;
|
---|
1524 | }
|
---|
1525 | }
|
---|
1526 | }
|
---|
1527 |
|
---|
1528 | text.read (actual_file_name);
|
---|
1529 |
|
---|
1530 | SyntaxParser::parse_requirements_text (text, actual_file_name, use);
|
---|
1531 | }
|
---|
1532 |
|
---|
1533 | /**
|
---|
1534 | * Parse a text, rejecting comments and
|
---|
1535 | * rebuilding complete lines (from sections separated by
|
---|
1536 | * \ characters.
|
---|
1537 | *
|
---|
1538 | * Each reformatted line is parsed by filter_line
|
---|
1539 | */
|
---|
1540 | void SyntaxParser::do_parse_text (const cmt_string& text,
|
---|
1541 | const cmt_string& file_name,
|
---|
1542 | ContextType context,
|
---|
1543 | Use* use,
|
---|
1544 | Project* project)
|
---|
1545 | {
|
---|
1546 | cmt_string line;
|
---|
1547 | int pos;
|
---|
1548 | int max_pos;
|
---|
1549 | int line_number = 1;
|
---|
1550 |
|
---|
1551 | if (context == package_context)
|
---|
1552 | {
|
---|
1553 | if (use == 0) use = &(Use::current ());
|
---|
1554 | }
|
---|
1555 |
|
---|
1556 | m_filtered_text.erase (0);
|
---|
1557 |
|
---|
1558 | pos = 0;
|
---|
1559 | max_pos = text.size ();
|
---|
1560 |
|
---|
1561 | for (pos = 0; pos < max_pos;)
|
---|
1562 | {
|
---|
1563 | int cr = text.find (pos, "\r\n");
|
---|
1564 | int nl = text.find (pos, '\n');
|
---|
1565 | int first = nl;
|
---|
1566 | int length = 1;
|
---|
1567 |
|
---|
1568 | if (cr != cmt_string::npos)
|
---|
1569 | {
|
---|
1570 | if (nl == cmt_string::npos)
|
---|
1571 | {
|
---|
1572 | first = cr;
|
---|
1573 | length = 2;
|
---|
1574 | }
|
---|
1575 | else
|
---|
1576 | {
|
---|
1577 | first = (nl < cr) ? nl : cr;
|
---|
1578 | length = (nl < cr) ? 1 : 2;
|
---|
1579 | }
|
---|
1580 | }
|
---|
1581 |
|
---|
1582 | if (first == cmt_string::npos)
|
---|
1583 | {
|
---|
1584 | text.substr (pos, line);
|
---|
1585 | pos = max_pos;
|
---|
1586 | }
|
---|
1587 | else if (first > pos)
|
---|
1588 | {
|
---|
1589 | text.substr (pos, first - pos, line);
|
---|
1590 | pos = first + length;
|
---|
1591 | }
|
---|
1592 | else
|
---|
1593 | {
|
---|
1594 | line.erase (0);
|
---|
1595 | pos += length;
|
---|
1596 | }
|
---|
1597 |
|
---|
1598 | do_parse_line (line, file_name, line_number, context, use, project);
|
---|
1599 |
|
---|
1600 | if ((Cmt::get_action () == action_check_configuration) && CmtError::has_pending_error ())
|
---|
1601 | {
|
---|
1602 | //break;
|
---|
1603 | }
|
---|
1604 |
|
---|
1605 | line_number++;
|
---|
1606 | }
|
---|
1607 | }
|
---|
1608 |
|
---|
1609 | void SyntaxParser::do_parse_line (const cmt_string& line,
|
---|
1610 | const cmt_string& file_name,
|
---|
1611 | int line_number,
|
---|
1612 | ContextType context,
|
---|
1613 | Use* use,
|
---|
1614 | Project* project)
|
---|
1615 | {
|
---|
1616 | int length;
|
---|
1617 | int nl;
|
---|
1618 | int back_slash;
|
---|
1619 | cmt_string temp_line = line;
|
---|
1620 |
|
---|
1621 | if (temp_line.size () == 0) return;
|
---|
1622 | if (temp_line[0] == '#') return;
|
---|
1623 |
|
---|
1624 | nl = temp_line.find_last_of ('\n');
|
---|
1625 | if (nl != cmt_string::npos) temp_line.erase (nl);
|
---|
1626 |
|
---|
1627 | length = temp_line.size ();
|
---|
1628 | if (length == 0) return;
|
---|
1629 |
|
---|
1630 | //
|
---|
1631 | // We scan the line for handling backslashes.
|
---|
1632 | //
|
---|
1633 | // o Really terminating backslashes (ie those only followed by spaces/tabs
|
---|
1634 | // mean continued line
|
---|
1635 | //
|
---|
1636 | //
|
---|
1637 |
|
---|
1638 | bool finished = true;
|
---|
1639 |
|
---|
1640 | length = temp_line.size ();
|
---|
1641 |
|
---|
1642 | back_slash = temp_line.find_last_of ('\\');
|
---|
1643 |
|
---|
1644 | if (back_slash != cmt_string::npos)
|
---|
1645 | {
|
---|
1646 | //
|
---|
1647 | // This is the last backslash
|
---|
1648 | // check if there are only space chars after it
|
---|
1649 | //
|
---|
1650 |
|
---|
1651 | bool at_end = true;
|
---|
1652 |
|
---|
1653 | for (int i = (back_slash + 1); i < length; i++)
|
---|
1654 | {
|
---|
1655 | char c = temp_line[i];
|
---|
1656 | if ((c != ' ') && (c != '\t'))
|
---|
1657 | {
|
---|
1658 | at_end = false;
|
---|
1659 | break;
|
---|
1660 | }
|
---|
1661 | }
|
---|
1662 |
|
---|
1663 | if (at_end)
|
---|
1664 | {
|
---|
1665 | temp_line.erase (back_slash);
|
---|
1666 | finished = false;
|
---|
1667 | }
|
---|
1668 | else
|
---|
1669 | {
|
---|
1670 | // This was not a trailing backslash.
|
---|
1671 | finished = true;
|
---|
1672 | }
|
---|
1673 | }
|
---|
1674 |
|
---|
1675 | m_filtered_text += temp_line;
|
---|
1676 |
|
---|
1677 | if (!finished)
|
---|
1678 | {
|
---|
1679 | // We still need to accumulate forthcoming lines
|
---|
1680 | // before parsing the resulting text.
|
---|
1681 | return;
|
---|
1682 | }
|
---|
1683 |
|
---|
1684 | /*
|
---|
1685 | Here a full line (possibly accumulating several lines
|
---|
1686 | ended by backslashes) is parsed :
|
---|
1687 |
|
---|
1688 | o Special characters are filtered now :
|
---|
1689 |
|
---|
1690 | <cmt:tab/> \t
|
---|
1691 | <cmt:cr/> \r
|
---|
1692 | <cmt:lf/> \n
|
---|
1693 |
|
---|
1694 | o Split into words (a word is a string not containing
|
---|
1695 | spaces or enclosed in quotes)
|
---|
1696 |
|
---|
1697 | o Parse the word array (function Select)
|
---|
1698 |
|
---|
1699 | */
|
---|
1700 |
|
---|
1701 | m_filtered_text.replace_all ("<cmt:tab/>", "\t");
|
---|
1702 | m_filtered_text.replace_all ("<cmt:cr/>", "\r");
|
---|
1703 | m_filtered_text.replace_all ("<cmt:lf/>", "\n");
|
---|
1704 |
|
---|
1705 | if (Cmt::get_debug ())
|
---|
1706 | {
|
---|
1707 | cout << "parse_requirements_line [" << m_filtered_text << "]" << endl;
|
---|
1708 | }
|
---|
1709 |
|
---|
1710 | static CmtSystem::cmt_string_vector words;
|
---|
1711 |
|
---|
1712 | CmtSystem::split (m_filtered_text, " \t", words);
|
---|
1713 |
|
---|
1714 | if (words.size () != 0)
|
---|
1715 | {
|
---|
1716 | switch (context)
|
---|
1717 | {
|
---|
1718 | case project_context:
|
---|
1719 | do_parse_words (words, file_name, line_number, project);
|
---|
1720 | break;
|
---|
1721 | case package_context:
|
---|
1722 | do_parse_words (words, file_name, line_number, use);
|
---|
1723 | break;
|
---|
1724 | }
|
---|
1725 | }
|
---|
1726 |
|
---|
1727 | m_filtered_text.erase (0);
|
---|
1728 | }
|
---|
1729 |
|
---|
1730 | void SyntaxParser::do_parse_words (const CmtSystem::cmt_string_vector& words,
|
---|
1731 | const cmt_string& file_name,
|
---|
1732 | int line_number,
|
---|
1733 | Use* use)
|
---|
1734 | {
|
---|
1735 | CmtError::clear ();
|
---|
1736 |
|
---|
1737 | if (words.size () == 0) return;
|
---|
1738 |
|
---|
1739 | const cmt_string& command = words[0];
|
---|
1740 |
|
---|
1741 | if (command.size () == 0) return;
|
---|
1742 |
|
---|
1743 | //
|
---|
1744 | // First analyze the syntax
|
---|
1745 | //
|
---|
1746 |
|
---|
1747 | Kwd* keyword = m_keywords.find (command);
|
---|
1748 | if (keyword == 0)
|
---|
1749 | {
|
---|
1750 | /*
|
---|
1751 |
|
---|
1752 | When the first word of the line is not a keyword, it may be an
|
---|
1753 | implicit pattern application.
|
---|
1754 |
|
---|
1755 | */
|
---|
1756 |
|
---|
1757 | Pattern* p = Pattern::find (command);
|
---|
1758 | if (p == 0)
|
---|
1759 | {
|
---|
1760 | CmtError::set (CmtError::syntax_error, "ParseRequirements> ");
|
---|
1761 | }
|
---|
1762 | else
|
---|
1763 | {
|
---|
1764 | keyword = m_keywords.find ("apply_pattern");
|
---|
1765 | }
|
---|
1766 | }
|
---|
1767 |
|
---|
1768 | if (CmtError::has_pending_error ())
|
---|
1769 | {
|
---|
1770 | if (!Cmt::get_quiet ())
|
---|
1771 | {
|
---|
1772 | cerr << "#CMT> bad syntax in requirements of " << use->get_package_name ()
|
---|
1773 | << " " << use->version
|
---|
1774 | << " " << use->specified_path
|
---|
1775 | << " line #" << line_number;
|
---|
1776 | cerr << " [" << command << " ...]" << endl;
|
---|
1777 | }
|
---|
1778 |
|
---|
1779 | return;
|
---|
1780 | }
|
---|
1781 |
|
---|
1782 | //
|
---|
1783 | // Then interpret the action
|
---|
1784 | //
|
---|
1785 |
|
---|
1786 | keyword->action (words, use, file_name, line_number);
|
---|
1787 | }
|
---|
1788 |
|
---|
1789 | void SyntaxParser::do_parse_words (const CmtSystem::cmt_string_vector& words,
|
---|
1790 | const cmt_string& file_name,
|
---|
1791 | int line_number,
|
---|
1792 | Project* project)
|
---|
1793 | {
|
---|
1794 | CmtError::clear ();
|
---|
1795 |
|
---|
1796 | if (words.size () == 0) return;
|
---|
1797 |
|
---|
1798 | const cmt_string& command = words[0];
|
---|
1799 |
|
---|
1800 | if (command.size () == 0) return;
|
---|
1801 |
|
---|
1802 | //
|
---|
1803 | // First analyze the syntax
|
---|
1804 | //
|
---|
1805 |
|
---|
1806 | Kwd* keyword = m_project_keywords.find (command);
|
---|
1807 | if (keyword == 0)
|
---|
1808 | {
|
---|
1809 | CmtError::set (CmtError::syntax_error, "ParseRequirements> ");
|
---|
1810 | }
|
---|
1811 |
|
---|
1812 | if (CmtError::has_pending_error ())
|
---|
1813 | {
|
---|
1814 | if (!Cmt::get_quiet ())
|
---|
1815 | {
|
---|
1816 | cerr << "#CMT> bad syntax in project file of " << project->get_name ()
|
---|
1817 | << " line #" << line_number;
|
---|
1818 | cerr << " [" << command << " ...]" << endl;
|
---|
1819 | }
|
---|
1820 |
|
---|
1821 | return;
|
---|
1822 | }
|
---|
1823 |
|
---|
1824 | //
|
---|
1825 | // Then interpret the action
|
---|
1826 | //
|
---|
1827 |
|
---|
1828 | keyword->action (words, project, file_name, line_number);
|
---|
1829 | }
|
---|
1830 |
|
---|
1831 |
|
---|
1832 |
|
---|
1833 |
|
---|