Skip to content
Snippets Groups Projects
Commit b2059db3 authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Merge branch 'patches/autodoc-value-parser' into 8.0

* patches/autodoc-value-parser:
  Tools.AutoDoc.DocParser: Improved error handling for @value.
parents 85ad27d3 fbc40acc
No related branches found
Tags rxnpatch/2023-10-03T115721
No related merge requests found
......@@ -459,30 +459,35 @@ protected class DocParserClass {
return t->xml();
}
protected string valueArgHandler(string keyword, string arg) {
protected string valueArgHandler(string keyword, string arg)
{
// werror("This is the @value arg handler ");
.PikeParser parser = .PikeParser(arg, currentPosition);
// werror("&&& %O\n", arg);
string s = parser->parseLiteral() || parser->parseIdents();
string s2 = 0;
int dots = 0;
if (parser->peekToken() == "..") {
dots = 1;
parser->readToken();
s2 = parser->parseLiteral() || parser->parseIdents();
}
parser->eat(EOF);
if (s)
if (s2)
return xmltag("minvalue", xmlquote(s))
+ xmltag("maxvalue", xmlquote(s2));
else
return dots ? xmltag("minvalue", xmlquote(s)) : xmlquote(s);
else
if (s2)
return xmltag("maxvalue", xmlquote(s2));
catch {
// NB: Throws errors on some syntax errors.
.PikeParser parser = .PikeParser(arg, currentPosition);
// werror("&&& %O\n", arg);
string s = parser->parseLiteral() || parser->parseIdents();
string s2 = 0;
int dots = 0;
if (parser->peekToken() == "..") {
dots = 1;
parser->readToken();
s2 = parser->parseLiteral() || parser->parseIdents();
}
parser->eat(EOF);
if (s)
if (s2)
return xmltag("minvalue", xmlquote(s))
+ xmltag("maxvalue", xmlquote(s2));
else
return dots ? xmltag("minvalue", xmlquote(s)) : xmlquote(s);
else
parseError("@value: expected identifier or literal constant, got %O", arg);
if (s2)
return xmltag("maxvalue", xmlquote(s2));
};
parseError("@value: expected identifier or literal constant, got %O", arg);
return "";
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment