blob: e5da5d22905d5a7fa9607b9b76d14bc1079ac7cc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
/* Tokens */
%option c++
%option noyywrap
%option debug
%option yyclass="Lexer"
%option yylineno
%{
#include <iostream>
#include "system.tab.hh"
#include "location.h"
#undef YY_DECL
# define YY_DECL template<> parser::symbol_type Lexer<parser::symbol_type>::yynlex ()
using parser = yy::parser;
using namespace std;
%}
digit [0-9]
num {digit}+
frc {digit}+\.{digit}+
%%
{frc} { return parser::make_FLOAT(atof(yytext_ptr)); }
{num} { return parser::make_ULONG(atoi(yytext_ptr)); }
[\n] { return parser::make_BREAK();}
[\t] { return parser::make_BLANK();}
begin { return parser::make_START(); }
end { return parser::make_END(); }
ver { return parser::make_VERSION(); }
cpu { return parser::make_CPU(); }
base { return parser::make_BASE(); }
user% { return parser::make_USER(); }
nice% { return parser::make_NICE(); }
system% { return parser::make_SYSP(); }
idle% { return parser::make_IDLE(); }
iowait% { return parser::make_IOWP(); }
irq% { return parser::make_IRQP(); }
swirq% { return parser::make_SIRQ(); }
core: { return parser::make_CORE(); }
mem { return parser::make_MEM(); }
total { return parser::make_TOTAL(); }
avail { return parser::make_AVAIL(); }
cache { return parser::make_CACHE(); }
share { return parser::make_SHARED(); }
swap { return parser::make_SWAP(); }
tswap { return parser::make_TSWAP(); }
uswap { return parser::make_USWAP(); }
tmp { return parser::make_TEMP(); }
cur { return parser::make_CURR(); }
min { return parser::make_TMIN(); }
max { return parser::make_TMAX(); }
avg { return parser::make_TAVG(); }
: { return parser::make_COLON(); }
\/ { return parser::make_SLASH(); }
Package\ id\ {num} {return parser::make_TSENSOR();};
. { /* everything else */ }
%%
|