diff --git a/ExpressionEngine/ExpressionGrammar.cs b/ExpressionEngine/ExpressionGrammar.cs index 00d97a1..d3679b6 100644 --- a/ExpressionEngine/ExpressionGrammar.cs +++ b/ExpressionEngine/ExpressionGrammar.cs @@ -11,7 +11,7 @@ namespace ExpressionEngine public class ExpressionGrammar { private readonly Parser _method; - private readonly Parser> _input; + private readonly Parser> _input; public ExpressionGrammar(IEnumerable functions) { @@ -66,7 +66,7 @@ from index in _method.Or(stringLiteral).Or(integer).Contained(lBracket, rBracket from nll in nullConditional from dot in Parse.Char('.') from index in Parse.AnyChar.Except( - Parse.Chars('[', ']', '{', '}', '[', ']', '@', ',', '.', '?') + Parse.Chars('[', ']', '{', '}', '(', ')', '@', ',', '.', '?') ).Many().Text() select new IndexRule(new StringLiteralRule(new ValueContainer(index)), nll); @@ -99,22 +99,20 @@ from indexes in bracketIndices.Or(dotIndices).Many() Parse.Char('}')) .Select(x => x.Evaluate()); - Parser> expression = - from at in Parse.Char('@') - from method in _method - select method.Evaluate(); + Parser> expression = + Parse.Char('@').SelectMany(at => _method, async (at, method) => await method.Evaluate()); Parser allowedString = from t in simpleString.Or(allowedCharacters).Many() select string.Concat(t); - Parser> joinedString = + Parser> joinedString = from e in ( from preFix in allowedString from exp in enclosedExpression.Optional() select exp.IsEmpty ? preFix : preFix + exp.Get()) .Many() - select new ValueTask(new ValueContainer(string.Concat(e))); + select Task.FromResult(new ValueContainer(string.Concat(e))); _input = expression.Or(joinedString); }