debuggers.hg

annotate tools/libxl/libxlu_cfg_l.l @ 22848:6341fe0f4e5a

Added tag 4.1.0-rc2 for changeset 9dca60d88c63
author Keir Fraser <keir@xen.org>
date Tue Jan 25 14:06:55 2011 +0000 (2011-01-25)
parents cb94dbe20f97
children
rev   line source
keir@21040 1 /* -*- fundamental -*- */
keir@21040 2
keir@21040 3 %{
keir@21040 4 #include "libxlu_cfg_i.h"
keir@21040 5
keir@21040 6 #define ctx ((CfgParseContext*)yyextra)
keir@21040 7 #define YY_NO_INPUT
keir@21040 8
keir@21040 9 #define GOT(x) do{ \
keir@21040 10 yylloc->first_line= yylineno; \
keir@21040 11 return (x); \
keir@21040 12 }while(0)
keir@21040 13
Ian@22062 14 /* Some versions of flex have a bug (Fedora bugzilla 612465) which causes
Ian@22062 15 * it to fail to declare these functions, which it defines. So declare
Ian@22062 16 * them ourselves. Hopefully we won't have to simultaneously support
Ian@22062 17 * a flex version which declares these differently somehow. */
Ian@22062 18 int xlu__cfg_yyget_column(yyscan_t yyscanner);
Ian@22062 19 void xlu__cfg_yyset_column(int column_no, yyscan_t yyscanner);
Ian@22062 20
keir@21040 21 %}
keir@21040 22
keir@21040 23 %option warn
keir@21040 24 %option nodefault
keir@21040 25 %option batch
keir@21040 26 %option 8bit
keir@21040 27 %option yylineno
keir@21040 28 %option noyywrap
keir@21040 29 %option bison-bridge
keir@21040 30 %option bison-locations
keir@21040 31 %option reentrant
keir@21040 32 %option prefix="xlu__cfg_yy"
keir@21040 33 %option nounput
keir@21040 34
keir@21040 35 %x lexerr
keir@21040 36
keir@21040 37 %%
keir@21040 38
keir@21040 39 [a-z][_0-9a-z]* {
keir@21040 40 yylval->string= xlu__cfgl_strdup(ctx,yytext);
keir@21040 41 GOT(IDENT);
keir@21040 42 }
keir@21040 43 [0-9][0-9a-fx]* {
keir@21040 44 yylval->string= xlu__cfgl_strdup(ctx,yytext);
keir@21040 45 GOT(NUMBER);
keir@21040 46 }
keir@21040 47
keir@21040 48 [ \t]
keir@21040 49
keir@21040 50 , { GOT(','); }
keir@21040 51 \[ { GOT('['); }
keir@21040 52 \] { GOT(']'); }
keir@21040 53 \= { GOT('='); }
keir@21040 54 \; { GOT(';'); }
keir@21040 55
keir@21040 56 \n|\#.*\n { yylloc->first_line= yylineno-1; return NEWLINE; }
keir@21040 57
keir@21040 58 \'([^\'\\\n]|\\.)*\' {
keir@21040 59 yylval->string= xlu__cfgl_dequote(ctx,yytext);
keir@21040 60 GOT(STRING);
keir@21040 61 }
keir@21040 62 \"([^\"\\\n]|\\.)*\" {
keir@21040 63 yylval->string= xlu__cfgl_dequote(ctx,yytext);
keir@21040 64 GOT(STRING);
keir@21040 65 }
keir@21040 66
Ian@22781 67 [+-.():] {
Ian@22781 68 ctx->likely_python= 1;
Ian@22781 69 BEGIN(lexerr);
Ian@22781 70 yymore();
Ian@22781 71 }
Ian@22781 72
keir@21040 73 . {
keir@21040 74 BEGIN(lexerr);
keir@21040 75 yymore();
keir@21040 76 }
keir@21040 77
keir@21040 78 <lexerr>[^ \t\n]*|[ \t] {
keir@21040 79 xlu__cfgl_lexicalerror(ctx,"lexical error");
keir@21040 80 BEGIN(0);
keir@21040 81 }
keir@21040 82
keir@21040 83 <lexerr>\n {
keir@21040 84 xlu__cfgl_lexicalerror(ctx,"lexical error");
keir@21040 85 BEGIN(0);
keir@21040 86 GOT(NEWLINE);
keir@21040 87 }