aboutsummaryrefslogtreecommitdiffstats
path: root/src/libserver
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2021-03-04 15:40:34 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2021-03-04 15:40:34 +0000
commit8be8cf9bcd4047c17cf9f8b95b0831ecbf22d8ae (patch)
tree11514b5ec2b6e3aefb71ed50451a1fcdfc246e03 /src/libserver
parentfa5a0679bd5d3e2146d2c6d3c70ed6d4447f3925 (diff)
downloadrspamd-8be8cf9bcd4047c17cf9f8b95b0831ecbf22d8ae.tar.gz
rspamd-8be8cf9bcd4047c17cf9f8b95b0831ecbf22d8ae.zip
[Minor] Css: Make debug output valid json
Diffstat (limited to 'src/libserver')
-rw-r--r--src/libserver/css/css_parser.cxx14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/libserver/css/css_parser.cxx b/src/libserver/css/css_parser.cxx
index 014ddf680..1d2916e5e 100644
--- a/src/libserver/css/css_parser.cxx
+++ b/src/libserver/css/css_parser.cxx
@@ -74,7 +74,7 @@ auto css_consumed_block::token_type_str(void) const -> const char *
ret = "function";
break;
case parser_tag_type::css_function_arg:
- ret = "function args";
+ ret = "function arg";
break;
case parser_tag_type::css_component:
ret = "component";
@@ -119,15 +119,19 @@ auto css_consumed_block::debug_str(void) -> std::string {
}
else if constexpr (std::is_same_v<T, css_function_block>) {
/* Empty block */
- ret += R"({ "function:" {"name": )";
- ret += "\"" + arg.function.debug_token_str() + "\"";
- ret += R"("arguments:" [)";
+ ret += R"({ "content": {"token": )";
+ ret += "\"" + arg.function.debug_token_str() + "\", ";
+ ret += R"("arguments": [)";
for (const auto &block : arg.args) {
ret += "{";
ret += block->debug_str();
ret += "}, ";
}
- ret += "]}";
+ if (*(--ret.end()) == ' ') {
+ ret.pop_back();
+ ret.pop_back(); /* Last ',' */
+ }
+ ret += "]}}";
}
else {
/* Single element block */