literal API: add empty string check.

fixes github issue #302, #304
This commit is contained in:
Hong, Yang A 2021-03-04 16:13:46 +00:00
parent 1ecb3aef8b
commit 9e17e8520f

View File

@ -416,6 +416,10 @@ void addLitExpression(NG &ng, unsigned index, const char *expression,
"HS_FLAG_SOM_LEFTMOST are supported in literal API.");
}
if (!strcmp(expression, "")) {
throw CompileError("Pure literal API doesn't support empty string.");
}
// This expression must be a pure literal, we can build ue2_literal
// directly based on expression text.
ParsedLitExpression ple(index, expression, expLength, flags, id);