Support for parsing the compatible version

In the .PackageInfo the compatible version for a resolvable can
optionally be given after the resolvable version via
"'compat[ible]' '>=' <version>".
This commit is contained in:
Ingo Weinhold 2011-06-27 03:53:12 +02:00
parent 22e1ec0e30
commit 2db69df113
1 changed files with 17 additions and 1 deletions

View File

@ -558,6 +558,7 @@ BPackageInfo::Parser::_ParseResolvableList(
}
}
// parse version
BPackageVersion version;
Token op = parser._NextToken();
if (op.type == TOKEN_OPERATOR_ASSIGN)
@ -567,7 +568,22 @@ BPackageInfo::Parser::_ParseResolvableList(
else
throw ParseError("expected '=', comma or ']'", op.pos);
value->AddItem(new BPackageResolvable(token.text, type, version));
// parse compatible version
BPackageVersion compatibleVersion;
Token compatible = parser._NextToken();
if (compatible.type == TOKEN_WORD
&& (compatible.text == "compat"
|| compatible.text == "compatible")) {
op = parser._NextToken();
if (op.type == TOKEN_OPERATOR_GREATER_EQUAL) {
parser._ParseVersionValue(&compatibleVersion, true);
} else
parser._RewindTo(compatible);
} else
parser._RewindTo(compatible);
value->AddItem(new BPackageResolvable(token.text, type, version,
compatibleVersion));
}
} resolvableParser(*this, value);