%{
#include <fcall.h>
#include <thread.h>
#include <9p.h>
#include "y.tab.h"
#include "common.h"
#include "debug.h"
#include "configyacclex.h"
extern YYSTYPE yylval;
#define DEBUG_LEX false
%}
%%
[-_a-z]+ {
NOISE(DEBUG_LEX, "yylex got word: %s", yytext);
yylval = estrdup_fs(yytext);
return TOKEN_WORD;
}
\<([^>]|\\>)*\> {
yylval = estrdup_fs(yytext + 1); /* get rid of < */
yylval[strlen(yylval) - 1] = '\0'; /* get rid of > */
NOISE(DEBUG_LEX, "yylex got setting: %s", yylval);
return TOKEN_SETTING;
}
\/?([-_a-zA-Z0-9.]|\\.)+(\/([-_a-zA-Z0-9.]|\\.)+)* {
NOISE(DEBUG_LEX, "yylex got path: %s", yytext);
yylval = estrdup_fs(yytext);
return TOKEN_PATH;
}
\( {
NOISE(DEBUG_LEX, "yylex got (");
return TOKEN_LPAREN;
}
\) {
NOISE(DEBUG_LEX, "yylex got )");
return TOKEN_RPAREN;
}
\|\| {
NOISE(DEBUG_LEX, "yylex got or");
return TOKEN_OR;
}
&& {
NOISE(DEBUG_LEX, "yylex got and");
return TOKEN_AND;
}
\\\n {
NOISE(DEBUG_LEX, "yylex got line continuation");
}
#([^\n]*\\\n)*[^\n]*\n {
NOISE(DEBUG_LEX, "yylex got comment");
}
# {
NOISE(DEBUG_LEX, "yylex got pound");
}
\n {
NOISE(DEBUG_LEX, "yylex got newline");
}
[ \t] {
NOISE(DEBUG_LEX, "yylex got space or tab");
}
%%
|