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 virtual { return T_VIRTUAL; }
32 const { return T_CONST; }
33 unsigned { return T_UNSIGNED; }
34 signed { return T_SIGNED; }
35 void { return T_VOID; }
36 bool { return T_BOOL; }
37 char { return T_CHAR; }
38 short { return T_SHORT; }
40 long { return T_LONG; }
41 float { return T_FLOAT; }
42 double { return T_DOUBLE; }
43 public { return T_PUBLIC; }
44 protected { return T_PROTECTED; }
45 private { return T_PRIVATE; }
46 namespace { return T_NAMESPACE; }
47 [a-zA-Z_][a-zA-Z_0-9]* {
48 Namespace* ns = search_namespace;
50 ns = current_namespace;
52 yylval->atomic_type = ns->_findType(yytext, search_down);
53 if(yylval->atomic_type)
55 // or a namespace? (hack for now...)
56 yylval->_namespace = ns->_findNamespace(yytext, search_down);
57 if(yylval->_namespace) {
58 return T_NAMESPACEREF;
61 yylval->str = strdup(yytext);
64 \:\: { return T_DDCOL; }
66 yylval->ival = atoi(yytext);
69 [0-9]*\.[0-9]+(e[0-9]+)? {
70 yylval->fval = atof(yytext);
74 yylval->str = strdup(yytext);
77 . { return yytext[0]; }