Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

49 lines (35 sloc) 1.103 kb
%{
#include <string.h>
#include "whistlepig.h"
#include "query-parser.h"
#include "query-parser.tab.h"
#define YY_EXTRA_TYPE query_parse_context*
#define YY_USER_ACTION yylloc->first_line = yylineno;
#define YY_INPUT(buf,result,max_size) \
{ \
if(yyextra->input[0] == 0) \
result = YY_NULL; \
else { \
buf[0] = yyextra->input[0]; \
yyextra->input++; \
result = 1; \
} \
}
%}
%option 8bit reentrant fast noyywrap yylineno
%option outfile="query-parser.lex.c" header-file="query-parser.lex.h"
%option prefix="query_parser_"
%option bison-bridge bison-locations
/* for the first char, everything is allowed except ()"-~:* */
FIRSTWORDCHAR [^\n[:blank:]()"~:\*-]
/* inside a word, everything is allowed except ()": */
INNERWORDCHAR [^\n[:blank:]()":]
%%
OR return OR;
{FIRSTWORDCHAR}{INNERWORDCHAR}* {
yylval->string = strdup(yytext);
return WORD;
}
[\n[:blank:]] ; // nothing
. return yytext[0];
%%
Jump to Line
Something went wrong with that request. Please try again.