Home | History | Annotate | Line # | Download | only in veriexecctl
veriexecctl_conf.l revision 1.2
      1 %{
      2 /*
      3  * Configuration file lexer for Verified exec
      4  *
      5  *
      6  */
      7 
      8 #include <stdio.h>
      9 #include <string.h>
     10 #include "veriexecctl_parse.h"
     11 
     12 int lineno = 1;
     13 
     14 void yyerror(const char *message);
     15 void warning(const char *message);
     16 int yylex(void);
     17 
     18 %}
     19 
     20 %%
     21 
     22 path     { return PATH; }
     23 string   { return STRING; }
     24 eol      { return EOL; }
     25 
     26 \/[^ 	]+  {
     27 	yylval.string = strdup(yytext);
     28 	return PATH;
     29 }
     30 
     31 [0-9a-zA-Z]+  {
     32 	yylval.string = strdup(yytext);
     33 	return STRING;
     34 }
     35 
     36 \n      {
     37 	lineno++;  /* for error reporting */
     38 	return EOL;
     39 }
     40 
     41 [ \t\r] ;  /* eat white ones */
     42 
     43 #.* ;      /* comment */
     44 
     45 .    yyerror("invalid character");
     46 
     47 %%
     48 
     49 void yyerror(const char *string)
     50 {
     51   fprintf(stderr, "%d: %s at %s\n", lineno, string, yytext);
     52 }
     53