debuggers.hg

view tools/libxl/libxlu_cfg_l.l @ 22906:700ac6445812

Now add KDB to the non-kdb tree
author Mukesh Rathor
date Thu Feb 03 15:42:41 2011 -0800 (2011-02-03)
parents cb94dbe20f97
children
line source
1 /* -*- fundamental -*- */
3 %{
4 #include "libxlu_cfg_i.h"
6 #define ctx ((CfgParseContext*)yyextra)
7 #define YY_NO_INPUT
9 #define GOT(x) do{ \
10 yylloc->first_line= yylineno; \
11 return (x); \
12 }while(0)
14 /* Some versions of flex have a bug (Fedora bugzilla 612465) which causes
15 * it to fail to declare these functions, which it defines. So declare
16 * them ourselves. Hopefully we won't have to simultaneously support
17 * a flex version which declares these differently somehow. */
18 int xlu__cfg_yyget_column(yyscan_t yyscanner);
19 void xlu__cfg_yyset_column(int column_no, yyscan_t yyscanner);
21 %}
23 %option warn
24 %option nodefault
25 %option batch
26 %option 8bit
27 %option yylineno
28 %option noyywrap
29 %option bison-bridge
30 %option bison-locations
31 %option reentrant
32 %option prefix="xlu__cfg_yy"
33 %option nounput
35 %x lexerr
37 %%
39 [a-z][_0-9a-z]* {
40 yylval->string= xlu__cfgl_strdup(ctx,yytext);
41 GOT(IDENT);
42 }
43 [0-9][0-9a-fx]* {
44 yylval->string= xlu__cfgl_strdup(ctx,yytext);
45 GOT(NUMBER);
46 }
48 [ \t]
50 , { GOT(','); }
51 \[ { GOT('['); }
52 \] { GOT(']'); }
53 \= { GOT('='); }
54 \; { GOT(';'); }
56 \n|\#.*\n { yylloc->first_line= yylineno-1; return NEWLINE; }
58 \'([^\'\\\n]|\\.)*\' {
59 yylval->string= xlu__cfgl_dequote(ctx,yytext);
60 GOT(STRING);
61 }
62 \"([^\"\\\n]|\\.)*\" {
63 yylval->string= xlu__cfgl_dequote(ctx,yytext);
64 GOT(STRING);
65 }
67 [+-.():] {
68 ctx->likely_python= 1;
69 BEGIN(lexerr);
70 yymore();
71 }
73 . {
74 BEGIN(lexerr);
75 yymore();
76 }
78 <lexerr>[^ \t\n]*|[ \t] {
79 xlu__cfgl_lexicalerror(ctx,"lexical error");
80 BEGIN(0);
81 }
83 <lexerr>\n {
84 xlu__cfgl_lexicalerror(ctx,"lexical error");
85 BEGIN(0);
86 GOT(NEWLINE);
87 }