Filter Expression parser
This commit implements a parser for $filter expressions, per the redfish
specification and odata specification. This is intended to be used to
support $filter query for collections.
For parsing libraries, this commit chooses boost spirit x3. It's chosen
because it doesn't require a new external dependency, and is done
entirely in the compiler, using C++ syntax. While the syntax is still
somewhat difficult to read, there's a slew of unit tests included to
make sure that at least the common things we expect to work will parse
correctly.
Tested: Unit tests pass (good coverage). Code not yet used.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1b0ab615bc49064acab4dad47f0a8aa499557bfc
diff --git a/meson.build b/meson.build
index e1bbeeb..6ca861d 100644
--- a/meson.build
+++ b/meson.build
@@ -84,6 +84,7 @@
'-Wno-switch-enum',
'-Wno-unused-macros',
'-Wno-covered-switch-default',
+ '-Wno-disabled-macro-expansion',
language: 'cpp',
)
endif
@@ -169,6 +170,7 @@
'-DBOOST_EXCEPTION_DISABLE',
'-DBOOST_NO_EXCEPTIONS',
'-DBOOST_URL_NO_SOURCE_LOCATION',
+ '-DBOOST_SPIRIT_X3_NO_RTTI',
'-DJSON_NOEXCEPTION',
'-DOPENSSL_NO_FILENAMES',
'-DSDBUSPLUS_DISABLE_BOOST_COROUTINES',
@@ -256,7 +258,7 @@
opt = cmake.subproject_options()
opt.add_cmake_defines(
{
- 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;headers;process;type_index;url;uuid',
+ 'BOOST_INCLUDE_LIBRARIES': 'asio;beast;callable_traits;headers;process;type_index;url;uuid;spirit',
'BUILD_SHARED_LIBS': 'OFF',
},
)
@@ -270,6 +272,7 @@
boost_type_index = boost.dependency('boost_type_index').as_system()
boost_url = boost.dependency('boost_url').as_system()
boost_uuid = boost.dependency('boost_uuid').as_system()
+ boost_spirit = boost.dependency('boost_spirit').as_system()
bmcweb_dependencies += [
boost_asio,
boost_beast,
@@ -279,6 +282,7 @@
boost_type_index,
boost_url,
boost_uuid,
+ boost_spirit,
]
endif
@@ -328,6 +332,7 @@
'redfish-core/src/error_messages.cpp',
# Begin large files, should be at the beginning
+ 'redfish-core/src/filter_expr_printer.cpp',
'redfish-core/src/redfish.cpp',
'redfish-core/src/registries.cpp',
'redfish-core/src/utils/dbus_utils.cpp',
@@ -388,6 +393,7 @@
'test/include/ssl_key_handler_test.cpp',
'test/include/str_utility_test.cpp',
'test/redfish-core/include/privileges_test.cpp',
+ 'test/redfish-core/include/filter_expr_parser_test.cpp',
'test/redfish-core/include/redfish_aggregator_test.cpp',
'test/redfish-core/include/registries_test.cpp',
'test/redfish-core/include/utils/dbus_utils.cpp',