2024-01-17 20:28:40 +01:00
|
|
|
|
|
|
|
%language "c++"
|
|
|
|
%require "3.2"
|
|
|
|
%defines
|
|
|
|
%define api.namespace {tpr}
|
|
|
|
%define api.parser.class {TempProfileParser}
|
|
|
|
|
|
|
|
%define parse.error verbose
|
|
|
|
|
|
|
|
%code requires{
|
|
|
|
namespace tpr {
|
|
|
|
class TempProfileScanner;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
%parse-param { TempProfileScanner &scanner }
|
|
|
|
|
|
|
|
%code {
|
|
|
|
#include <iostream>
|
|
|
|
#include <cstdlib>
|
|
|
|
#include <fstream>
|
|
|
|
#include <utility>
|
|
|
|
#include <tuple>
|
|
|
|
#include <tpr/tpr-scanner.hpp>
|
|
|
|
#undef yylex
|
|
|
|
#define yylex scanner.yylex
|
|
|
|
}
|
|
|
|
|
|
|
|
%define api.value.type variant
|
|
|
|
%locations
|
|
|
|
%start tpr_file
|
|
|
|
|
2024-01-17 22:43:30 +01:00
|
|
|
%token<float> number
|
|
|
|
%token lineend
|
|
|
|
%token kw_pid_conf
|
|
|
|
%token kw_temp_set
|
|
|
|
%token kw_wait_temp
|
|
|
|
%token kw_wait_time
|
|
|
|
%token kw_temp_ramp
|
|
|
|
%token kw_beep
|
|
|
|
%token kw_temp_off
|
|
|
|
%token kw_clear_flags
|
|
|
|
%token kw_digio_conf
|
|
|
|
%token kw_digio_set
|
|
|
|
%token kw_digio_wait
|
2024-01-18 23:27:06 +01:00
|
|
|
%token unexpected_input
|
2024-01-17 20:28:40 +01:00
|
|
|
|
|
|
|
%%
|
|
|
|
|
2024-01-17 22:43:30 +01:00
|
|
|
tpr_file: tpr_command
|
|
|
|
| tpr_file tpr_command
|
2024-01-17 20:28:40 +01:00
|
|
|
;
|
|
|
|
|
|
|
|
|
2024-01-17 22:43:30 +01:00
|
|
|
tpr_command: tpr_command_inner lineend
|
|
|
|
| lineend
|
|
|
|
;
|
|
|
|
|
|
|
|
tpr_command_inner: cmd_pid_conf;
|
|
|
|
| cmd_temp_set
|
|
|
|
| cmd_wait_temp
|
|
|
|
| cmd_wait_time
|
|
|
|
| cmd_temp_ramp
|
|
|
|
| cmd_beep
|
|
|
|
| cmd_temp_off
|
|
|
|
| cmd_clear_flags
|
|
|
|
| cmd_digio_conf
|
|
|
|
| cmd_digio_set
|
|
|
|
| cmd_digio_wait
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
|
|
cmd_pid_conf: kw_pid_conf number number number number number number;
|
|
|
|
|
2024-01-18 23:27:06 +01:00
|
|
|
cmd_temp_set: kw_temp_set number {std::cout << "Set Temperature" << $2 << std::endl;}
|
|
|
|
;
|
2024-01-17 22:43:30 +01:00
|
|
|
|
|
|
|
cmd_wait_temp: kw_wait_temp number;
|
|
|
|
|
|
|
|
cmd_wait_time: kw_wait_time number;
|
|
|
|
|
|
|
|
cmd_temp_ramp: kw_temp_ramp number number;
|
|
|
|
|
|
|
|
cmd_beep: kw_beep number;
|
|
|
|
|
|
|
|
cmd_temp_off: kw_temp_off;
|
|
|
|
|
|
|
|
cmd_clear_flags: kw_clear_flags;
|
|
|
|
|
|
|
|
cmd_digio_conf: kw_digio_conf number number;
|
|
|
|
|
|
|
|
cmd_digio_set: kw_digio_set number number;
|
|
|
|
|
|
|
|
cmd_digio_wait: kw_digio_wait number number;
|
|
|
|
|
2024-01-17 20:28:40 +01:00
|
|
|
%%
|
|
|
|
|
|
|
|
void tpr::TempProfileParser::error(const location_type &l, const std::string &err_message)
|
|
|
|
{
|
2024-01-18 23:27:06 +01:00
|
|
|
std::cerr << "[ERR] Parser Error: '" << err_message << "' at " << l << std::endl;
|
2024-01-17 20:28:40 +01:00
|
|
|
std::abort();
|
|
|
|
}
|