reflow-oven-control-sw/tprcc/parser/tpr.l

44 lines
1.2 KiB
Plaintext

%{
#include <tpr/tpr-scanner.hpp>
#include <string>
#undef YY_DECL
#define YY_DECL int tpr::TempProfileScanner::yylex(tpr::TempProfileParser::semantic_type * const lval, tpr::TempProfileParser::location_type *loc )
#define YY_USER_ACTION loc->step(); loc->columns(yyleng);
using token = tpr::TempProfileParser::token;
%}
%option yyclass="tpr::TempProfileScanner"
%option noyywrap
%option never-interactive
%option c++
/* Predefined rules */
NEWLINE "\n"|"\r\n"
COMMENT_LINE "#".*\n
SPACE "\t"|" "
NUM [-+]?([0-9]*\.[0-9]+|[0-9]+)
%%
<*>{SPACE} { /*Ignore spaces */}
{COMMENT_LINE} {loc->lines(); return token::lineend;}
{NEWLINE} {loc->lines(); return token::lineend;}
{NUM} {yylval->build<float>(std::stof(std::string(yytext))); return token::number;}
pid_conf { return token::kw_pid_conf; }
temp_set { return token::kw_temp_set; }
wait_temp { return token::kw_wait_temp; }
wait_time { return token::kw_wait_time; }
temp_ramp { return token::kw_temp_ramp; }
beep { return token::kw_beep; }
temp_off { return token::kw_temp_off; }
clear_flags { return token::kw_clear_flags; }
digio_conf { return token::kw_digio_conf; }
digio_set { return token::kw_digio_set; }
digio_wait { return token::kw_digio_wait; }
%%