100 lines
1.7 KiB
Plaintext
100 lines
1.7 KiB
Plaintext
|
|
%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
|
|
|
|
%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
|
|
|
|
%%
|
|
|
|
tpr_file: tpr_command
|
|
| tpr_file tpr_command
|
|
;
|
|
|
|
|
|
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;
|
|
|
|
cmd_temp_set: kw_temp_set number;
|
|
|
|
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;
|
|
|
|
%%
|
|
|
|
void tpr::TempProfileParser::error(const location_type &l, const std::string &err_message)
|
|
{
|
|
std::cerr << "Error " << err_message << " at " << l << std::endl;
|
|
std::abort();
|
|
} |