agent_lexer.ll 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668
  1. /* Copyright (C) 2017 Internet Systems Consortium, Inc. ("ISC")
  2. This Source Code Form is subject to the terms of the Mozilla Public
  3. License, v. 2.0. If a copy of the MPL was not distributed with this
  4. file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. %{ /* -*- C++ -*- */
  6. #include <cerrno>
  7. #include <climits>
  8. #include <cstdlib>
  9. #include <string>
  10. #include <agent/parser_context.h>
  11. #include <asiolink/io_address.h>
  12. #include <boost/lexical_cast.hpp>
  13. #include <exceptions/exceptions.h>
  14. #include <cc/dhcp_config_error.h>
  15. // Work around an incompatibility in flex (at least versions
  16. // 2.5.31 through 2.5.33): it generates code that does
  17. // not conform to C89. See Debian bug 333231
  18. // <http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=333231>.
  19. # undef yywrap
  20. # define yywrap() 1
  21. namespace {
  22. bool start_token_flag = false;
  23. isc::agent::ParserContext::ParserType start_token_value;
  24. unsigned int comment_start_line = 0;
  25. using namespace isc;
  26. using isc::agent::AgentParser;
  27. };
  28. // To avoid the call to exit... oops!
  29. #define YY_FATAL_ERROR(msg) isc::agent::ParserContext::fatal(msg)
  30. %}
  31. /* noyywrap disables automatic rewinding for the next file to parse. Since we
  32. always parse only a single string, there's no need to do any wraps. And
  33. using yywrap requires linking with -lfl, which provides the default yywrap
  34. implementation that always returns 1 anyway. */
  35. %option noyywrap
  36. /* nounput simplifies the lexer, by removing support for putting a character
  37. back into the input stream. We never use such capability anyway. */
  38. %option nounput
  39. /* batch means that we'll never use the generated lexer interactively. */
  40. %option batch
  41. /* avoid to get static global variables to remain with C++. */
  42. /* in last resort %option reentrant */
  43. /* Enables debug mode. To see the debug messages, one needs to also set
  44. yy_flex_debug to 1, then the debug messages will be printed on stderr. */
  45. %option debug
  46. /* I have no idea what this option does, except it was specified in the bison
  47. examples and Postgres folks added it to remove gcc 4.3 warnings. Let's
  48. be on the safe side and keep it. */
  49. %option noinput
  50. %x COMMENT
  51. %x DIR_ENTER DIR_INCLUDE DIR_EXIT
  52. /* These are not token expressions yet, just convenience expressions that
  53. can be used during actual token definitions. Note some can match
  54. incorrect inputs (e.g., IP addresses) which must be checked. */
  55. int \-?[0-9]+
  56. blank [ \t\r]
  57. UnicodeEscapeSequence u[0-9A-Fa-f]{4}
  58. JSONEscapeCharacter ["\\/bfnrt]
  59. JSONEscapeSequence {JSONEscapeCharacter}|{UnicodeEscapeSequence}
  60. JSONStandardCharacter [^\x00-\x1f"\\]
  61. JSONStringCharacter {JSONStandardCharacter}|\\{JSONEscapeSequence}
  62. JSONString \"{JSONStringCharacter}*\"
  63. /* for errors */
  64. BadUnicodeEscapeSequence u[0-9A-Fa-f]{0,3}[^0-9A-Fa-f]
  65. BadJSONEscapeSequence [^"\\/bfnrtu]|{BadUnicodeEscapeSequence}
  66. ControlCharacter [\x00-\x1f]
  67. ControlCharacterFill [^"\\]|\\{JSONEscapeSequence}
  68. %{
  69. // This code run each time a pattern is matched. It updates the location
  70. // by moving it ahead by yyleng bytes. yyleng specifies the length of the
  71. // currently matched token.
  72. #define YY_USER_ACTION driver.loc_.columns(yyleng);
  73. %}
  74. %%
  75. %{
  76. // This part of the code is copied over to the verbatim to the top
  77. // of the generated yylex function. Explanation:
  78. // http://www.gnu.org/software/bison/manual/html_node/Multiple-start_002dsymbols.html
  79. // Code run each time yylex is called.
  80. driver.loc_.step();
  81. // We currently have 3 points of entries defined:
  82. // START_JSON - which expects any valid JSON
  83. // START_AGENT - which expects full configuration (with outer map and Control-agent
  84. // object in it.
  85. // START_SUB_AGENT - which expects only content of the Control-agent, this is
  86. // primarily useful for testing.
  87. if (start_token_flag) {
  88. start_token_flag = false;
  89. switch (start_token_value) {
  90. case ParserContext::PARSER_JSON:
  91. default:
  92. return isc::agent::AgentParser::make_START_JSON(driver.loc_);
  93. case ParserContext::PARSER_AGENT:
  94. return isc::agent::AgentParser::make_START_AGENT(driver.loc_);
  95. case ParserContext::PARSER_SUB_AGENT:
  96. return isc::agent::AgentParser::make_START_SUB_AGENT(driver.loc_);
  97. }
  98. }
  99. %}
  100. #.* ;
  101. "//"(.*) ;
  102. "/*" {
  103. BEGIN(COMMENT);
  104. comment_start_line = driver.loc_.end.line;;
  105. }
  106. <COMMENT>"*/" BEGIN(INITIAL);
  107. <COMMENT>. ;
  108. <COMMENT><<EOF>> {
  109. isc_throw(ParseError, "Comment not closed. (/* in line " << comment_start_line);
  110. }
  111. "<?" BEGIN(DIR_ENTER);
  112. <DIR_ENTER>"include" BEGIN(DIR_INCLUDE);
  113. <DIR_INCLUDE>\"([^\"\n])+\" {
  114. // Include directive.
  115. // Extract the filename.
  116. std::string tmp(yytext+1);
  117. tmp.resize(tmp.size() - 1);
  118. driver.includeFile(tmp);
  119. }
  120. <DIR_ENTER,DIR_INCLUDE,DIR_EXIT><<EOF>> {
  121. isc_throw(ParseError, "Directive not closed.");
  122. }
  123. <DIR_EXIT>"?>" BEGIN(INITIAL);
  124. <*>{blank}+ {
  125. // Ok, we found a with space. Let's ignore it and update loc variable.
  126. driver.loc_.step();
  127. }
  128. <*>[\n]+ {
  129. // Newline found. Let's update the location and continue.
  130. driver.loc_.lines(yyleng);
  131. driver.loc_.step();
  132. }
  133. \"Control-agent\" {
  134. switch(driver.ctx_) {
  135. case ParserContext::CONFIG:
  136. return AgentParser::make_CONTROL_AGENT(driver.loc_);
  137. default:
  138. return AgentParser::make_STRING("Control-agent", driver.loc_);
  139. }
  140. }
  141. \"http-host\" {
  142. switch(driver.ctx_) {
  143. case ParserContext::AGENT:
  144. return AgentParser::make_HTTP_HOST(driver.loc_);
  145. default:
  146. return AgentParser::make_STRING("http-host", driver.loc_);
  147. }
  148. }
  149. \"http-port\" {
  150. switch(driver.ctx_) {
  151. case ParserContext::AGENT:
  152. return AgentParser::make_HTTP_PORT(driver.loc_);
  153. default:
  154. return AgentParser::make_STRING("http-port", driver.loc_);
  155. }
  156. }
  157. \"control-sockets\" {
  158. switch(driver.ctx_) {
  159. case ParserContext::AGENT:
  160. return AgentParser::make_CONTROL_SOCKETS(driver.loc_);
  161. default:
  162. return AgentParser::make_STRING("control-sockets", driver.loc_);
  163. }
  164. }
  165. \"dhcp4-server\" {
  166. switch(driver.ctx_) {
  167. case ParserContext::CONTROL_SOCKETS:
  168. return AgentParser::make_DHCP4_SERVER(driver.loc_);
  169. default:
  170. return AgentParser::make_STRING("dhcp4-server", driver.loc_);
  171. }
  172. }
  173. \"dhcp6-server\" {
  174. switch(driver.ctx_) {
  175. case ParserContext::CONTROL_SOCKETS:
  176. return AgentParser::make_DHCP6_SERVER(driver.loc_);
  177. default:
  178. return AgentParser::make_STRING("dhcp6-server", driver.loc_);
  179. }
  180. }
  181. \"d2-server\" {
  182. switch(driver.ctx_) {
  183. case ParserContext::CONTROL_SOCKETS:
  184. return AgentParser::make_D2_SERVER(driver.loc_);
  185. default:
  186. return AgentParser::make_STRING("d2-server", driver.loc_);
  187. }
  188. }
  189. \"socket-name\" {
  190. switch(driver.ctx_) {
  191. case ParserContext::SERVER:
  192. return AgentParser::make_SOCKET_NAME(driver.loc_);
  193. default:
  194. return AgentParser::make_STRING("socket-name", driver.loc_);
  195. }
  196. }
  197. \"socket-type\" {
  198. switch(driver.ctx_) {
  199. case ParserContext::SERVER:
  200. return AgentParser::make_SOCKET_TYPE(driver.loc_);
  201. default:
  202. return AgentParser::make_STRING("socket-type", driver.loc_);
  203. }
  204. }
  205. \"unix\" {
  206. switch(driver.ctx_) {
  207. case ParserContext::SOCKET_TYPE:
  208. return AgentParser::make_UNIX(driver.loc_);
  209. default:
  210. return AgentParser::make_STRING("unix", driver.loc_);
  211. }
  212. }
  213. \"hooks-libraries\" {
  214. switch(driver.ctx_) {
  215. case ParserContext::AGENT:
  216. return AgentParser::make_HOOKS_LIBRARIES(driver.loc_);
  217. default:
  218. return AgentParser::make_STRING("hooks-libraries", driver.loc_);
  219. }
  220. }
  221. \"library\" {
  222. switch(driver.ctx_) {
  223. case ParserContext::HOOKS_LIBRARIES:
  224. return AgentParser::make_LIBRARY(driver.loc_);
  225. default:
  226. return AgentParser::make_STRING("library", driver.loc_);
  227. }
  228. }
  229. \"parameters\" {
  230. switch(driver.ctx_) {
  231. case ParserContext::HOOKS_LIBRARIES:
  232. return AgentParser::make_PARAMETERS(driver.loc_);
  233. default:
  234. return AgentParser::make_STRING("parameters", driver.loc_);
  235. }
  236. }
  237. \"Logging\" {
  238. switch(driver.ctx_) {
  239. case ParserContext::CONFIG:
  240. return AgentParser::make_LOGGING(driver.loc_);
  241. default:
  242. return AgentParser::make_STRING("Logging", driver.loc_);
  243. }
  244. }
  245. \"loggers\" {
  246. switch(driver.ctx_) {
  247. case ParserContext::LOGGING:
  248. return AgentParser::make_LOGGERS(driver.loc_);
  249. default:
  250. return AgentParser::make_STRING("loggers", driver.loc_);
  251. }
  252. }
  253. \"name\" {
  254. switch(driver.ctx_) {
  255. case ParserContext::LOGGERS:
  256. return AgentParser::make_NAME(driver.loc_);
  257. default:
  258. return AgentParser::make_STRING("name", driver.loc_);
  259. }
  260. }
  261. \"output_options\" {
  262. switch(driver.ctx_) {
  263. case ParserContext::LOGGERS:
  264. return AgentParser::make_OUTPUT_OPTIONS(driver.loc_);
  265. default:
  266. return AgentParser::make_STRING("output_options", driver.loc_);
  267. }
  268. }
  269. \"output\" {
  270. switch(driver.ctx_) {
  271. case ParserContext::OUTPUT_OPTIONS:
  272. return AgentParser::make_OUTPUT(driver.loc_);
  273. default:
  274. return AgentParser::make_STRING("output", driver.loc_);
  275. }
  276. }
  277. \"debuglevel\" {
  278. switch(driver.ctx_) {
  279. case ParserContext::LOGGERS:
  280. return AgentParser::make_DEBUGLEVEL(driver.loc_);
  281. default:
  282. return AgentParser::make_STRING("debuglevel", driver.loc_);
  283. }
  284. }
  285. \"severity\" {
  286. switch(driver.ctx_) {
  287. case ParserContext::LOGGERS:
  288. return AgentParser::make_SEVERITY(driver.loc_);
  289. default:
  290. return AgentParser::make_STRING("severity", driver.loc_);
  291. }
  292. }
  293. \"Dhcp4\" {
  294. switch(driver.ctx_) {
  295. case ParserContext::CONFIG:
  296. return AgentParser::make_DHCP4(driver.loc_);
  297. default:
  298. return AgentParser::make_STRING("Dhcp4", driver.loc_);
  299. }
  300. }
  301. \"Dhcp6\" {
  302. switch(driver.ctx_) {
  303. case ParserContext::CONFIG:
  304. return AgentParser::make_DHCP6(driver.loc_);
  305. default:
  306. return AgentParser::make_STRING("Dhcp6", driver.loc_);
  307. }
  308. }
  309. \"DhcpDdns\" {
  310. switch(driver.ctx_) {
  311. case ParserContext::CONFIG:
  312. return AgentParser::make_DHCPDDNS(driver.loc_);
  313. default:
  314. return AgentParser::make_STRING("DhcpDdns", driver.loc_);
  315. }
  316. }
  317. {JSONString} {
  318. // A string has been matched. It contains the actual string and single quotes.
  319. // We need to get those quotes out of the way and just use its content, e.g.
  320. // for 'foo' we should get foo
  321. std::string raw(yytext+1);
  322. size_t len = raw.size() - 1;
  323. raw.resize(len);
  324. std::string decoded;
  325. decoded.reserve(len);
  326. for (size_t pos = 0; pos < len; ++pos) {
  327. int b = 0;
  328. char c = raw[pos];
  329. switch (c) {
  330. case '"':
  331. // impossible condition
  332. driver.error(driver.loc_, "Bad quote in \"" + raw + "\"");
  333. case '\\':
  334. ++pos;
  335. if (pos >= len) {
  336. // impossible condition
  337. driver.error(driver.loc_, "Overflow escape in \"" + raw + "\"");
  338. }
  339. c = raw[pos];
  340. switch (c) {
  341. case '"':
  342. case '\\':
  343. case '/':
  344. decoded.push_back(c);
  345. break;
  346. case 'b':
  347. decoded.push_back('\b');
  348. break;
  349. case 'f':
  350. decoded.push_back('\f');
  351. break;
  352. case 'n':
  353. decoded.push_back('\n');
  354. break;
  355. case 'r':
  356. decoded.push_back('\r');
  357. break;
  358. case 't':
  359. decoded.push_back('\t');
  360. break;
  361. case 'u':
  362. // support only \u0000 to \u00ff
  363. ++pos;
  364. if (pos + 4 > len) {
  365. // impossible condition
  366. driver.error(driver.loc_,
  367. "Overflow unicode escape in \"" + raw + "\"");
  368. }
  369. if ((raw[pos] != '0') || (raw[pos + 1] != '0')) {
  370. driver.error(driver.loc_, "Unsupported unicode escape in \"" + raw + "\"");
  371. }
  372. pos += 2;
  373. c = raw[pos];
  374. if ((c >= '0') && (c <= '9')) {
  375. b = (c - '0') << 4;
  376. } else if ((c >= 'A') && (c <= 'F')) {
  377. b = (c - 'A' + 10) << 4;
  378. } else if ((c >= 'a') && (c <= 'f')) {
  379. b = (c - 'a' + 10) << 4;
  380. } else {
  381. // impossible condition
  382. driver.error(driver.loc_, "Not hexadecimal in unicode escape in \"" + raw + "\"");
  383. }
  384. pos++;
  385. c = raw[pos];
  386. if ((c >= '0') && (c <= '9')) {
  387. b |= c - '0';
  388. } else if ((c >= 'A') && (c <= 'F')) {
  389. b |= c - 'A' + 10;
  390. } else if ((c >= 'a') && (c <= 'f')) {
  391. b |= c - 'a' + 10;
  392. } else {
  393. // impossible condition
  394. driver.error(driver.loc_, "Not hexadecimal in unicode escape in \"" + raw + "\"");
  395. }
  396. decoded.push_back(static_cast<char>(b & 0xff));
  397. break;
  398. default:
  399. // impossible condition
  400. driver.error(driver.loc_, "Bad escape in \"" + raw + "\"");
  401. }
  402. break;
  403. default:
  404. if ((c >= 0) && (c < 0x20)) {
  405. // impossible condition
  406. driver.error(driver.loc_, "Invalid control in \"" + raw + "\"");
  407. }
  408. decoded.push_back(c);
  409. }
  410. }
  411. return AgentParser::make_STRING(decoded, driver.loc_);
  412. }
  413. \"{JSONStringCharacter}*{ControlCharacter}{ControlCharacterFill}*\" {
  414. // Bad string with a forbidden control character inside
  415. driver.error(driver.loc_, "Invalid control in " + std::string(yytext));
  416. }
  417. \"{JSONStringCharacter}*\\{BadJSONEscapeSequence}[^\x00-\x1f"]*\" {
  418. // Bad string with a bad escape inside
  419. driver.error(driver.loc_, "Bad escape in " + std::string(yytext));
  420. }
  421. \"{JSONStringCharacter}*\\\" {
  422. // Bad string with an open escape at the end
  423. driver.error(driver.loc_, "Overflow escape in " + std::string(yytext));
  424. }
  425. "[" { return AgentParser::make_LSQUARE_BRACKET(driver.loc_); }
  426. "]" { return AgentParser::make_RSQUARE_BRACKET(driver.loc_); }
  427. "{" { return AgentParser::make_LCURLY_BRACKET(driver.loc_); }
  428. "}" { return AgentParser::make_RCURLY_BRACKET(driver.loc_); }
  429. "," { return AgentParser::make_COMMA(driver.loc_); }
  430. ":" { return AgentParser::make_COLON(driver.loc_); }
  431. {int} {
  432. // An integer was found.
  433. std::string tmp(yytext);
  434. int64_t integer = 0;
  435. try {
  436. // In substring we want to use negative values (e.g. -1).
  437. // In enterprise-id we need to use values up to 0xffffffff.
  438. // To cover both of those use cases, we need at least
  439. // int64_t.
  440. integer = boost::lexical_cast<int64_t>(tmp);
  441. } catch (const boost::bad_lexical_cast &) {
  442. driver.error(driver.loc_, "Failed to convert " + tmp + " to an integer.");
  443. }
  444. // The parser needs the string form as double conversion is no lossless
  445. return AgentParser::make_INTEGER(integer, driver.loc_);
  446. }
  447. [-+]?[0-9]*\.?[0-9]*([eE][-+]?[0-9]+)? {
  448. // A floating point was found.
  449. std::string tmp(yytext);
  450. double fp = 0.0;
  451. try {
  452. fp = boost::lexical_cast<double>(tmp);
  453. } catch (const boost::bad_lexical_cast &) {
  454. driver.error(driver.loc_, "Failed to convert " + tmp + " to a floating point.");
  455. }
  456. return AgentParser::make_FLOAT(fp, driver.loc_);
  457. }
  458. true|false {
  459. string tmp(yytext);
  460. return AgentParser::make_BOOLEAN(tmp == "true", driver.loc_);
  461. }
  462. null {
  463. return AgentParser::make_NULL_TYPE(driver.loc_);
  464. }
  465. (?i:true) driver.error (driver.loc_, "JSON true reserved keyword is lower case only");
  466. (?i:false) driver.error (driver.loc_, "JSON false reserved keyword is lower case only");
  467. (?i:null) driver.error (driver.loc_, "JSON null reserved keyword is lower case only");
  468. <*>. driver.error (driver.loc_, "Invalid character: " + std::string(yytext));
  469. <<EOF>> {
  470. if (driver.states_.empty()) {
  471. return AgentParser::make_END(driver.loc_);
  472. }
  473. driver.loc_ = driver.locs_.back();
  474. driver.locs_.pop_back();
  475. driver.file_ = driver.files_.back();
  476. driver.files_.pop_back();
  477. if (driver.sfile_) {
  478. fclose(driver.sfile_);
  479. driver.sfile_ = 0;
  480. }
  481. if (!driver.sfiles_.empty()) {
  482. driver.sfile_ = driver.sfiles_.back();
  483. driver.sfiles_.pop_back();
  484. }
  485. agent__delete_buffer(YY_CURRENT_BUFFER);
  486. agent__switch_to_buffer(driver.states_.back());
  487. driver.states_.pop_back();
  488. BEGIN(DIR_EXIT);
  489. }
  490. %%
  491. using namespace isc::dhcp;
  492. void
  493. ParserContext::scanStringBegin(const std::string& str, ParserType parser_type)
  494. {
  495. start_token_flag = true;
  496. start_token_value = parser_type;
  497. file_ = "<string>";
  498. sfile_ = 0;
  499. loc_.initialize(&file_);
  500. yy_flex_debug = trace_scanning_;
  501. YY_BUFFER_STATE buffer;
  502. buffer = agent__scan_bytes(str.c_str(), str.size());
  503. if (!buffer) {
  504. fatal("cannot scan string");
  505. // fatal() throws an exception so this can't be reached
  506. }
  507. }
  508. void
  509. ParserContext::scanFileBegin(FILE * f,
  510. const std::string& filename,
  511. ParserType parser_type)
  512. {
  513. start_token_flag = true;
  514. start_token_value = parser_type;
  515. file_ = filename;
  516. sfile_ = f;
  517. loc_.initialize(&file_);
  518. yy_flex_debug = trace_scanning_;
  519. YY_BUFFER_STATE buffer;
  520. // See dhcp6_lexer.cc header for available definitions
  521. buffer = agent__create_buffer(f, 65536 /*buffer size*/);
  522. if (!buffer) {
  523. fatal("cannot scan file " + filename);
  524. }
  525. agent__switch_to_buffer(buffer);
  526. }
  527. void
  528. ParserContext::scanEnd() {
  529. if (sfile_)
  530. fclose(sfile_);
  531. sfile_ = 0;
  532. static_cast<void>(agent_lex_destroy());
  533. // Close files
  534. while (!sfiles_.empty()) {
  535. FILE* f = sfiles_.back();
  536. if (f) {
  537. fclose(f);
  538. }
  539. sfiles_.pop_back();
  540. }
  541. // Delete states
  542. while (!states_.empty()) {
  543. agent__delete_buffer(states_.back());
  544. states_.pop_back();
  545. }
  546. }
  547. void
  548. ParserContext::includeFile(const std::string& filename) {
  549. if (states_.size() > 10) {
  550. fatal("Too many nested include.");
  551. }
  552. FILE* f = fopen(filename.c_str(), "r");
  553. if (!f) {
  554. fatal("Can't open include file " + filename);
  555. }
  556. if (sfile_) {
  557. sfiles_.push_back(sfile_);
  558. }
  559. sfile_ = f;
  560. states_.push_back(YY_CURRENT_BUFFER);
  561. YY_BUFFER_STATE buffer;
  562. buffer = agent__create_buffer(f, 65536 /*buffer size*/);
  563. if (!buffer) {
  564. fatal( "Can't scan include file " + filename);
  565. }
  566. agent__switch_to_buffer(buffer);
  567. files_.push_back(file_);
  568. file_ = filename;
  569. locs_.push_back(loc_);
  570. loc_.initialize(&file_);
  571. BEGIN(INITIAL);
  572. }
  573. namespace {
  574. /// To avoid unused function error
  575. class Dummy {
  576. // cppcheck-suppress unusedPrivateFunction
  577. void dummy() { yy_fatal_error("Fix me: how to disable its definition?"); }
  578. };
  579. }