@@ -11,7 +11,7 @@ namespace ExpressionEngine
1111 public class ExpressionGrammar
1212 {
1313 private readonly Parser < IRule > _method ;
14- private readonly Parser < ValueTask < ValueContainer > > _input ;
14+ private readonly Parser < Task < ValueContainer > > _input ;
1515
1616 public ExpressionGrammar ( IEnumerable < IFunction > functions )
1717 {
@@ -66,7 +66,7 @@ from index in _method.Or(stringLiteral).Or(integer).Contained(lBracket, rBracket
6666 from nll in nullConditional
6767 from dot in Parse . Char ( '.' )
6868 from index in Parse . AnyChar . Except (
69- Parse . Chars ( '[' , ']' , '{' , '}' , '[ ' , '] ' , '@' , ',' , '.' , '?' )
69+ Parse . Chars ( '[' , ']' , '{' , '}' , '( ' , ') ' , '@' , ',' , '.' , '?' )
7070 ) . Many ( ) . Text ( )
7171 select new IndexRule ( new StringLiteralRule ( new ValueContainer ( index ) ) , nll ) ;
7272
@@ -99,22 +99,20 @@ from indexes in bracketIndices.Or(dotIndices).Many()
9999 Parse . Char ( '}' ) )
100100 . Select ( x => x . Evaluate ( ) ) ;
101101
102- Parser < ValueTask < ValueContainer > > expression =
103- from at in Parse . Char ( '@' )
104- from method in _method
105- select method . Evaluate ( ) ;
102+ Parser < Task < ValueContainer > > expression =
103+ Parse . Char ( '@' ) . SelectMany ( at => _method , async ( at , method ) => await method . Evaluate ( ) ) ;
106104
107105 Parser < string > allowedString =
108106 from t in simpleString . Or ( allowedCharacters ) . Many ( )
109107 select string . Concat ( t ) ;
110108
111- Parser < ValueTask < ValueContainer > > joinedString =
109+ Parser < Task < ValueContainer > > joinedString =
112110 from e in (
113111 from preFix in allowedString
114112 from exp in enclosedExpression . Optional ( )
115113 select exp . IsEmpty ? preFix : preFix + exp . Get ( ) )
116114 . Many ( )
117- select new ValueTask < ValueContainer > ( new ValueContainer ( string . Concat ( e ) ) ) ;
115+ select Task . FromResult ( new ValueContainer ( string . Concat ( e ) ) ) ;
118116
119117 _input = expression . Or ( joinedString ) ;
120118 }
0 commit comments