]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[4093] Updated eval section of Developer's Guide.
authorMarcin Siodelski <marcin@isc.org>
Thu, 19 Nov 2015 15:26:49 +0000 (16:26 +0100)
committerMarcin Siodelski <marcin@isc.org>
Thu, 19 Nov 2015 15:26:49 +0000 (16:26 +0100)
src/lib/eval/eval.dox

index 716d923aa6fe139255b96dd6a1b487c5e050fbbe..d61d5a730e075d3445b09feff983cef3e91cde25 100644 (file)
@@ -18,8 +18,9 @@
   @section dhcpEvalIntroduction Introduction
 
   The core of the libeval library is a parser that is able to parse an
-  expression (e.g. option[123] == 'APC'). This is currently used for client
-  classification, but in the future may be also used for other applications.
+  expression (e.g. option[123].text == 'APC'). This is currently used for
+  client classification, but in the future may be also used for other
+  applications.
 
   The external interface to the library is the @ref isc::eval::EvalContext
   class.  Once instantiated, it offers a major method:
 14.                 TokenPtr hex(new TokenHexString($1));
 15.                 ctx.expression.push_back(hex);
 16.             }
-17.       | OPTION '[' INTEGER ']'
+17.       | OPTION '[' INTEGER ']' DOTTEXT
 18.             {
-19.                 TokenPtr opt(new TokenOption($3));
+19.                 TokenPtr opt(new TokenOption($3, TokenOption::TEXTUAL));
 20.                 ctx.expression.push_back(opt);
-21.              }
-22.       ;
+21.             }
+22.       | OPTION '[' INTEGER ']' DOTHEX
+23.             {
+24.                 TokenPtr opt(new TokenOption($3, TokenOption::HEXADECIMAL));
+25.                 ctx.expression.push_back(opt);
+26.              }
+27.       ;
 @endcode
 
 This code determines that the grammar starts from expression (line 1).
@@ -92,7 +98,8 @@ The actual definition of expression (lines 3-5) may either be a
 single token or an expression "token == token" (EQUAL has been defined as
 "==" elsewhere). Token is further
 defined in lines 7-22: it may either be a string (lines 7-11),
-a hex string (lines 12-16) or option (lines 17-21).
+a hex string (lines 12-16), option in the textual format (lines 17-21)
+or option in a hexadecimal format (lines 22-26).
 When the actual case is determined, the respective C++ action
 is executed. For example, if the token is a string, the TokenString class is
 instantiated with the appropriate value and put onto the expression vector.