8 #define YY_DECL int yylex YY_PROTO(( YYSTYPE* yylval ))
10 #define YY_INPUT(buf, result, max_size) \
12 input->read(buf, max_size); \
13 result = input->gcount(); \
20 /* %option never-interactive */
24 #.* /* ignore preprocessor directives */
25 [[:space:]]+ /* eat spaces */
26 \/\*.*\*\/ /* eat comment */
27 \/\/[^\n]*\n /* eat comment */
28 class { return T_CLASS; }
29 struct { return T_STRUCT; }
30 static { return T_STATIC; }
31 const { return T_CONST; }
32 unsigned { return T_UNSIGNED; }
33 signed { return T_SIGNED; }
34 void { return T_VOID; }
35 bool { return T_BOOL; }
36 char { return T_CHAR; }
37 short { return T_SHORT; }
39 long { return T_LONG; }
40 float { return T_FLOAT; }
41 double { return T_DOUBLE; }
42 public { return T_PUBLIC; }
43 protected { return T_PROTECTED; }
44 private { return T_PRIVATE; }
45 namespace { return T_NAMESPACE; }
46 [a-zA-Z_][a-zA-Z_0-9]* {
47 Namespace* ns = search_namespace;
49 ns = current_namespace;
51 for(std::vector<AtomicType*>::iterator i = ns->types.begin();
52 i != ns->types.end(); ++i) {
53 AtomicType* type = *i;
54 if(type->name == yytext) {
55 yylval->atomic_type = type;
59 // or a namespace? (hack for now...)
60 yylval->_namespace = ns->_findNamespace(yytext, search_down);
61 if(yylval->_namespace) {
62 return T_NAMESPACEREF;
65 yylval->str = strdup(yytext);
68 \:\: { return T_DDCOL; }
70 yylval->ival = atoi(yytext);
73 [0-9]*\.[0-9]+(e[0-9]+)? {
74 yylval->fval = atof(yytext);
78 yylval->str = strdup(yytext);
81 . { return yytext[0]; }