parser.h 44 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715
  1. // A Bison parser, made by GNU Bison 3.0.4.
  2. // Skeleton interface for Bison LALR(1) parsers in C++
  3. // Copyright (C) 2002-2015 Free Software Foundation, Inc.
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. // This program is distributed in the hope that it will be useful,
  9. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. // GNU General Public License for more details.
  12. // You should have received a copy of the GNU General Public License
  13. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  14. // As a special exception, you may create a larger work that contains
  15. // part or all of the Bison parser skeleton and distribute that work
  16. // under terms of your choice, so long as that work isn't itself a
  17. // parser generator using the skeleton or a modified version thereof
  18. // as a parser skeleton. Alternatively, if you modify or redistribute
  19. // the parser skeleton itself, you may (at your option) remove this
  20. // special exception, which will cause the skeleton and the resulting
  21. // Bison output files to be licensed under the GNU General Public
  22. // License without this special exception.
  23. // This special exception was added by the Free Software Foundation in
  24. // version 2.2 of Bison.
  25. /**
  26. ** \file parser.h
  27. ** Define the isc::eval::parser class.
  28. */
  29. // C++ LALR(1) parser skeleton written by Akim Demaille.
  30. #ifndef YY_EVAL_PARSER_H_INCLUDED
  31. # define YY_EVAL_PARSER_H_INCLUDED
  32. // // "%code requires" blocks.
  33. #line 17 "parser.yy" // lalr1.cc:377
  34. #include <string>
  35. #include <eval/token.h>
  36. #include <eval/eval_context_decl.h>
  37. #include <dhcp/option.h>
  38. #include <boost/lexical_cast.hpp>
  39. using namespace isc::dhcp;
  40. using namespace isc::eval;
  41. #line 55 "parser.h" // lalr1.cc:377
  42. # include <cassert>
  43. # include <cstdlib> // std::abort
  44. # include <iostream>
  45. # include <stdexcept>
  46. # include <string>
  47. # include <vector>
  48. # include "stack.hh"
  49. # include "location.hh"
  50. #include <typeinfo>
  51. #ifndef YYASSERT
  52. # include <cassert>
  53. # define YYASSERT assert
  54. #endif
  55. #ifndef YY_ATTRIBUTE
  56. # if (defined __GNUC__ \
  57. && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
  58. || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
  59. # define YY_ATTRIBUTE(Spec) __attribute__(Spec)
  60. # else
  61. # define YY_ATTRIBUTE(Spec) /* empty */
  62. # endif
  63. #endif
  64. #ifndef YY_ATTRIBUTE_PURE
  65. # define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
  66. #endif
  67. #ifndef YY_ATTRIBUTE_UNUSED
  68. # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
  69. #endif
  70. #if !defined _Noreturn \
  71. && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
  72. # if defined _MSC_VER && 1200 <= _MSC_VER
  73. # define _Noreturn __declspec (noreturn)
  74. # else
  75. # define _Noreturn YY_ATTRIBUTE ((__noreturn__))
  76. # endif
  77. #endif
  78. /* Suppress unused-variable warnings by "using" E. */
  79. #if ! defined lint || defined __GNUC__
  80. # define YYUSE(E) ((void) (E))
  81. #else
  82. # define YYUSE(E) /* empty */
  83. #endif
  84. #if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
  85. /* Suppress an incorrect diagnostic about yylval being uninitialized. */
  86. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
  87. _Pragma ("GCC diagnostic push") \
  88. _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
  89. _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
  90. # define YY_IGNORE_MAYBE_UNINITIALIZED_END \
  91. _Pragma ("GCC diagnostic pop")
  92. #else
  93. # define YY_INITIAL_VALUE(Value) Value
  94. #endif
  95. #ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  96. # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
  97. # define YY_IGNORE_MAYBE_UNINITIALIZED_END
  98. #endif
  99. #ifndef YY_INITIAL_VALUE
  100. # define YY_INITIAL_VALUE(Value) /* Nothing. */
  101. #endif
  102. /* Debug traces. */
  103. #ifndef EVALDEBUG
  104. # if defined YYDEBUG
  105. #if YYDEBUG
  106. # define EVALDEBUG 1
  107. # else
  108. # define EVALDEBUG 0
  109. # endif
  110. # else /* ! defined YYDEBUG */
  111. # define EVALDEBUG 1
  112. # endif /* ! defined YYDEBUG */
  113. #endif /* ! defined EVALDEBUG */
  114. #line 14 "parser.yy" // lalr1.cc:377
  115. namespace isc { namespace eval {
  116. #line 140 "parser.h" // lalr1.cc:377
  117. /// A char[S] buffer to store and retrieve objects.
  118. ///
  119. /// Sort of a variant, but does not keep track of the nature
  120. /// of the stored data, since that knowledge is available
  121. /// via the current state.
  122. template <size_t S>
  123. struct variant
  124. {
  125. /// Type of *this.
  126. typedef variant<S> self_type;
  127. /// Empty construction.
  128. variant ()
  129. : yytypeid_ (YY_NULLPTR)
  130. {}
  131. /// Construct and fill.
  132. template <typename T>
  133. variant (const T& t)
  134. : yytypeid_ (&typeid (T))
  135. {
  136. YYASSERT (sizeof (T) <= S);
  137. new (yyas_<T> ()) T (t);
  138. }
  139. /// Destruction, allowed only if empty.
  140. ~variant ()
  141. {
  142. YYASSERT (!yytypeid_);
  143. }
  144. /// Instantiate an empty \a T in here.
  145. template <typename T>
  146. T&
  147. build ()
  148. {
  149. YYASSERT (!yytypeid_);
  150. YYASSERT (sizeof (T) <= S);
  151. yytypeid_ = & typeid (T);
  152. return *new (yyas_<T> ()) T;
  153. }
  154. /// Instantiate a \a T in here from \a t.
  155. template <typename T>
  156. T&
  157. build (const T& t)
  158. {
  159. YYASSERT (!yytypeid_);
  160. YYASSERT (sizeof (T) <= S);
  161. yytypeid_ = & typeid (T);
  162. return *new (yyas_<T> ()) T (t);
  163. }
  164. /// Accessor to a built \a T.
  165. template <typename T>
  166. T&
  167. as ()
  168. {
  169. YYASSERT (*yytypeid_ == typeid (T));
  170. YYASSERT (sizeof (T) <= S);
  171. return *yyas_<T> ();
  172. }
  173. /// Const accessor to a built \a T (for %printer).
  174. template <typename T>
  175. const T&
  176. as () const
  177. {
  178. YYASSERT (*yytypeid_ == typeid (T));
  179. YYASSERT (sizeof (T) <= S);
  180. return *yyas_<T> ();
  181. }
  182. /// Swap the content with \a other, of same type.
  183. ///
  184. /// Both variants must be built beforehand, because swapping the actual
  185. /// data requires reading it (with as()), and this is not possible on
  186. /// unconstructed variants: it would require some dynamic testing, which
  187. /// should not be the variant's responsability.
  188. /// Swapping between built and (possibly) non-built is done with
  189. /// variant::move ().
  190. template <typename T>
  191. void
  192. swap (self_type& other)
  193. {
  194. YYASSERT (yytypeid_);
  195. YYASSERT (*yytypeid_ == *other.yytypeid_);
  196. std::swap (as<T> (), other.as<T> ());
  197. }
  198. /// Move the content of \a other to this.
  199. ///
  200. /// Destroys \a other.
  201. template <typename T>
  202. void
  203. move (self_type& other)
  204. {
  205. build<T> ();
  206. swap<T> (other);
  207. other.destroy<T> ();
  208. }
  209. /// Copy the content of \a other to this.
  210. template <typename T>
  211. void
  212. copy (const self_type& other)
  213. {
  214. build<T> (other.as<T> ());
  215. }
  216. /// Destroy the stored \a T.
  217. template <typename T>
  218. void
  219. destroy ()
  220. {
  221. as<T> ().~T ();
  222. yytypeid_ = YY_NULLPTR;
  223. }
  224. private:
  225. /// Prohibit blind copies.
  226. self_type& operator=(const self_type&);
  227. variant (const self_type&);
  228. /// Accessor to raw memory as \a T.
  229. template <typename T>
  230. T*
  231. yyas_ ()
  232. {
  233. void *yyp = yybuffer_.yyraw;
  234. return static_cast<T*> (yyp);
  235. }
  236. /// Const accessor to raw memory as \a T.
  237. template <typename T>
  238. const T*
  239. yyas_ () const
  240. {
  241. const void *yyp = yybuffer_.yyraw;
  242. return static_cast<const T*> (yyp);
  243. }
  244. union
  245. {
  246. /// Strongest alignment constraints.
  247. long double yyalign_me;
  248. /// A buffer large enough to store any of the semantic values.
  249. char yyraw[S];
  250. } yybuffer_;
  251. /// Whether the content is built: if defined, the name of the stored type.
  252. const std::type_info *yytypeid_;
  253. };
  254. /// A Bison parser.
  255. class EvalParser
  256. {
  257. public:
  258. #ifndef EVALSTYPE
  259. /// An auxiliary type to compute the largest semantic type.
  260. union union_type
  261. {
  262. // option_repr_type
  263. char dummy1[sizeof(TokenOption::RepresentationType)];
  264. // pkt4_field
  265. char dummy2[sizeof(TokenPkt4::FieldType)];
  266. // pkt6_field
  267. char dummy3[sizeof(TokenPkt6::FieldType)];
  268. // pkt_metadata
  269. char dummy4[sizeof(TokenPkt::MetadataType)];
  270. // relay6_field
  271. char dummy5[sizeof(TokenRelay6Field::FieldType)];
  272. // nest_level
  273. char dummy6[sizeof(int8_t)];
  274. // "constant string"
  275. // "integer"
  276. // "constant hexstring"
  277. // "option name"
  278. // "ip address"
  279. char dummy7[sizeof(std::string)];
  280. // option_code
  281. char dummy8[sizeof(uint16_t)];
  282. // integer_expr
  283. // enterprise_id
  284. char dummy9[sizeof(uint32_t)];
  285. };
  286. /// Symbol semantic values.
  287. typedef variant<sizeof(union_type)> semantic_type;
  288. #else
  289. typedef EVALSTYPE semantic_type;
  290. #endif
  291. /// Symbol locations.
  292. typedef location location_type;
  293. /// Syntax errors thrown from user actions.
  294. struct syntax_error : std::runtime_error
  295. {
  296. syntax_error (const location_type& l, const std::string& m);
  297. location_type location;
  298. };
  299. /// Tokens.
  300. struct token
  301. {
  302. enum yytokentype
  303. {
  304. TOKEN_END = 0,
  305. TOKEN_LPAREN = 258,
  306. TOKEN_RPAREN = 259,
  307. TOKEN_NOT = 260,
  308. TOKEN_AND = 261,
  309. TOKEN_OR = 262,
  310. TOKEN_EQUAL = 263,
  311. TOKEN_OPTION = 264,
  312. TOKEN_RELAY4 = 265,
  313. TOKEN_RELAY6 = 266,
  314. TOKEN_PEERADDR = 267,
  315. TOKEN_LINKADDR = 268,
  316. TOKEN_LBRACKET = 269,
  317. TOKEN_RBRACKET = 270,
  318. TOKEN_DOT = 271,
  319. TOKEN_TEXT = 272,
  320. TOKEN_HEX = 273,
  321. TOKEN_EXISTS = 274,
  322. TOKEN_PKT = 275,
  323. TOKEN_IFACE = 276,
  324. TOKEN_SRC = 277,
  325. TOKEN_DST = 278,
  326. TOKEN_LEN = 279,
  327. TOKEN_PKT4 = 280,
  328. TOKEN_CHADDR = 281,
  329. TOKEN_HLEN = 282,
  330. TOKEN_HTYPE = 283,
  331. TOKEN_CIADDR = 284,
  332. TOKEN_GIADDR = 285,
  333. TOKEN_YIADDR = 286,
  334. TOKEN_SIADDR = 287,
  335. TOKEN_SUBSTRING = 288,
  336. TOKEN_ALL = 289,
  337. TOKEN_COMA = 290,
  338. TOKEN_CONCAT = 291,
  339. TOKEN_IFELSE = 292,
  340. TOKEN_PKT6 = 293,
  341. TOKEN_MSGTYPE = 294,
  342. TOKEN_TRANSID = 295,
  343. TOKEN_VENDOR_CLASS = 296,
  344. TOKEN_VENDOR = 297,
  345. TOKEN_ANY = 298,
  346. TOKEN_DATA = 299,
  347. TOKEN_ENTERPRISE = 300,
  348. TOKEN_TOPLEVEL_BOOL = 301,
  349. TOKEN_TOPLEVEL_STRING = 302,
  350. TOKEN_STRING = 303,
  351. TOKEN_INTEGER = 304,
  352. TOKEN_HEXSTRING = 305,
  353. TOKEN_OPTION_NAME = 306,
  354. TOKEN_IP_ADDRESS = 307
  355. };
  356. };
  357. /// (External) token type, as returned by yylex.
  358. typedef token::yytokentype token_type;
  359. /// Symbol type: an internal symbol number.
  360. typedef int symbol_number_type;
  361. /// The symbol type number to denote an empty symbol.
  362. enum { empty_symbol = -2 };
  363. /// Internal symbol number for tokens (subsumed by symbol_number_type).
  364. typedef unsigned char token_number_type;
  365. /// A complete symbol.
  366. ///
  367. /// Expects its Base type to provide access to the symbol type
  368. /// via type_get().
  369. ///
  370. /// Provide access to semantic value and location.
  371. template <typename Base>
  372. struct basic_symbol : Base
  373. {
  374. /// Alias to Base.
  375. typedef Base super_type;
  376. /// Default constructor.
  377. basic_symbol ();
  378. /// Copy constructor.
  379. basic_symbol (const basic_symbol& other);
  380. /// Constructor for valueless symbols, and symbols from each type.
  381. basic_symbol (typename Base::kind_type t, const location_type& l);
  382. basic_symbol (typename Base::kind_type t, const TokenOption::RepresentationType v, const location_type& l);
  383. basic_symbol (typename Base::kind_type t, const TokenPkt4::FieldType v, const location_type& l);
  384. basic_symbol (typename Base::kind_type t, const TokenPkt6::FieldType v, const location_type& l);
  385. basic_symbol (typename Base::kind_type t, const TokenPkt::MetadataType v, const location_type& l);
  386. basic_symbol (typename Base::kind_type t, const TokenRelay6Field::FieldType v, const location_type& l);
  387. basic_symbol (typename Base::kind_type t, const int8_t v, const location_type& l);
  388. basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l);
  389. basic_symbol (typename Base::kind_type t, const uint16_t v, const location_type& l);
  390. basic_symbol (typename Base::kind_type t, const uint32_t v, const location_type& l);
  391. /// Constructor for symbols with semantic value.
  392. basic_symbol (typename Base::kind_type t,
  393. const semantic_type& v,
  394. const location_type& l);
  395. /// Destroy the symbol.
  396. ~basic_symbol ();
  397. /// Destroy contents, and record that is empty.
  398. void clear ();
  399. /// Whether empty.
  400. bool empty () const;
  401. /// Destructive move, \a s is emptied into this.
  402. void move (basic_symbol& s);
  403. /// The semantic value.
  404. semantic_type value;
  405. /// The location.
  406. location_type location;
  407. private:
  408. /// Assignment operator.
  409. basic_symbol& operator= (const basic_symbol& other);
  410. };
  411. /// Type access provider for token (enum) based symbols.
  412. struct by_type
  413. {
  414. /// Default constructor.
  415. by_type ();
  416. /// Copy constructor.
  417. by_type (const by_type& other);
  418. /// The symbol type as needed by the constructor.
  419. typedef token_type kind_type;
  420. /// Constructor from (external) token numbers.
  421. by_type (kind_type t);
  422. /// Record that this symbol is empty.
  423. void clear ();
  424. /// Steal the symbol type from \a that.
  425. void move (by_type& that);
  426. /// The (internal) type number (corresponding to \a type).
  427. /// \a empty when empty.
  428. symbol_number_type type_get () const;
  429. /// The token.
  430. token_type token () const;
  431. /// The symbol type.
  432. /// \a empty_symbol when empty.
  433. /// An int, not token_number_type, to be able to store empty_symbol.
  434. int type;
  435. };
  436. /// "External" symbols: returned by the scanner.
  437. typedef basic_symbol<by_type> symbol_type;
  438. // Symbol constructors declarations.
  439. static inline
  440. symbol_type
  441. make_END (const location_type& l);
  442. static inline
  443. symbol_type
  444. make_LPAREN (const location_type& l);
  445. static inline
  446. symbol_type
  447. make_RPAREN (const location_type& l);
  448. static inline
  449. symbol_type
  450. make_NOT (const location_type& l);
  451. static inline
  452. symbol_type
  453. make_AND (const location_type& l);
  454. static inline
  455. symbol_type
  456. make_OR (const location_type& l);
  457. static inline
  458. symbol_type
  459. make_EQUAL (const location_type& l);
  460. static inline
  461. symbol_type
  462. make_OPTION (const location_type& l);
  463. static inline
  464. symbol_type
  465. make_RELAY4 (const location_type& l);
  466. static inline
  467. symbol_type
  468. make_RELAY6 (const location_type& l);
  469. static inline
  470. symbol_type
  471. make_PEERADDR (const location_type& l);
  472. static inline
  473. symbol_type
  474. make_LINKADDR (const location_type& l);
  475. static inline
  476. symbol_type
  477. make_LBRACKET (const location_type& l);
  478. static inline
  479. symbol_type
  480. make_RBRACKET (const location_type& l);
  481. static inline
  482. symbol_type
  483. make_DOT (const location_type& l);
  484. static inline
  485. symbol_type
  486. make_TEXT (const location_type& l);
  487. static inline
  488. symbol_type
  489. make_HEX (const location_type& l);
  490. static inline
  491. symbol_type
  492. make_EXISTS (const location_type& l);
  493. static inline
  494. symbol_type
  495. make_PKT (const location_type& l);
  496. static inline
  497. symbol_type
  498. make_IFACE (const location_type& l);
  499. static inline
  500. symbol_type
  501. make_SRC (const location_type& l);
  502. static inline
  503. symbol_type
  504. make_DST (const location_type& l);
  505. static inline
  506. symbol_type
  507. make_LEN (const location_type& l);
  508. static inline
  509. symbol_type
  510. make_PKT4 (const location_type& l);
  511. static inline
  512. symbol_type
  513. make_CHADDR (const location_type& l);
  514. static inline
  515. symbol_type
  516. make_HLEN (const location_type& l);
  517. static inline
  518. symbol_type
  519. make_HTYPE (const location_type& l);
  520. static inline
  521. symbol_type
  522. make_CIADDR (const location_type& l);
  523. static inline
  524. symbol_type
  525. make_GIADDR (const location_type& l);
  526. static inline
  527. symbol_type
  528. make_YIADDR (const location_type& l);
  529. static inline
  530. symbol_type
  531. make_SIADDR (const location_type& l);
  532. static inline
  533. symbol_type
  534. make_SUBSTRING (const location_type& l);
  535. static inline
  536. symbol_type
  537. make_ALL (const location_type& l);
  538. static inline
  539. symbol_type
  540. make_COMA (const location_type& l);
  541. static inline
  542. symbol_type
  543. make_CONCAT (const location_type& l);
  544. static inline
  545. symbol_type
  546. make_IFELSE (const location_type& l);
  547. static inline
  548. symbol_type
  549. make_PKT6 (const location_type& l);
  550. static inline
  551. symbol_type
  552. make_MSGTYPE (const location_type& l);
  553. static inline
  554. symbol_type
  555. make_TRANSID (const location_type& l);
  556. static inline
  557. symbol_type
  558. make_VENDOR_CLASS (const location_type& l);
  559. static inline
  560. symbol_type
  561. make_VENDOR (const location_type& l);
  562. static inline
  563. symbol_type
  564. make_ANY (const location_type& l);
  565. static inline
  566. symbol_type
  567. make_DATA (const location_type& l);
  568. static inline
  569. symbol_type
  570. make_ENTERPRISE (const location_type& l);
  571. static inline
  572. symbol_type
  573. make_TOPLEVEL_BOOL (const location_type& l);
  574. static inline
  575. symbol_type
  576. make_TOPLEVEL_STRING (const location_type& l);
  577. static inline
  578. symbol_type
  579. make_STRING (const std::string& v, const location_type& l);
  580. static inline
  581. symbol_type
  582. make_INTEGER (const std::string& v, const location_type& l);
  583. static inline
  584. symbol_type
  585. make_HEXSTRING (const std::string& v, const location_type& l);
  586. static inline
  587. symbol_type
  588. make_OPTION_NAME (const std::string& v, const location_type& l);
  589. static inline
  590. symbol_type
  591. make_IP_ADDRESS (const std::string& v, const location_type& l);
  592. /// Build a parser object.
  593. EvalParser (EvalContext& ctx_yyarg);
  594. virtual ~EvalParser ();
  595. /// Parse.
  596. /// \returns 0 iff parsing succeeded.
  597. virtual int parse ();
  598. #if EVALDEBUG
  599. /// The current debugging stream.
  600. std::ostream& debug_stream () const YY_ATTRIBUTE_PURE;
  601. /// Set the current debugging stream.
  602. void set_debug_stream (std::ostream &);
  603. /// Type for debugging levels.
  604. typedef int debug_level_type;
  605. /// The current debugging level.
  606. debug_level_type debug_level () const YY_ATTRIBUTE_PURE;
  607. /// Set the current debugging level.
  608. void set_debug_level (debug_level_type l);
  609. #endif
  610. /// Report a syntax error.
  611. /// \param loc where the syntax error is found.
  612. /// \param msg a description of the syntax error.
  613. virtual void error (const location_type& loc, const std::string& msg);
  614. /// Report a syntax error.
  615. void error (const syntax_error& err);
  616. private:
  617. /// This class is not copyable.
  618. EvalParser (const EvalParser&);
  619. EvalParser& operator= (const EvalParser&);
  620. /// State numbers.
  621. typedef int state_type;
  622. /// Generate an error message.
  623. /// \param yystate the state where the error occurred.
  624. /// \param yyla the lookahead token.
  625. virtual std::string yysyntax_error_ (state_type yystate,
  626. const symbol_type& yyla) const;
  627. /// Compute post-reduction state.
  628. /// \param yystate the current state
  629. /// \param yysym the nonterminal to push on the stack
  630. state_type yy_lr_goto_state_ (state_type yystate, int yysym);
  631. /// Whether the given \c yypact_ value indicates a defaulted state.
  632. /// \param yyvalue the value to check
  633. static bool yy_pact_value_is_default_ (int yyvalue);
  634. /// Whether the given \c yytable_ value indicates a syntax error.
  635. /// \param yyvalue the value to check
  636. static bool yy_table_value_is_error_ (int yyvalue);
  637. static const signed char yypact_ninf_;
  638. static const signed char yytable_ninf_;
  639. /// Convert a scanner token number \a t to a symbol number.
  640. static token_number_type yytranslate_ (token_type t);
  641. // Tables.
  642. // YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
  643. // STATE-NUM.
  644. static const short int yypact_[];
  645. // YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
  646. // Performed when YYTABLE does not specify something else to do. Zero
  647. // means the default is an error.
  648. static const unsigned char yydefact_[];
  649. // YYPGOTO[NTERM-NUM].
  650. static const short int yypgoto_[];
  651. // YYDEFGOTO[NTERM-NUM].
  652. static const short int yydefgoto_[];
  653. // YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
  654. // positive, shift that token. If negative, reduce the rule whose
  655. // number is the opposite. If YYTABLE_NINF, syntax error.
  656. static const unsigned char yytable_[];
  657. static const short int yycheck_[];
  658. // YYSTOS[STATE-NUM] -- The (internal number of the) accessing
  659. // symbol of state STATE-NUM.
  660. static const unsigned char yystos_[];
  661. // YYR1[YYN] -- Symbol number of symbol that rule YYN derives.
  662. static const unsigned char yyr1_[];
  663. // YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.
  664. static const unsigned char yyr2_[];
  665. /// Convert the symbol name \a n to a form suitable for a diagnostic.
  666. static std::string yytnamerr_ (const char *n);
  667. /// For a symbol, its name in clear.
  668. static const char* const yytname_[];
  669. #if EVALDEBUG
  670. // YYRLINE[YYN] -- Source line where rule number YYN was defined.
  671. static const unsigned short int yyrline_[];
  672. /// Report on the debug stream that the rule \a r is going to be reduced.
  673. virtual void yy_reduce_print_ (int r);
  674. /// Print the state stack on the debug stream.
  675. virtual void yystack_print_ ();
  676. // Debugging.
  677. int yydebug_;
  678. std::ostream* yycdebug_;
  679. /// \brief Display a symbol type, value and location.
  680. /// \param yyo The output stream.
  681. /// \param yysym The symbol.
  682. template <typename Base>
  683. void yy_print_ (std::ostream& yyo, const basic_symbol<Base>& yysym) const;
  684. #endif
  685. /// \brief Reclaim the memory associated to a symbol.
  686. /// \param yymsg Why this token is reclaimed.
  687. /// If null, print nothing.
  688. /// \param yysym The symbol.
  689. template <typename Base>
  690. void yy_destroy_ (const char* yymsg, basic_symbol<Base>& yysym) const;
  691. private:
  692. /// Type access provider for state based symbols.
  693. struct by_state
  694. {
  695. /// Default constructor.
  696. by_state ();
  697. /// The symbol type as needed by the constructor.
  698. typedef state_type kind_type;
  699. /// Constructor.
  700. by_state (kind_type s);
  701. /// Copy constructor.
  702. by_state (const by_state& other);
  703. /// Record that this symbol is empty.
  704. void clear ();
  705. /// Steal the symbol type from \a that.
  706. void move (by_state& that);
  707. /// The (internal) type number (corresponding to \a state).
  708. /// \a empty_symbol when empty.
  709. symbol_number_type type_get () const;
  710. /// The state number used to denote an empty symbol.
  711. enum { empty_state = -1 };
  712. /// The state.
  713. /// \a empty when empty.
  714. state_type state;
  715. };
  716. /// "Internal" symbol: element of the stack.
  717. struct stack_symbol_type : basic_symbol<by_state>
  718. {
  719. /// Superclass.
  720. typedef basic_symbol<by_state> super_type;
  721. /// Construct an empty symbol.
  722. stack_symbol_type ();
  723. /// Steal the contents from \a sym to build this.
  724. stack_symbol_type (state_type s, symbol_type& sym);
  725. /// Assignment, needed by push_back.
  726. stack_symbol_type& operator= (const stack_symbol_type& that);
  727. };
  728. /// Stack type.
  729. typedef stack<stack_symbol_type> stack_type;
  730. /// The stack.
  731. stack_type yystack_;
  732. /// Push a new state on the stack.
  733. /// \param m a debug message to display
  734. /// if null, no trace is output.
  735. /// \param s the symbol
  736. /// \warning the contents of \a s.value is stolen.
  737. void yypush_ (const char* m, stack_symbol_type& s);
  738. /// Push a new look ahead token on the state on the stack.
  739. /// \param m a debug message to display
  740. /// if null, no trace is output.
  741. /// \param s the state
  742. /// \param sym the symbol (for its value and location).
  743. /// \warning the contents of \a s.value is stolen.
  744. void yypush_ (const char* m, state_type s, symbol_type& sym);
  745. /// Pop \a n symbols the three stacks.
  746. void yypop_ (unsigned int n = 1);
  747. /// Constants.
  748. enum
  749. {
  750. yyeof_ = 0,
  751. yylast_ = 188, ///< Last index in yytable_.
  752. yynnts_ = 16, ///< Number of nonterminal symbols.
  753. yyfinal_ = 31, ///< Termination state number.
  754. yyterror_ = 1,
  755. yyerrcode_ = 256,
  756. yyntokens_ = 53 ///< Number of tokens.
  757. };
  758. // User arguments.
  759. EvalContext& ctx;
  760. };
  761. // Symbol number corresponding to token number t.
  762. inline
  763. EvalParser::token_number_type
  764. EvalParser::yytranslate_ (token_type t)
  765. {
  766. static
  767. const token_number_type
  768. translate_table[] =
  769. {
  770. 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  771. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  772. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  773. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  774. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  775. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  776. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  777. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  778. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  779. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  780. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  781. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  782. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  783. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  784. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  785. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  786. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  787. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  788. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  789. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  790. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  791. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  792. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  793. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  794. 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
  795. 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
  796. 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
  797. 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
  798. 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
  799. 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
  800. 45, 46, 47, 48, 49, 50, 51, 52
  801. };
  802. const unsigned int user_token_number_max_ = 307;
  803. const token_number_type undef_token_ = 2;
  804. if (static_cast<int>(t) <= yyeof_)
  805. return yyeof_;
  806. else if (static_cast<unsigned int> (t) <= user_token_number_max_)
  807. return translate_table[t];
  808. else
  809. return undef_token_;
  810. }
  811. inline
  812. EvalParser::syntax_error::syntax_error (const location_type& l, const std::string& m)
  813. : std::runtime_error (m)
  814. , location (l)
  815. {}
  816. // basic_symbol.
  817. template <typename Base>
  818. inline
  819. EvalParser::basic_symbol<Base>::basic_symbol ()
  820. : value ()
  821. {}
  822. template <typename Base>
  823. inline
  824. EvalParser::basic_symbol<Base>::basic_symbol (const basic_symbol& other)
  825. : Base (other)
  826. , value ()
  827. , location (other.location)
  828. {
  829. switch (other.type_get ())
  830. {
  831. case 60: // option_repr_type
  832. value.copy< TokenOption::RepresentationType > (other.value);
  833. break;
  834. case 64: // pkt4_field
  835. value.copy< TokenPkt4::FieldType > (other.value);
  836. break;
  837. case 65: // pkt6_field
  838. value.copy< TokenPkt6::FieldType > (other.value);
  839. break;
  840. case 62: // pkt_metadata
  841. value.copy< TokenPkt::MetadataType > (other.value);
  842. break;
  843. case 66: // relay6_field
  844. value.copy< TokenRelay6Field::FieldType > (other.value);
  845. break;
  846. case 61: // nest_level
  847. value.copy< int8_t > (other.value);
  848. break;
  849. case 48: // "constant string"
  850. case 49: // "integer"
  851. case 50: // "constant hexstring"
  852. case 51: // "option name"
  853. case 52: // "ip address"
  854. value.copy< std::string > (other.value);
  855. break;
  856. case 59: // option_code
  857. value.copy< uint16_t > (other.value);
  858. break;
  859. case 58: // integer_expr
  860. case 63: // enterprise_id
  861. value.copy< uint32_t > (other.value);
  862. break;
  863. default:
  864. break;
  865. }
  866. }
  867. template <typename Base>
  868. inline
  869. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const semantic_type& v, const location_type& l)
  870. : Base (t)
  871. , value ()
  872. , location (l)
  873. {
  874. (void) v;
  875. switch (this->type_get ())
  876. {
  877. case 60: // option_repr_type
  878. value.copy< TokenOption::RepresentationType > (v);
  879. break;
  880. case 64: // pkt4_field
  881. value.copy< TokenPkt4::FieldType > (v);
  882. break;
  883. case 65: // pkt6_field
  884. value.copy< TokenPkt6::FieldType > (v);
  885. break;
  886. case 62: // pkt_metadata
  887. value.copy< TokenPkt::MetadataType > (v);
  888. break;
  889. case 66: // relay6_field
  890. value.copy< TokenRelay6Field::FieldType > (v);
  891. break;
  892. case 61: // nest_level
  893. value.copy< int8_t > (v);
  894. break;
  895. case 48: // "constant string"
  896. case 49: // "integer"
  897. case 50: // "constant hexstring"
  898. case 51: // "option name"
  899. case 52: // "ip address"
  900. value.copy< std::string > (v);
  901. break;
  902. case 59: // option_code
  903. value.copy< uint16_t > (v);
  904. break;
  905. case 58: // integer_expr
  906. case 63: // enterprise_id
  907. value.copy< uint32_t > (v);
  908. break;
  909. default:
  910. break;
  911. }
  912. }
  913. // Implementation of basic_symbol constructor for each type.
  914. template <typename Base>
  915. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const location_type& l)
  916. : Base (t)
  917. , value ()
  918. , location (l)
  919. {}
  920. template <typename Base>
  921. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenOption::RepresentationType v, const location_type& l)
  922. : Base (t)
  923. , value (v)
  924. , location (l)
  925. {}
  926. template <typename Base>
  927. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenPkt4::FieldType v, const location_type& l)
  928. : Base (t)
  929. , value (v)
  930. , location (l)
  931. {}
  932. template <typename Base>
  933. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenPkt6::FieldType v, const location_type& l)
  934. : Base (t)
  935. , value (v)
  936. , location (l)
  937. {}
  938. template <typename Base>
  939. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenPkt::MetadataType v, const location_type& l)
  940. : Base (t)
  941. , value (v)
  942. , location (l)
  943. {}
  944. template <typename Base>
  945. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const TokenRelay6Field::FieldType v, const location_type& l)
  946. : Base (t)
  947. , value (v)
  948. , location (l)
  949. {}
  950. template <typename Base>
  951. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const int8_t v, const location_type& l)
  952. : Base (t)
  953. , value (v)
  954. , location (l)
  955. {}
  956. template <typename Base>
  957. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const std::string v, const location_type& l)
  958. : Base (t)
  959. , value (v)
  960. , location (l)
  961. {}
  962. template <typename Base>
  963. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const uint16_t v, const location_type& l)
  964. : Base (t)
  965. , value (v)
  966. , location (l)
  967. {}
  968. template <typename Base>
  969. EvalParser::basic_symbol<Base>::basic_symbol (typename Base::kind_type t, const uint32_t v, const location_type& l)
  970. : Base (t)
  971. , value (v)
  972. , location (l)
  973. {}
  974. template <typename Base>
  975. inline
  976. EvalParser::basic_symbol<Base>::~basic_symbol ()
  977. {
  978. clear ();
  979. }
  980. template <typename Base>
  981. inline
  982. void
  983. EvalParser::basic_symbol<Base>::clear ()
  984. {
  985. // User destructor.
  986. symbol_number_type yytype = this->type_get ();
  987. basic_symbol<Base>& yysym = *this;
  988. (void) yysym;
  989. switch (yytype)
  990. {
  991. default:
  992. break;
  993. }
  994. // Type destructor.
  995. switch (yytype)
  996. {
  997. case 60: // option_repr_type
  998. value.template destroy< TokenOption::RepresentationType > ();
  999. break;
  1000. case 64: // pkt4_field
  1001. value.template destroy< TokenPkt4::FieldType > ();
  1002. break;
  1003. case 65: // pkt6_field
  1004. value.template destroy< TokenPkt6::FieldType > ();
  1005. break;
  1006. case 62: // pkt_metadata
  1007. value.template destroy< TokenPkt::MetadataType > ();
  1008. break;
  1009. case 66: // relay6_field
  1010. value.template destroy< TokenRelay6Field::FieldType > ();
  1011. break;
  1012. case 61: // nest_level
  1013. value.template destroy< int8_t > ();
  1014. break;
  1015. case 48: // "constant string"
  1016. case 49: // "integer"
  1017. case 50: // "constant hexstring"
  1018. case 51: // "option name"
  1019. case 52: // "ip address"
  1020. value.template destroy< std::string > ();
  1021. break;
  1022. case 59: // option_code
  1023. value.template destroy< uint16_t > ();
  1024. break;
  1025. case 58: // integer_expr
  1026. case 63: // enterprise_id
  1027. value.template destroy< uint32_t > ();
  1028. break;
  1029. default:
  1030. break;
  1031. }
  1032. Base::clear ();
  1033. }
  1034. template <typename Base>
  1035. inline
  1036. bool
  1037. EvalParser::basic_symbol<Base>::empty () const
  1038. {
  1039. return Base::type_get () == empty_symbol;
  1040. }
  1041. template <typename Base>
  1042. inline
  1043. void
  1044. EvalParser::basic_symbol<Base>::move (basic_symbol& s)
  1045. {
  1046. super_type::move(s);
  1047. switch (this->type_get ())
  1048. {
  1049. case 60: // option_repr_type
  1050. value.move< TokenOption::RepresentationType > (s.value);
  1051. break;
  1052. case 64: // pkt4_field
  1053. value.move< TokenPkt4::FieldType > (s.value);
  1054. break;
  1055. case 65: // pkt6_field
  1056. value.move< TokenPkt6::FieldType > (s.value);
  1057. break;
  1058. case 62: // pkt_metadata
  1059. value.move< TokenPkt::MetadataType > (s.value);
  1060. break;
  1061. case 66: // relay6_field
  1062. value.move< TokenRelay6Field::FieldType > (s.value);
  1063. break;
  1064. case 61: // nest_level
  1065. value.move< int8_t > (s.value);
  1066. break;
  1067. case 48: // "constant string"
  1068. case 49: // "integer"
  1069. case 50: // "constant hexstring"
  1070. case 51: // "option name"
  1071. case 52: // "ip address"
  1072. value.move< std::string > (s.value);
  1073. break;
  1074. case 59: // option_code
  1075. value.move< uint16_t > (s.value);
  1076. break;
  1077. case 58: // integer_expr
  1078. case 63: // enterprise_id
  1079. value.move< uint32_t > (s.value);
  1080. break;
  1081. default:
  1082. break;
  1083. }
  1084. location = s.location;
  1085. }
  1086. // by_type.
  1087. inline
  1088. EvalParser::by_type::by_type ()
  1089. : type (empty_symbol)
  1090. {}
  1091. inline
  1092. EvalParser::by_type::by_type (const by_type& other)
  1093. : type (other.type)
  1094. {}
  1095. inline
  1096. EvalParser::by_type::by_type (token_type t)
  1097. : type (yytranslate_ (t))
  1098. {}
  1099. inline
  1100. void
  1101. EvalParser::by_type::clear ()
  1102. {
  1103. type = empty_symbol;
  1104. }
  1105. inline
  1106. void
  1107. EvalParser::by_type::move (by_type& that)
  1108. {
  1109. type = that.type;
  1110. that.clear ();
  1111. }
  1112. inline
  1113. int
  1114. EvalParser::by_type::type_get () const
  1115. {
  1116. return type;
  1117. }
  1118. inline
  1119. EvalParser::token_type
  1120. EvalParser::by_type::token () const
  1121. {
  1122. // YYTOKNUM[NUM] -- (External) token number corresponding to the
  1123. // (internal) symbol number NUM (which must be that of a token). */
  1124. static
  1125. const unsigned short int
  1126. yytoken_number_[] =
  1127. {
  1128. 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
  1129. 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
  1130. 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
  1131. 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
  1132. 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
  1133. 305, 306, 307
  1134. };
  1135. return static_cast<token_type> (yytoken_number_[type]);
  1136. }
  1137. // Implementation of make_symbol for each symbol type.
  1138. EvalParser::symbol_type
  1139. EvalParser::make_END (const location_type& l)
  1140. {
  1141. return symbol_type (token::TOKEN_END, l);
  1142. }
  1143. EvalParser::symbol_type
  1144. EvalParser::make_LPAREN (const location_type& l)
  1145. {
  1146. return symbol_type (token::TOKEN_LPAREN, l);
  1147. }
  1148. EvalParser::symbol_type
  1149. EvalParser::make_RPAREN (const location_type& l)
  1150. {
  1151. return symbol_type (token::TOKEN_RPAREN, l);
  1152. }
  1153. EvalParser::symbol_type
  1154. EvalParser::make_NOT (const location_type& l)
  1155. {
  1156. return symbol_type (token::TOKEN_NOT, l);
  1157. }
  1158. EvalParser::symbol_type
  1159. EvalParser::make_AND (const location_type& l)
  1160. {
  1161. return symbol_type (token::TOKEN_AND, l);
  1162. }
  1163. EvalParser::symbol_type
  1164. EvalParser::make_OR (const location_type& l)
  1165. {
  1166. return symbol_type (token::TOKEN_OR, l);
  1167. }
  1168. EvalParser::symbol_type
  1169. EvalParser::make_EQUAL (const location_type& l)
  1170. {
  1171. return symbol_type (token::TOKEN_EQUAL, l);
  1172. }
  1173. EvalParser::symbol_type
  1174. EvalParser::make_OPTION (const location_type& l)
  1175. {
  1176. return symbol_type (token::TOKEN_OPTION, l);
  1177. }
  1178. EvalParser::symbol_type
  1179. EvalParser::make_RELAY4 (const location_type& l)
  1180. {
  1181. return symbol_type (token::TOKEN_RELAY4, l);
  1182. }
  1183. EvalParser::symbol_type
  1184. EvalParser::make_RELAY6 (const location_type& l)
  1185. {
  1186. return symbol_type (token::TOKEN_RELAY6, l);
  1187. }
  1188. EvalParser::symbol_type
  1189. EvalParser::make_PEERADDR (const location_type& l)
  1190. {
  1191. return symbol_type (token::TOKEN_PEERADDR, l);
  1192. }
  1193. EvalParser::symbol_type
  1194. EvalParser::make_LINKADDR (const location_type& l)
  1195. {
  1196. return symbol_type (token::TOKEN_LINKADDR, l);
  1197. }
  1198. EvalParser::symbol_type
  1199. EvalParser::make_LBRACKET (const location_type& l)
  1200. {
  1201. return symbol_type (token::TOKEN_LBRACKET, l);
  1202. }
  1203. EvalParser::symbol_type
  1204. EvalParser::make_RBRACKET (const location_type& l)
  1205. {
  1206. return symbol_type (token::TOKEN_RBRACKET, l);
  1207. }
  1208. EvalParser::symbol_type
  1209. EvalParser::make_DOT (const location_type& l)
  1210. {
  1211. return symbol_type (token::TOKEN_DOT, l);
  1212. }
  1213. EvalParser::symbol_type
  1214. EvalParser::make_TEXT (const location_type& l)
  1215. {
  1216. return symbol_type (token::TOKEN_TEXT, l);
  1217. }
  1218. EvalParser::symbol_type
  1219. EvalParser::make_HEX (const location_type& l)
  1220. {
  1221. return symbol_type (token::TOKEN_HEX, l);
  1222. }
  1223. EvalParser::symbol_type
  1224. EvalParser::make_EXISTS (const location_type& l)
  1225. {
  1226. return symbol_type (token::TOKEN_EXISTS, l);
  1227. }
  1228. EvalParser::symbol_type
  1229. EvalParser::make_PKT (const location_type& l)
  1230. {
  1231. return symbol_type (token::TOKEN_PKT, l);
  1232. }
  1233. EvalParser::symbol_type
  1234. EvalParser::make_IFACE (const location_type& l)
  1235. {
  1236. return symbol_type (token::TOKEN_IFACE, l);
  1237. }
  1238. EvalParser::symbol_type
  1239. EvalParser::make_SRC (const location_type& l)
  1240. {
  1241. return symbol_type (token::TOKEN_SRC, l);
  1242. }
  1243. EvalParser::symbol_type
  1244. EvalParser::make_DST (const location_type& l)
  1245. {
  1246. return symbol_type (token::TOKEN_DST, l);
  1247. }
  1248. EvalParser::symbol_type
  1249. EvalParser::make_LEN (const location_type& l)
  1250. {
  1251. return symbol_type (token::TOKEN_LEN, l);
  1252. }
  1253. EvalParser::symbol_type
  1254. EvalParser::make_PKT4 (const location_type& l)
  1255. {
  1256. return symbol_type (token::TOKEN_PKT4, l);
  1257. }
  1258. EvalParser::symbol_type
  1259. EvalParser::make_CHADDR (const location_type& l)
  1260. {
  1261. return symbol_type (token::TOKEN_CHADDR, l);
  1262. }
  1263. EvalParser::symbol_type
  1264. EvalParser::make_HLEN (const location_type& l)
  1265. {
  1266. return symbol_type (token::TOKEN_HLEN, l);
  1267. }
  1268. EvalParser::symbol_type
  1269. EvalParser::make_HTYPE (const location_type& l)
  1270. {
  1271. return symbol_type (token::TOKEN_HTYPE, l);
  1272. }
  1273. EvalParser::symbol_type
  1274. EvalParser::make_CIADDR (const location_type& l)
  1275. {
  1276. return symbol_type (token::TOKEN_CIADDR, l);
  1277. }
  1278. EvalParser::symbol_type
  1279. EvalParser::make_GIADDR (const location_type& l)
  1280. {
  1281. return symbol_type (token::TOKEN_GIADDR, l);
  1282. }
  1283. EvalParser::symbol_type
  1284. EvalParser::make_YIADDR (const location_type& l)
  1285. {
  1286. return symbol_type (token::TOKEN_YIADDR, l);
  1287. }
  1288. EvalParser::symbol_type
  1289. EvalParser::make_SIADDR (const location_type& l)
  1290. {
  1291. return symbol_type (token::TOKEN_SIADDR, l);
  1292. }
  1293. EvalParser::symbol_type
  1294. EvalParser::make_SUBSTRING (const location_type& l)
  1295. {
  1296. return symbol_type (token::TOKEN_SUBSTRING, l);
  1297. }
  1298. EvalParser::symbol_type
  1299. EvalParser::make_ALL (const location_type& l)
  1300. {
  1301. return symbol_type (token::TOKEN_ALL, l);
  1302. }
  1303. EvalParser::symbol_type
  1304. EvalParser::make_COMA (const location_type& l)
  1305. {
  1306. return symbol_type (token::TOKEN_COMA, l);
  1307. }
  1308. EvalParser::symbol_type
  1309. EvalParser::make_CONCAT (const location_type& l)
  1310. {
  1311. return symbol_type (token::TOKEN_CONCAT, l);
  1312. }
  1313. EvalParser::symbol_type
  1314. EvalParser::make_IFELSE (const location_type& l)
  1315. {
  1316. return symbol_type (token::TOKEN_IFELSE, l);
  1317. }
  1318. EvalParser::symbol_type
  1319. EvalParser::make_PKT6 (const location_type& l)
  1320. {
  1321. return symbol_type (token::TOKEN_PKT6, l);
  1322. }
  1323. EvalParser::symbol_type
  1324. EvalParser::make_MSGTYPE (const location_type& l)
  1325. {
  1326. return symbol_type (token::TOKEN_MSGTYPE, l);
  1327. }
  1328. EvalParser::symbol_type
  1329. EvalParser::make_TRANSID (const location_type& l)
  1330. {
  1331. return symbol_type (token::TOKEN_TRANSID, l);
  1332. }
  1333. EvalParser::symbol_type
  1334. EvalParser::make_VENDOR_CLASS (const location_type& l)
  1335. {
  1336. return symbol_type (token::TOKEN_VENDOR_CLASS, l);
  1337. }
  1338. EvalParser::symbol_type
  1339. EvalParser::make_VENDOR (const location_type& l)
  1340. {
  1341. return symbol_type (token::TOKEN_VENDOR, l);
  1342. }
  1343. EvalParser::symbol_type
  1344. EvalParser::make_ANY (const location_type& l)
  1345. {
  1346. return symbol_type (token::TOKEN_ANY, l);
  1347. }
  1348. EvalParser::symbol_type
  1349. EvalParser::make_DATA (const location_type& l)
  1350. {
  1351. return symbol_type (token::TOKEN_DATA, l);
  1352. }
  1353. EvalParser::symbol_type
  1354. EvalParser::make_ENTERPRISE (const location_type& l)
  1355. {
  1356. return symbol_type (token::TOKEN_ENTERPRISE, l);
  1357. }
  1358. EvalParser::symbol_type
  1359. EvalParser::make_TOPLEVEL_BOOL (const location_type& l)
  1360. {
  1361. return symbol_type (token::TOKEN_TOPLEVEL_BOOL, l);
  1362. }
  1363. EvalParser::symbol_type
  1364. EvalParser::make_TOPLEVEL_STRING (const location_type& l)
  1365. {
  1366. return symbol_type (token::TOKEN_TOPLEVEL_STRING, l);
  1367. }
  1368. EvalParser::symbol_type
  1369. EvalParser::make_STRING (const std::string& v, const location_type& l)
  1370. {
  1371. return symbol_type (token::TOKEN_STRING, v, l);
  1372. }
  1373. EvalParser::symbol_type
  1374. EvalParser::make_INTEGER (const std::string& v, const location_type& l)
  1375. {
  1376. return symbol_type (token::TOKEN_INTEGER, v, l);
  1377. }
  1378. EvalParser::symbol_type
  1379. EvalParser::make_HEXSTRING (const std::string& v, const location_type& l)
  1380. {
  1381. return symbol_type (token::TOKEN_HEXSTRING, v, l);
  1382. }
  1383. EvalParser::symbol_type
  1384. EvalParser::make_OPTION_NAME (const std::string& v, const location_type& l)
  1385. {
  1386. return symbol_type (token::TOKEN_OPTION_NAME, v, l);
  1387. }
  1388. EvalParser::symbol_type
  1389. EvalParser::make_IP_ADDRESS (const std::string& v, const location_type& l)
  1390. {
  1391. return symbol_type (token::TOKEN_IP_ADDRESS, v, l);
  1392. }
  1393. #line 14 "parser.yy" // lalr1.cc:377
  1394. } } // isc::eval
  1395. #line 1711 "parser.h" // lalr1.cc:377
  1396. #endif // !YY_EVAL_PARSER_H_INCLUDED