fela

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

lex.l (387B)


      1 %{
      2 #include <stddef.h>
      3 #include "parse.h"
      4 
      5 size_t offset, lineno;
      6 
      7 #define YY_USER_ACTION         \
      8 	offset += yyleng;      
      9 
     10 
     11 %}
     12 
     13 %%
     14 "func"			{ return FUNC; }
     15 "->"			{ return RETTYPE; }
     16 [0-9]+ 			{ yylval.l = atol(yytext); return NUMBER; }
     17 [A-z][A-z0-9]* 		{ yylval.s = yytext; return NAME; }
     18 [;=+\-*/\{\}\(\)\[\]] 	{ return yytext[0]; }
     19 [ \t]			{;}
     20 [\n]			{ offset = 0; lineno++; }
     21 %%