mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
da5d653de8
Not wholly convinced this is a good idea, maybe "not" should be a builtin function instead? 'not (.a == .b)' vs. '.a == .b | not'
43 lines
885 B
Plaintext
43 lines
885 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; }
|
|
"if" { return IF; }
|
|
"then" { return THEN; }
|
|
"else" { return ELSE; }
|
|
"elif" { return ELSE_IF; }
|
|
"and" { return AND; }
|
|
"or" { return OR; }
|
|
"not" { return NOT; }
|
|
"end" { return END; }
|
|
"//" { return DEFINEDOR; }
|
|
"."|"="|";"|"["|"]"|","|":"|"("|")"|"{"|"}"|"|"|"+"|"\$" { return yytext[0];}
|
|
|
|
\"(\\.|[^\\"])*\" |
|
|
-?[0-9.]+([eE][+-]?[0-9]+)? {
|
|
yylval->literal = jv_parse_sized(yytext, yyleng); 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; }
|
|
*/
|