summaryrefslogtreecommitdiff
path: root/c-flex-bison/lexer.l
blob: 6c6bf6fc1a6c28d60aa05483c47b31e5e8d7af1e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
%{
#include "tree.h"
#include "parser.h"
%}

%option reentrant noyywrap bison-bridge header-file="lexer.h"

%%

"(" { return TREE_START; }
")" { return TREE_END; }

[ \n]+ {
yylval->exp = tree_alloc(delimiter_run, yytext, yyleng);
return VAL;
}

([^ \n()\\]|\\[\\() \n])+ {
yylval->exp = tree_alloc(escaped_run, yytext, yyleng);
return VAL;
}

. { ECHO; return FAILURE; }