mparlak / Flee

Fast Lightweight Expression Evaluator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Flee.Parsing.grammatica_1._5.alpha2.PerCederberg.Grammatica.Runtime.RE.RegExpException: 'invalid repeat count: '{1,3})?(d|f|m)?' at position 18'

benzmarkus opened this issue · comments

CalculationEngine engine = new CalculationEngine();
ExpressionContext context = new ExpressionContext();
int interest = 2;
context.Variables.Add("interest", interest);
BatchLoader loader = engine.CreateBatchLoader();

Write a small program with those lines and enable "Common Language Runtime Exceptions" in Visual Studio Exceptions Settings and it throws an exception.

Why does this happen?

In our production tool, we get 100 messages per second and we need to validate them with flee expressions. For each expression, we create a new ExpressionContext for the validation.
How can i prevent this error exception?

why create a new ExpressionContext for each expression? There is a lot of overhead in general for each context, so reuse it where possible.

@mparlak just merged in a fix for those exceptions. I'd expect an updated release soon.