printer yang BUGFIX multi-line range stmt support
diff --git a/src/printer_yang.c b/src/printer_yang.c
index e1e4f20..8b7e593 100644
--- a/src/printer_yang.c
+++ b/src/printer_yang.c
@@ -339,7 +339,8 @@
}
static void
-ypr_unsigned(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, unsigned long int attr_value, ly_bool *flag)
+ypr_unsigned(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts,
+ unsigned long int attr_value, ly_bool *flag)
{
char *str;
@@ -353,7 +354,8 @@
}
static void
-ypr_signed(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, signed long int attr_value, ly_bool *flag)
+ypr_signed(struct lys_ypr_ctx *pctx, enum ly_stmt substmt, uint8_t substmt_index, void *exts, signed long int attr_value,
+ ly_bool *flag)
{
char *str;
@@ -575,18 +577,18 @@
static void
yprp_restr(struct lys_ypr_ctx *pctx, const struct lysp_restr *restr, enum ly_stmt stmt, ly_bool *flag)
{
- ly_bool inner_flag = 0;
+ ly_bool inner_flag = 0, singleline;
+ const char *text;
if (!restr) {
return;
}
ypr_open(pctx->out, flag);
- ly_print_(pctx->out, "%*s%s \"", INDENT, ly_stmt2str(stmt));
- ypr_encode(pctx->out,
- (restr->arg.str[0] != LYSP_RESTR_PATTERN_NACK && restr->arg.str[0] != LYSP_RESTR_PATTERN_ACK) ?
- restr->arg.str : &restr->arg.str[1], -1);
- ly_print_(pctx->out, "\"");
+ text = ((restr->arg.str[0] != LYSP_RESTR_PATTERN_NACK) && (restr->arg.str[0] != LYSP_RESTR_PATTERN_ACK)) ?
+ restr->arg.str : restr->arg.str + 1;
+ singleline = strchr(text, '\n') ? 0 : 1;
+ ypr_text(pctx, ly_stmt2str(stmt), text, singleline, 0);
LEVEL++;
yprp_extension_instances(pctx, stmt, 0, restr->exts, &inner_flag, 0);