private bool TryValueOrNullDefault(ParserContext context, out IAstNode instr)
        {
            instr = null;

            if (!context.Stream.Consume <IAstNode>(TryValue, context, out var value))
            {
                return(false);
            }

            if (!context.Stream.Consume(TokenTypes.DefaultNullValue))
            {
                return(false);
            }

            if (!context.Stream.Consume <IAstNode>(TryFactor, context, out var defaultValue))
            {
                return(false);
            }

            instr = new ValueWithNullDefaultNode(value, defaultValue);
            return(true);
        }
Beispiel #2
0
 /// <summary>
 ///     Will return the default value if the variable is not defined or its value is null
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 public object Visit(ValueWithNullDefaultNode node)
 {
     return(node.Value.Accept(this) ?? node.DefaultValue.Accept(this));
 }