hid/gtk: Fix strncat length when building accelerator string. (CODE!)
[geda-pcb/gde.git] / src / res_lex.l
blob0525aed77c1347d09b7c33ae6050c4cbf1b7ca9f
1 /* $Id$ */
3 %{
5 #ifdef HAVE_CONFIG_H
6 #include "config.h"
7 #endif
9 #ifdef HAVE_STRING_H
10 #include <string.h>
11 #endif
13 #include "global.h"
14 #include "resource.h"
15 #include "res_parse.h"
17 #ifdef HAVE_LIBDMALLOC
18 #include <dmalloc.h>
19 #endif
21 RCSID("$Id$");
23 #define YY_INPUT(buf,result,max_size) { result = res_parse_getchars(buf, max_size); }
25 #ifdef FLEX_SCANNER
26 #define yyunput ATTRIBUTE_UNUSED yyunput
27 #endif
29 extern int res_lineno;
30 extern int res_parse_getchars(char *buf, int max_size);
34 %option prefix="res"
35 %option outfile="lex.yy.c"
36 %option yylineno
37 %option noyywrap
39 PARENSTR        ([^ (){}=\"\'\t\r\n]|\([^\)]*\))+
40 INCSTR          @[a-z0-9A-Z_]+
41 COMMENT         #[^\n]*
45 \"[^"]*\"       { reslval.sval = strdup(yytext+1);
46                   reslval.sval[strlen(reslval.sval) - 1] = 0;
47                   return STRING; }
49 \'[^']*\'       { reslval.sval = strdup(yytext+1);
50                   reslval.sval[strlen(reslval.sval) - 1] = 0;
51                   return STRING; }
53 {COMMENT}\n     { res_lineno++; }
54 [ \t\r\n]       { if (yytext[0] == '\n') res_lineno++; }
56 {INCSTR}        { reslval.sval = strdup(yytext);
57                           return INCLUDE; }
59 {PARENSTR}      { reslval.sval = strdup(yytext);
60                           return STRING; }
62 .               { return yytext[0]; }
66 /* ' */