Diffstat (limited to 'include/sitecing/sitecing_parser.h') (more/less context) (show whitespace changes)
-rw-r--r-- | include/sitecing/sitecing_parser.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/sitecing/sitecing_parser.h b/include/sitecing/sitecing_parser.h index a53ef22..bcabc5c 100644 --- a/include/sitecing/sitecing_parser.h +++ b/include/sitecing/sitecing_parser.h | |||
@@ -1,68 +1,71 @@ | |||
1 | #ifndef __SITECING_SITECING_PARSER_H | 1 | #ifndef __SITECING_SITECING_PARSER_H |
2 | #define __SITECING_SITECING_PARSER_H | 2 | #define __SITECING_SITECING_PARSER_H |
3 | 3 | ||
4 | #include <string> | 4 | #include <string> |
5 | #include <list> | 5 | #include <list> |
6 | #include <map> | 6 | #include <map> |
7 | #include <stdexcept> | 7 | #include <stdexcept> |
8 | using namespace std; | 8 | using namespace std; |
9 | 9 | ||
10 | #include "sitecing/component_factory.h" | 10 | #include "sitecing/component_factory.h" |
11 | using namespace sitecing; | 11 | using namespace sitecing; |
12 | 12 | ||
13 | /** | 13 | /** |
14 | * @file | 14 | * @file |
15 | * @brief The component source parser. | 15 | * @brief The component source parser. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #ifndef sitecing_parser_flexlexer_once | 18 | #ifndef sitecing_parser_flexlexer_once |
19 | #define sitecing_parser_flexlexer_once | 19 | #define sitecing_parser_flexlexer_once |
20 | #undef yyFlexLexer | 20 | #undef yyFlexLexer |
21 | /** | ||
22 | * nevermind me | ||
23 | */ | ||
21 | #define yyFlexLexer sitecing_parserFlexLexer | 24 | #define yyFlexLexer sitecing_parserFlexLexer |
22 | #include <FlexLexer.h> | 25 | #include <FlexLexer.h> |
23 | #undef yyFlexLexerOnce | 26 | #undef yyFlexLexerOnce |
24 | #endif | 27 | #endif |
25 | 28 | ||
26 | /** | 29 | /** |
27 | * The component source parser. | 30 | * The component source parser. |
28 | */ | 31 | */ |
29 | class sitecing_parser : public sitecing_parserFlexLexer { | 32 | class sitecing_parser : public sitecing_parserFlexLexer { |
30 | public: | 33 | public: |
31 | /** | 34 | /** |
32 | * The ancestor class definition. | 35 | * The ancestor class definition. |
33 | */ | 36 | */ |
34 | class ancestor_class { | 37 | class ancestor_class { |
35 | public: | 38 | public: |
36 | /** | 39 | /** |
37 | * The class name. | 40 | * The class name. |
38 | */ | 41 | */ |
39 | string name; | 42 | string name; |
40 | /** | 43 | /** |
41 | * The source component path. | 44 | * The source component path. |
42 | */ | 45 | */ |
43 | string path; | 46 | string path; |
44 | 47 | ||
45 | /** | 48 | /** |
46 | * @param n the class name. | 49 | * @param n the class name. |
47 | * @param p the component path. | 50 | * @param p the component path. |
48 | */ | 51 | */ |
49 | ancestor_class(const string& n,const string& p) | 52 | ancestor_class(const string& n,const string& p) |
50 | : name(n), path(p) { } | 53 | : name(n), path(p) { } |
51 | }; | 54 | }; |
52 | /** | 55 | /** |
53 | * The list of ancestor classes. | 56 | * The list of ancestor classes. |
54 | */ | 57 | */ |
55 | typedef list<ancestor_class> ancestor_classes_t; | 58 | typedef list<ancestor_class> ancestor_classes_t; |
56 | /** | 59 | /** |
57 | * The ancestor classes. | 60 | * The ancestor classes. |
58 | */ | 61 | */ |
59 | ancestor_classes_t ancestor_classes; | 62 | ancestor_classes_t ancestor_classes; |
60 | /** | 63 | /** |
61 | * The member variable definition. | 64 | * The member variable definition. |
62 | */ | 65 | */ |
63 | class member_variable { | 66 | class member_variable { |
64 | public: | 67 | public: |
65 | /** | 68 | /** |
66 | * The member variable type. | 69 | * The member variable type. |
67 | */ | 70 | */ |
68 | string type; | 71 | string type; |
@@ -266,69 +269,78 @@ class sitecing_parser : public sitecing_parserFlexLexer { | |||
266 | * @todo TODO: wish I could remember the details -- document me. | 269 | * @todo TODO: wish I could remember the details -- document me. |
267 | */ | 270 | */ |
268 | string component_basename; | 271 | string component_basename; |
269 | /** | 272 | /** |
270 | * The skeleton file name. | 273 | * The skeleton file name. |
271 | */ | 274 | */ |
272 | string skeleton; | 275 | string skeleton; |
273 | /** | 276 | /** |
274 | * The component class name. | 277 | * The component class name. |
275 | */ | 278 | */ |
276 | string class_name; | 279 | string class_name; |
277 | /** | 280 | /** |
278 | * Output basename. | 281 | * Output basename. |
279 | * @todo TODO: wish I could remember the details -- document me. | 282 | * @todo TODO: wish I could remember the details -- document me. |
280 | */ | 283 | */ |
281 | string output_basename; | 284 | string output_basename; |
282 | /** | 285 | /** |
283 | * Verbatim declaration part. | 286 | * Verbatim declaration part. |
284 | */ | 287 | */ |
285 | string decl; | 288 | string decl; |
286 | /** | 289 | /** |
287 | * Verbatim implementation part. | 290 | * Verbatim implementation part. |
288 | */ | 291 | */ |
289 | string impl; | 292 | string impl; |
290 | /** | 293 | /** |
291 | * The reference to the component factory object. | 294 | * The reference to the component factory object. |
292 | */ | 295 | */ |
293 | component_factory& factory; | 296 | component_factory& factory; |
294 | /** | 297 | /** |
295 | * Pragma map type. | 298 | * Pragma map type. |
296 | */ | 299 | */ |
297 | typedef map<string,string> pragmas_t; | 300 | typedef map<string,string> pragmas_t; |
298 | /** | 301 | /** |
299 | * Pragma's found in the component. | 302 | * Pragma's found in the component. |
300 | */ | 303 | */ |
301 | pragmas_t pragmas; | 304 | pragmas_t pragmas; |
302 | 305 | ||
303 | /** | 306 | /** |
304 | * @param f the component factory. | 307 | * @param f the component factory. |
305 | */ | 308 | */ |
306 | sitecing_parser(component_factory& f); | 309 | sitecing_parser(component_factory& f); |
307 | 310 | ||
308 | /** | 311 | /** |
309 | * Preprocess file. | 312 | * Preprocess file. |
310 | * @param in input file name. | 313 | * @param in input file name. |
311 | */ | 314 | */ |
312 | void preprocess(const string& in); | 315 | void preprocess(const string& in); |
313 | 316 | ||
317 | /** | ||
318 | * Output parsed data | ||
319 | * @param buf pointer to the data | ||
320 | * @param size length of the buffer pointed by buf | ||
321 | */ | ||
314 | virtual void LexerOutput(const char *buf,int size); | 322 | virtual void LexerOutput(const char *buf,int size); |
323 | /** | ||
324 | * Lexer generated by flex | ||
325 | * @return zero on success | ||
326 | */ | ||
315 | virtual int yylex(); | 327 | virtual int yylex(); |
316 | 328 | ||
317 | /** | 329 | /** |
318 | * Retrieve reference to the to of the modes stack. | 330 | * Retrieve reference to the to of the modes stack. |
319 | * @return the reference in question. | 331 | * @return the reference in question. |
320 | */ | 332 | */ |
321 | modus_operandi& M() { | 333 | modus_operandi& M() { |
322 | return modi.front(); | 334 | return modi.front(); |
323 | } | 335 | } |
324 | /** | 336 | /** |
325 | * Anchor the output with the #line, if we're not in the text output mode. | 337 | * Anchor the output with the \#line, if we're not in the text output mode. |
326 | */ | 338 | */ |
327 | void soft_anchor(); | 339 | void soft_anchor(); |
328 | /** | 340 | /** |
329 | * Anchor the output with the #line directive, changing to the appropriate output mode if needed. | 341 | * Anchor the output with the \#line directive, changing to the appropriate output mode if needed. |
330 | */ | 342 | */ |
331 | void anchor(); | 343 | void anchor(); |
332 | }; | 344 | }; |
333 | 345 | ||
334 | #endif /* __SITECING_SITECING_PARSER_H */ | 346 | #endif /* __SITECING_SITECING_PARSER_H */ |