Mirror of espurna firmware for wireless switches and more
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

375 lines
6.7 KiB

/* Generated by re2c 2.2 */
#line 1 "espurna\\ir_parse_simple.re"
/*
Part of the IR MODULE
For more info:
- https://re2c.org/
- https://re2c.org/manual/manual_c.html
*/
#pragma once
// TODO: some sanity checks for 'valid' ranges of the parsed values, when state machine reaches individual value decoders?
ParseResult<Payload> parse(StringView view) {
const char* YYCURSOR { view.begin() };
const char* YYLIMIT { view.end() };
const char* YYMARKER;
const char *p0 = nullptr, *p1 = nullptr;
const char *c0 = nullptr, *c1 = nullptr;
const char *b0 = nullptr, *b1 = nullptr;
const char *r0 = nullptr, *r1 = nullptr;
const char *s0 = nullptr, *s1 = nullptr;
const char *d0 = nullptr, *d1 = nullptr;
ParseResult<Payload> out;
#line 33 "espurna\\ir_parse_simple.re.ipp"
const char *yyt1 { nullptr };
const char *yyt2 { nullptr };
const char *yyt3 { nullptr };
const char *yyt4 { nullptr };
const char *yyt5 { nullptr };
const char *yyt6 { nullptr };
#line 29 "espurna\\ir_parse_simple.re"
#line 43 "espurna\\ir_parse_simple.re.ipp"
{
char yych;
unsigned int yyaccept = 0;
yych = *YYCURSOR;
switch (yych) {
case '0' ... '9':
yyt1 = YYCURSOR;
goto yy4;
default:
if (YYLIMIT <= YYCURSOR) goto yy41;
goto yy2;
}
yy2:
++YYCURSOR;
yy3:
#line 63 "espurna\\ir_parse_simple.re"
{ goto return_out; }
#line 61 "espurna\\ir_parse_simple.re.ipp"
yy4:
yyaccept = 0;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case '0' ... ':': goto yy6;
default: goto yy3;
}
yy5:
yych = *++YYCURSOR;
yy6:
switch (yych) {
case '0' ... '9': goto yy5;
case ':': goto yy8;
default: goto yy7;
}
yy7:
YYCURSOR = YYMARKER;
switch (yyaccept) {
case 0:
goto yy3;
case 1:
goto yy16;
case 2:
goto yy22;
default:
goto yy28;
}
yy8:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f':
yyt2 = YYCURSOR;
goto yy9;
default: goto yy7;
}
yy9:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy10;
default: goto yy7;
}
yy10:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy11;
case ':': goto yy12;
default: goto yy7;
}
yy11:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy13;
case ':': goto yy12;
default: goto yy7;
}
yy12:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
yyt3 = YYCURSOR;
goto yy14;
default: goto yy7;
}
yy13:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy17;
case ':': goto yy12;
default: goto yy7;
}
yy14:
yyaccept = 1;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case '0' ... '9': goto yy14;
case ':': goto yy18;
default: goto yy16;
}
yy16:
p0 = yyt1;
c0 = yyt2;
b0 = yyt3;
p1 = yyt2 - 1;
c1 = yyt3 - 1;
b1 = YYCURSOR;
#line 43 "espurna\\ir_parse_simple.re"
{ goto update_out; }
#line 159 "espurna\\ir_parse_simple.re.ipp"
yy17:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy19;
case ':': goto yy12;
default: goto yy7;
}
yy18:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
yyt4 = YYCURSOR;
goto yy20;
default: goto yy7;
}
yy19:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy23;
case ':': goto yy12;
default: goto yy7;
}
yy20:
yyaccept = 2;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case '0' ... '9': goto yy20;
case ':': goto yy24;
default: goto yy22;
}
yy22:
p0 = yyt1;
c0 = yyt2;
b0 = yyt3;
r0 = yyt4;
p1 = yyt2 - 1;
c1 = yyt3 - 1;
b1 = yyt4 - 1;
r1 = YYCURSOR;
#line 48 "espurna\\ir_parse_simple.re"
{ goto update_out; }
#line 205 "espurna\\ir_parse_simple.re.ipp"
yy23:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy25;
case ':': goto yy12;
default: goto yy7;
}
yy24:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
yyt5 = YYCURSOR;
goto yy26;
default: goto yy7;
}
yy25:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy29;
case ':': goto yy12;
default: goto yy7;
}
yy26:
yyaccept = 3;
yych = *(YYMARKER = ++YYCURSOR);
switch (yych) {
case '0' ... '9': goto yy26;
case ':': goto yy30;
default: goto yy28;
}
yy28:
p0 = yyt1;
c0 = yyt2;
b0 = yyt3;
r0 = yyt4;
s0 = yyt5;
p1 = yyt2 - 1;
c1 = yyt3 - 1;
b1 = yyt4 - 1;
r1 = yyt5 - 1;
s1 = YYCURSOR;
#line 54 "espurna\\ir_parse_simple.re"
{ goto update_out; }
#line 253 "espurna\\ir_parse_simple.re.ipp"
yy29:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy31;
case ':': goto yy12;
default: goto yy7;
}
yy30:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
yyt6 = YYCURSOR;
goto yy32;
default: goto yy7;
}
yy31:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy35;
case ':': goto yy12;
default: goto yy7;
}
yy32:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9': goto yy32;
default: goto yy34;
}
yy34:
p0 = yyt1;
c0 = yyt2;
b0 = yyt3;
r0 = yyt4;
s0 = yyt5;
d0 = yyt6;
p1 = yyt2 - 1;
c1 = yyt3 - 1;
b1 = yyt4 - 1;
r1 = yyt5 - 1;
s1 = yyt6 - 1;
d1 = YYCURSOR;
#line 61 "espurna\\ir_parse_simple.re"
{ goto update_out; }
#line 301 "espurna\\ir_parse_simple.re.ipp"
yy35:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy36;
case ':': goto yy12;
default: goto yy7;
}
yy36:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy37;
case ':': goto yy12;
default: goto yy7;
}
yy37:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy38;
case ':': goto yy12;
default: goto yy7;
}
yy38:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy39;
case ':': goto yy12;
default: goto yy7;
}
yy39:
yych = *++YYCURSOR;
switch (yych) {
case '0' ... '9':
case 'A' ... 'F':
case 'a' ... 'f': goto yy40;
case ':': goto yy12;
default: goto yy7;
}
yy40:
yych = *++YYCURSOR;
switch (yych) {
case ':': goto yy12;
default: goto yy7;
}
yy41:
#line 64 "espurna\\ir_parse_simple.re"
{ goto return_out; }
#line 356 "espurna\\ir_parse_simple.re.ipp"
}
#line 65 "espurna\\ir_parse_simple.re"
update_out:
{
if (!((c1 - c0) % 2)) {
out = prepare(
StringView{p0, p1},
StringView{c0, c1},
StringView{b0, b1},
StringView{r0, r1},
StringView{s0, s1},
StringView{d0, d1});
}
}
return_out:
return out;
}