Skip to content

Commit

Permalink
Follow-up on: [CLI help text for YANG data model with multi-line desc…
Browse files Browse the repository at this point in the history
…ription field is misformatted](clicon/clixon#543)

Cornercase with \n\r\n\r
  • Loading branch information
olofhagsand committed Aug 22, 2024
1 parent 62590bb commit 47be222
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions cligen_parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -1372,7 +1372,7 @@ decl : cmd { _PARSE_DEBUG("decl->cmd");}
| cmd PDQ DQP { _PARSE_DEBUG("decl->cmd (\"\")");}
;

helpstring : helpstring '\n' helpstring1
helpstring : helpstring linefeeds helpstring1
{
_PARSE_DEBUG("helpstring -> helpstring helpstring1");
if (cgy_helpstring(_cy, 1, $3) < 0) _YYERROR("helpstring");
Expand All @@ -1384,6 +1384,10 @@ helpstring : helpstring '\n' helpstring1
}
;

linefeeds : linefeeds '\n'
| '\n'
;

helpstring1 : helpstring1 HELPSTR
{
size_t len = strlen($1);
Expand All @@ -1398,7 +1402,6 @@ helpstring1 : helpstring1 HELPSTR
}
;


cmd : NAME { _PARSE_DEBUG("cmd->NAME");
if (cgy_cmd(_cy, $1) < 0) _YYERROR("cmd"); free($1); }
| '@' NAME { _PARSE_DEBUG("cmd->@NAME");
Expand Down

0 comments on commit 47be222

Please sign in to comment.