예제 #1
0
        /// <inheritdoc />
        protected override IParsingProduct TryParseInternal(IParsingContextStream ctx, ParsingOptions options)
        {
            var res = Content.TryParse(ctx, options);

            if (res == null)
            {
                ctx.SetError(new ParsingError(1, $"{GroupName} expected at: '{ctx}'; {Name}"));

                return(null);
            }

            var overwriteExpressionType = res.ExpressionType.ValueTypeId != null && _expressionType.ValueTypeId == null;

            var expressionType = overwriteExpressionType
                ? ExpressionTypeDescriptor.Create(_expressionType.Name, res.ExpressionType.ValueTypeId,
                                                  _expressionType.DefinesExpressionClass) : _expressionType;

            var node = ctx.Accept().CreateExpressionForAcceptedFragment(
                expressionType,
                res.ToList());

            return(node);
        }