config: add version expression lexer
The expression syntax is C alike except version literals. The expressions are oriented to version comparisons, so arithmetic operators are not implemented: only compare and logical operators. Supported tokens: * Three component version literal: `\d+.\d+.\d+`. * Variable: `[a-zA-Z_][a-zA-Z0-9_]`. * Operators: `(`, `)`, `<`, `>`, `<=`, `>=`, `!=`, `==`, `&&`, `||`. The operators are token separators: `x>=` is the same as `x >= y`. The idea how to structurize the code is borrowed from @locker's `src/lua/xml.c`: see commit 5f596b25 ("lua: add internal xml parser"). Part of #9452 NO_DOC=It is a supplementary module for config's conditional section predicates. To be documented in the last commit of the series. NO_CHANGELOG=see NO_DOC
Showing
- src/box/CMakeLists.txt 1 addition, 0 deletionssrc/box/CMakeLists.txt
- src/box/lua/config/utils/expression_lexer.c 287 additions, 0 deletionssrc/box/lua/config/utils/expression_lexer.c
- src/box/lua/config/utils/expression_lexer.h 19 additions, 0 deletionssrc/box/lua/config/utils/expression_lexer.h
- src/box/lua/init.c 2 additions, 0 deletionssrc/box/lua/init.c
- test/config-luatest/expression_test.lua 204 additions, 0 deletionstest/config-luatest/expression_test.lua
Loading
Please register or sign in to comment