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.

181 lines
3.2 KiB

  1. /* Generated by re2c 2.2 */
  2. #line 1 "espurna\\ir_parse_state.re"
  3. /*
  4. Part of the IR MODULE
  5. For more info:
  6. - https://re2c.org/
  7. - https://re2c.org/manual/manual_c.html
  8. */
  9. #pragma once
  10. ParseResult<Payload> parse(StringView view) {
  11. const char* YYCURSOR { view.begin() };
  12. const char* YYLIMIT { view.end() };
  13. const char* YYMARKER;
  14. const char *p0 = nullptr, *p1 = nullptr;
  15. const char *c0 = nullptr, *c1 = nullptr;
  16. const char *s0 = nullptr, *s1 = nullptr;
  17. const char *d0 = nullptr, *d1 = nullptr;
  18. ParseResult<Payload> out;
  19. #line 29 "espurna\\ir_parse_state.re.ipp"
  20. const char *yyt1 { nullptr };
  21. const char *yyt2 { nullptr };
  22. const char *yyt3 { nullptr };
  23. const char *yyt4 { nullptr };
  24. #line 25 "espurna\\ir_parse_state.re"
  25. #line 37 "espurna\\ir_parse_state.re.ipp"
  26. {
  27. char yych;
  28. unsigned int yyaccept = 0;
  29. yych = *YYCURSOR;
  30. switch (yych) {
  31. case '0' ... '9':
  32. yyt1 = YYCURSOR;
  33. goto yy4;
  34. default:
  35. if (YYLIMIT <= YYCURSOR) goto yy20;
  36. goto yy2;
  37. }
  38. yy2:
  39. ++YYCURSOR;
  40. yy3:
  41. #line 49 "espurna\\ir_parse_state.re"
  42. { goto return_out; }
  43. #line 55 "espurna\\ir_parse_state.re.ipp"
  44. yy4:
  45. yyaccept = 0;
  46. yych = *(YYMARKER = ++YYCURSOR);
  47. switch (yych) {
  48. case '0' ... ':': goto yy6;
  49. default: goto yy3;
  50. }
  51. yy5:
  52. yych = *++YYCURSOR;
  53. yy6:
  54. switch (yych) {
  55. case '0' ... '9': goto yy5;
  56. case ':': goto yy8;
  57. default: goto yy7;
  58. }
  59. yy7:
  60. YYCURSOR = YYMARKER;
  61. switch (yyaccept) {
  62. case 0:
  63. goto yy3;
  64. case 1:
  65. goto yy11;
  66. default:
  67. goto yy15;
  68. }
  69. yy8:
  70. yych = *++YYCURSOR;
  71. switch (yych) {
  72. case '0' ... '9':
  73. case 'A' ... 'F':
  74. case 'a' ... 'f':
  75. yyt2 = YYCURSOR;
  76. goto yy9;
  77. default: goto yy7;
  78. }
  79. yy9:
  80. yyaccept = 1;
  81. yych = *(YYMARKER = ++YYCURSOR);
  82. switch (yych) {
  83. case '0' ... '9':
  84. case 'A' ... 'F':
  85. case 'a' ... 'f': goto yy9;
  86. case ':': goto yy12;
  87. default: goto yy11;
  88. }
  89. yy11:
  90. p0 = yyt1;
  91. c0 = yyt2;
  92. p1 = yyt2 - 1;
  93. c1 = YYCURSOR;
  94. #line 38 "espurna\\ir_parse_state.re"
  95. { goto update_out; }
  96. #line 108 "espurna\\ir_parse_state.re.ipp"
  97. yy12:
  98. yych = *++YYCURSOR;
  99. switch (yych) {
  100. case '0' ... '9':
  101. yyt3 = YYCURSOR;
  102. goto yy13;
  103. default: goto yy7;
  104. }
  105. yy13:
  106. yyaccept = 2;
  107. yych = *(YYMARKER = ++YYCURSOR);
  108. switch (yych) {
  109. case '0' ... '9': goto yy13;
  110. case ':': goto yy16;
  111. default: goto yy15;
  112. }
  113. yy15:
  114. p0 = yyt1;
  115. c0 = yyt2;
  116. s0 = yyt3;
  117. p1 = yyt2 - 1;
  118. c1 = yyt3 - 1;
  119. s1 = YYCURSOR;
  120. #line 42 "espurna\\ir_parse_state.re"
  121. { goto update_out; }
  122. #line 134 "espurna\\ir_parse_state.re.ipp"
  123. yy16:
  124. yych = *++YYCURSOR;
  125. switch (yych) {
  126. case '0' ... '9':
  127. yyt4 = YYCURSOR;
  128. goto yy17;
  129. default: goto yy7;
  130. }
  131. yy17:
  132. yych = *++YYCURSOR;
  133. switch (yych) {
  134. case '0' ... '9': goto yy17;
  135. default: goto yy19;
  136. }
  137. yy19:
  138. p0 = yyt1;
  139. c0 = yyt2;
  140. s0 = yyt3;
  141. d0 = yyt4;
  142. p1 = yyt2 - 1;
  143. c1 = yyt3 - 1;
  144. s1 = yyt4 - 1;
  145. d1 = YYCURSOR;
  146. #line 47 "espurna\\ir_parse_state.re"
  147. { goto update_out; }
  148. #line 160 "espurna\\ir_parse_state.re.ipp"
  149. yy20:
  150. #line 50 "espurna\\ir_parse_state.re"
  151. { goto return_out; }
  152. #line 164 "espurna\\ir_parse_state.re.ipp"
  153. }
  154. #line 51 "espurna\\ir_parse_state.re"
  155. update_out:
  156. {
  157. if (!((c1 - c0) % 2)) {
  158. out = prepare(
  159. StringView{p0, p1},
  160. StringView{c0, c1},
  161. StringView{s0, s1},
  162. StringView{d0, d1});
  163. }
  164. }
  165. return_out:
  166. return out;
  167. }