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 for(std::vector<AtomicType*>::iterator i = ns->types.begin();
53 i != ns->types.end(); ++i) {
54 AtomicType* type = *i;
55 if(type->name == yytext) {
56 yylval->atomic_type = type;
60 // or a namespace? (hack for now...)
61 yylval->_namespace = ns->_findNamespace(yytext, search_down);
62 if(yylval->_namespace) {
63 return T_NAMESPACEREF;
66 yylval->str = strdup(yytext);
69 \:\: { return T_DDCOL; }
71 yylval->ival = atoi(yytext);
74 [0-9]*\.[0-9]+(e[0-9]+)? {
75 yylval->fval = atof(yytext);
79 yylval->str = strdup(yytext);
82 . { return yytext[0]; }