1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00
stedolan-jq/c/lexer.l
Stephen Dolan 2cb9a6e61d Move from Jansson to JV - everything but the interpreter loop
Passes valgrind --leak-check=full.
2012-09-02 16:31:59 +01:00

28 lines
637 B
Plaintext

%{
#include "compile.h"
#include "parser.tab.h" /* Generated by bison. */
%}
%option noyywrap nounput noinput nodefault
%option reentrant
%option bison-bridge bison-locations
%%
"==" { return EQ; }
"as" { return AS; }
"def" { return DEF; }
"|=" { return SETPIPE; }
"."|"="|";"|"["|"]"|","|":"|"("|")"|"{"|"}"|"|"|"+"|"\$" { return yytext[0];}
[[:digit:]]+ { yylval->literal = jv_number((double)atoi(yytext)); return LITERAL;}
[[:alnum:]]+ { yylval->literal = jv_string(yytext); return IDENT;}
[ \n\t]+ {}
%%
/* perhaps these should be calls... */
/*
"true" { return TRUE; }
"false" { return FALSE; }
"null" { return NULL; }
*/