git » unicorn-sparkle-basic.git » line-edit-recall » tree

[line-edit-recall] / usbasic.l

%{
#include "usbasic.tab.h"
%}

%option nounput noinput

%%

[ \t]+              ; /* Ignore whitespaces */
\n                  { return 0; }
"print"             return PRINT;
"if"                return IF;
"then"              return THEN;
"goto"              return GOTO;
"<"                 return LT;
"<="                return LTE;
">"                 return GT;
">="                return GTE;
"=="                return EQ;
[0-9]+              { yylval.num_int = atoi(yytext); return NUMBER_INTEGER; }
[a-zA-Z][a-zA-Z0-9]* { yylval.id = strdup(yytext); return IDENTIFIER; }
\"([^\\\"]|\\.)*\"   { yylval.str = strdup(yytext); return STRING; }
.                   return *yytext;

%%