33using System . Linq ;
44using Serilog . Events ;
55using Serilog . Expressions . Ast ;
6- using Superpower ;
7- using Superpower . Model ;
8- using Superpower . Parsers ;
6+ using Serilog . ParserConstruction ;
7+ using Serilog . ParserConstruction . Model ;
8+ using Serilog . ParserConstruction . Parsers ;
99
1010namespace Serilog . Expressions . Parsing
1111{
@@ -65,23 +65,23 @@ public static TokenListParserResult<ExpressionToken, Expression> TryPartialParse
6565
6666 static readonly TokenListParser < ExpressionToken , Func < Expression , Expression > > PropertyPathIndexerStep =
6767 from open in Token . EqualTo ( ExpressionToken . LBracket )
68- from indexer in Wildcard . Or ( Parse . Ref ( ( ) => Expr ) )
68+ from indexer in Wildcard . Or ( Parse . Ref ( ( ) => Expr ! ) )
6969 from close in Token . EqualTo ( ExpressionToken . RBracket )
7070 select new Func < Expression , Expression > ( r => new IndexerExpression ( r , indexer ) ) ;
7171
7272 static readonly TokenListParser < ExpressionToken , Expression > Function =
7373 ( from name in Token . EqualTo ( ExpressionToken . Identifier )
7474 from lparen in Token . EqualTo ( ExpressionToken . LParen )
75- from expr in Parse . Ref ( ( ) => Expr ) . ManyDelimitedBy ( Token . EqualTo ( ExpressionToken . Comma ) )
75+ from expr in Parse . Ref ( ( ) => Expr ! ) . ManyDelimitedBy ( Token . EqualTo ( ExpressionToken . Comma ) )
7676 from rparen in Token . EqualTo ( ExpressionToken . RParen )
7777 from ci in Token . EqualTo ( ExpressionToken . CI ) . Value ( true ) . OptionalOrDefault ( )
7878 select ( Expression ) new CallExpression ( ci , name . ToStringValue ( ) , expr ) ) . Named ( "function" ) ;
7979
8080 static readonly TokenListParser < ExpressionToken , Element > ArrayElement =
8181 Token . EqualTo ( ExpressionToken . Spread )
82- . IgnoreThen ( Parse . Ref ( ( ) => Expr ) )
82+ . IgnoreThen ( Parse . Ref ( ( ) => Expr ! ) )
8383 . Select ( content => ( Element ) new SpreadElement ( content ) )
84- . Or ( Parse . Ref ( ( ) => Expr ) . Select ( item => ( Element ) new ItemElement ( item ) ) ) ;
84+ . Or ( Parse . Ref ( ( ) => Expr ! ) . Select ( item => ( Element ) new ItemElement ( item ) ) ) ;
8585
8686 static readonly TokenListParser < ExpressionToken , Expression > ArrayLiteral =
8787 ( from lbracket in Token . EqualTo ( ExpressionToken . LBracket )
@@ -92,7 +92,7 @@ from rbracket in Token.EqualTo(ExpressionToken.RBracket)
9292 static readonly TokenListParser < ExpressionToken , Member > IdentifierMember =
9393 from key in Token . EqualTo ( ExpressionToken . Identifier ) . Or ( Token . EqualTo ( ExpressionToken . BuiltInIdentifier ) )
9494 from value in Token . EqualTo ( ExpressionToken . Colon )
95- . IgnoreThen ( Parse . Ref ( ( ) => Expr ) )
95+ . IgnoreThen ( Parse . Ref ( ( ) => Expr ! ) )
9696 . Cast < ExpressionToken , Expression , Expression ? > ( )
9797 . OptionalOrDefault ( )
9898 select ( Member ) new PropertyMember (
@@ -104,12 +104,12 @@ from value in Token.EqualTo(ExpressionToken.Colon)
104104 static readonly TokenListParser < ExpressionToken , Member > StringMember =
105105 from key in Token . EqualTo ( ExpressionToken . String ) . Apply ( ExpressionTextParsers . String )
106106 from colon in Token . EqualTo ( ExpressionToken . Colon )
107- from value in Parse . Ref ( ( ) => Expr )
107+ from value in Parse . Ref ( ( ) => Expr ! )
108108 select ( Member ) new PropertyMember ( key , value ) ;
109109
110110 static readonly TokenListParser < ExpressionToken , Member > SpreadMember =
111111 from spread in Token . EqualTo ( ExpressionToken . Spread )
112- from content in Parse . Ref ( ( ) => Expr )
112+ from content in Parse . Ref ( ( ) => Expr ! )
113113 select ( Member ) new SpreadMember ( content ) ;
114114
115115 static readonly TokenListParser < ExpressionToken , Member > ObjectMember =
@@ -146,11 +146,11 @@ from rbrace in Token.EqualTo(ExpressionToken.RBrace)
146146
147147 static readonly TokenListParser < ExpressionToken , Expression > Conditional =
148148 from _ in Token. EqualTo( ExpressionToken . If )
149- from condition in Parse . Ref ( ( ) => Expr )
149+ from condition in Parse . Ref ( ( ) => Expr ! )
150150 from __ in Token. EqualTo( ExpressionToken . Then )
151- from consequent in Parse . Ref ( ( ) => Expr )
151+ from consequent in Parse . Ref ( ( ) => Expr ! )
152152 from ___ in Token. EqualTo( ExpressionToken . Else )
153- from alternative in Parse . Ref ( ( ) => Expr )
153+ from alternative in Parse . Ref ( ( ) => Expr ! )
154154 select ( Expression ) new CallExpression ( false , Operators . RuntimeOpIfThenElse , condition , consequent , alternative ) ;
155155
156156 static readonly TokenListParser < ExpressionToken , Expression > Literal =
@@ -172,7 +172,7 @@ from alternative in Parse.Ref(() => Expr)
172172
173173 static readonly TokenListParser < ExpressionToken , Expression > Factor =
174174 ( from lparen in Token . EqualTo ( ExpressionToken . LParen )
175- from expr in Parse . Ref ( ( ) => Expr )
175+ from expr in Parse . Ref ( ( ) => Expr ! )
176176 from rparen in Token . EqualTo ( ExpressionToken . RParen )
177177 select expr )
178178 . Or ( Item ) ;
0 commit comments