%{ #include #include #include "idlparser.yy.hh" static void yyunput(int, char*); //static void* yy_flex_realloc(void*, yy_size_t); void dummy( void ) { yyunput(0,0); // yy_flex_realloc(0,0); } #define STR yylval.string=strdup(yytext); %} %option yylineno %x comment %% "/*" { BEGIN(comment); } "*"+[^*/]* /* eat up '*'s not followed by '/'s */ [^*]* "*"+"/" BEGIN(INITIAL); . { printf("Error, invalid character\"%s\". lexer failure, report bug\n",yytext); abort(); } \/\/.*\n /* ignore C++ style comments */ namespace { return NAMESPACE;} class { return CLASS;} adapt { return ADAPT; } #include { return INCLUDE; } int8_t { STR; return INT8;} int16_t { STR; return INT16;} int32_t { STR; return INT32;} int64_t { STR; return INT64;} uint8_t { STR; return UINT8;} uint16_t { STR; return UINT16;} uint32_t { STR; return UINT32;} uint64_t { STR; return UINT64;} long[ \t\n]+double { STR; return LDOUBLE; } double { STR; return DOUBLE; } uid { STR; return UID; } std::string { STR; return STRING; } string { STR; return STRING; } typedef { STR; return TYPEDEF; } enum { STR; return ENUM; } oneway { STR; return ONEWAY;} cached { STR; return CACHED;} inout { STR; return INOUT;} public { STR; return PUBLIC; } protected { STR; return PROTECTED; } private { STR; return PRIVATE; } out { STR; return OUT;} in { STR; return IN;} std::list { STR; return LIST; } list { STR; return LIST; } std::vector { STR; return VECTOR; } vector { STR; return VECTOR; } std::set { STR; return SET; } set { STR; return SET; } std::map { STR; return MAP; } map { STR; return MAP; } std::pair { STR; return PAIR; } pair { STR; return PAIR; } void { STR; return VOID; } deferrable { STR; return DEFERRABLE; } [0-9]+ { yylval.number=atoi(yytext); return NUMBER;} [a-zA-Z_][a-zA-Z0-9_]* { STR; return IDENTIFIER;} [a-zA-Z_][a-zA-Z0-9_\/\.]* { STR; return FILENAME;} [ \n\t]+ /* ignore whitespace */{ } . { return (int) yytext[0]; REJECT; } %% /*[0-9]+ { yylval.number=atoi(yytext); return INTEGER;}*/