source: CONFIG/publications/ICOLMDZORINCA_CO2_Transport_GMD_2023/XIOS/src/parse_expr/lex_parser.lex @ 6607

Last change on this file since 6607 was 6607, checked in by acosce, 10 months ago

XIOS used for ICOLMDZORINCA_CO2_Transport_GMD_2023

File size: 1.3 KB
Line 
1%option noyywrap
2%{
3
4extern "C"
5{
6  int yylex(void);
7}
8#undef  YY_INPUT
9#define YY_INPUT(b, r, s) readInputForLexer(b, &r, s)
10#include <string>
11
12int readInputForLexer(char* buffer, size_t* numBytesRead, size_t maxBytesToRead);
13
14#include "filter_expr_node.hpp"
15#include "yacc_parser.hpp"
16
17%}
18
19white    [ \t]+
20
21digit    [0-9]
22integer  {digit}+
23exponant [eE][+-]?{integer}
24real     {integer}("."{integer})?{exponant}?
25id       [a-zA-Z][a-zA-Z0-9_]*
26average  @{id}
27var      \${id}
28
29%%
30
31{white}   { /* We ignore white characters */ }
32
33{real}    {
34            yylval.str = new std::string(yytext);
35            return NUMBER;
36          }
37
38{average} {
39            yylval.str = new std::string(yytext + 1);
40            return AVERAGE;
41          }
42
43{var}     {
44            yylval.str = new std::string(yytext + 1);
45            return VAR;
46          }
47
48{id}      {
49            yylval.str = new std::string(yytext);
50            return ID;
51          }                   
52                 
53
54"+"  return PLUS;
55"-"  return MINUS;
56
57"*"  return TIMES;
58"/"  return DIVIDE;
59
60"^"  return POWER;
61
62"==" return EQ;
63"<"  return LT;
64">"  return GT;
65"<=" return LE;
66">=" return GE;
67"/=" return NE;
68"?" return QUESTION_MARK;
69":" return COLON;
70"("  return LEFT_PARENTHESIS;
71")"  return RIGHT_PARENTHESIS;
72
73"\0" return END;
Note: See TracBrowser for help on using the repository browser.