Files
rocm-systems/source/lib/rocprofiler-sdk/counters/parser/scanner.l
T
venkat1361 22881148bd Parsing Select() expression dimension args to support range of values. (#1074)
* dim args for select token now supports range of values instead of single integer

* dim args for select token now supports range of values instead of single integer

* modified raw_ast fmt::format

* CHANGELOG.md

* varible rename for select dim from set to map in suffix

* use : for giving range of values

* Update source/lib/rocprofiler-sdk/counters/parser/scanner.cpp

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* format

* Update CHANGELOG.md

* using map instead of unordermap for select_dimension_map

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Gopesh Bhardwaj <gopesh.bhardwaj@amd.com>
2024-10-22 11:44:08 +05:30

53 lines
971 B
Plaintext

%option noyywrap nodefault yylineno nounput
%{
#include <fmt/core.h>
#include "raw_ast.hpp"
#include "parser.h"
using namespace std;
#define YYDEBUG 1
%}
/* float exponent */
EXP ([Ee][-+]?[0-9]+)
%%
"+" { return ADD; }
"-" { return SUB; }
"*" { return MUL; }
"/" { return DIV; }
"|" { return ABS; }
"(" { return OP; }
")" { return CP; }
"=" { return EQUALS; }
"," { return CM; }
":" { return COLON; }
\[ { return O_SQ; }
\] { return C_SQ; }
[0-9]+"."[0-9]*{EXP}? |
"."?[0-9]+{EXP}? {
yylval.d = atoi(yytext);
return NUMBER; }
"reduce" { return REDUCE; }
"select" { return SELECT; }
"accumulate" { return ACCUMULATE; }
[a-z_A-Z][a-z_A-Z0-9]* {
yylval.s = strdup(yytext);
return NAME; }
([0-9]+(:[0-9]+)?)(,[0-9]+(:[0-9]+)?)* {
yylval.s = strdup(yytext);
return DIM_ARGS_RANGE;
}
\n { return EOL; }
"//".*
[ \t] { /* ignore white space */ }
. { throw std::runtime_error(fmt::format("Mystery character {}", *yytext)); }
%%