"Fossies" - the Fresh Open Source Software Archive

Member "srg-1.3.6/libconfig/config.lexer.l" (5 Aug 2009, 629 Bytes) of package /linux/privat/old/srg-1.3.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 %{
    2 #include <string.h>
    3 #include "config.parser.h"
    4 %}
    5 
    6 %x double_quote
    7 
    8 %%
    9 
   10 \"  BEGIN(double_quote);
   11 <double_quote>[^\"]*    { yylval.str=(char *)strdup(yytext); return TOK_STRING; }
   12 <double_quote>\"    BEGIN(INITIAL);
   13 
   14 false       { return TOK_FALSE; }
   15 off     { return TOK_FALSE; }
   16 true        { return TOK_TRUE; }
   17 on      { return TOK_TRUE; }
   18 [0-9]+      { yylval.i=atoi(yytext); return TOK_INTEGER; }
   19 [_A-Za-z0-9]+   { yylval.str=(char*)strdup(yytext); return TOK_IDENTIFIER; }
   20 \n      { return TOK_EOL; }
   21 [[:blank:]] { return TOK_WHITE; }
   22 #.*\n       { return TOK_WHITE; }
   23 .       { return TOK_UNKNOWN; }
   24 
   25 %%
   26 
   27 void yyerror(char *s)
   28 {
   29     fprintf(stderr,"error: %s\n",s);
   30 }