public UnsafeExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression expression)
     : base(span, dataType, semantics)
 {
     Expression = expression;
 }
 protected ImplicitConversionExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression expression)
     : base(span, dataType, semantics)
 {
     Expression = expression;
 }
 public NameExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     NamedBindingSymbol referencedSymbol)
     : base(span, dataType, semantics)
 {
     ReferencedSymbol = referencedSymbol;
 }
 public LoopExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IBlockExpression block)
     : base(span, dataType, semantics)
 {
     Block = block;
 }
Esempio n. 5
0
 public BreakExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression?value)
     : base(span, dataType, semantics)
 {
     Value = value;
 }
 public BoolLiteralExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     bool value)
     : base(span, dataType, semantics)
 {
     Value = value;
 }
 public IntegerLiteralExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     BigInteger value)
     : base(span, dataType, semantics)
 {
     Value = value;
 }
 public StringLiteralExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     string value)
     : base(span, dataType, semantics)
 {
     Value = value;
 }
Esempio n. 9
0
 public BlockExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     FixedList <IStatement> statements)
     : base(span, dataType, semantics)
 {
     Statements = statements;
 }
 public ImplicitImmutabilityConversion(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression expression,
     ObjectType convertToType)
     : base(span, dataType, semantics, expression)
 {
     ConvertToType = convertToType;
 }
Esempio n. 11
0
 public ImplicitNumericConversionExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression expression,
     NumericType convertToType)
     : base(span, dataType, semantics, expression)
 {
     ConvertToType = convertToType;
 }
 public FunctionInvocationExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     FunctionSymbol referencedSymbol,
     FixedList <IExpression> arguments)
     : base(span, dataType, semantics)
 {
     ReferencedSymbol = referencedSymbol;
     Arguments        = arguments;
 }
Esempio n. 13
0
 public NewObjectExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     ConstructorSymbol referencedSymbol,
     FixedList <IExpression> arguments)
     : base(span, dataType, semantics)
 {
     ReferencedSymbol = referencedSymbol;
     Arguments        = arguments;
 }
 public WhileExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression condition,
     IBlockExpression block)
     : base(span, dataType, semantics)
 {
     Condition = condition;
     Block     = block;
 }
Esempio n. 15
0
 public SelfExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     SelfParameterSymbol referencedSymbol,
     bool isImplicit)
     : base(span, dataType, semantics)
 {
     ReferencedSymbol = referencedSymbol;
     IsImplicit       = isImplicit;
 }
Esempio n. 16
0
 public BorrowExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     BindingSymbol referencedSymbol,
     IExpression referent)
     : base(span, dataType, semantics)
 {
     ReferencedSymbol = referencedSymbol;
     Referent         = referent;
 }
Esempio n. 17
0
 public IfExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression condition,
     IBlockOrResult thenBlock,
     IElseClause?elseClause)
     : base(span, dataType, semantics)
 {
     Condition  = condition;
     ThenBlock  = thenBlock;
     ElseClause = elseClause;
 }
Esempio n. 18
0
 public ForeachExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     VariableSymbol symbol,
     IExpression inExpression,
     IBlockExpression block)
     : base(span, dataType, semantics)
 {
     Symbol       = symbol;
     InExpression = inExpression;
     Block        = block;
 }
 public AssignmentExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IAssignableExpression leftOperand,
     AssignmentOperator @operator,
     IExpression rightOperand)
     : base(span, dataType, semantics)
 {
     LeftOperand  = leftOperand;
     Operator     = @operator;
     RightOperand = rightOperand;
 }
 public UnaryOperatorExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     UnaryOperatorFixity fixity,
     UnaryOperator @operator,
     IExpression operand)
     : base(span, dataType, semantics)
 {
     Fixity   = fixity;
     Operator = @operator;
     Operand  = operand;
 }
 public FieldAccessExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression context,
     AccessOperator accessOperator,
     FieldSymbol referencedSymbol)
     : base(span, dataType, semantics)
 {
     Context          = context;
     AccessOperator   = accessOperator;
     ReferencedSymbol = referencedSymbol;
 }
 public BinaryOperatorExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression leftOperand,
     BinaryOperator @operator,
     IExpression rightOperand)
     : base(span, dataType, semantics)
 {
     LeftOperand  = leftOperand;
     Operator     = @operator;
     RightOperand = rightOperand;
 }
 public MethodInvocationExpression(
     TextSpan span,
     DataType dataType,
     ExpressionSemantics semantics,
     IExpression context,
     MethodSymbol referencedSymbol,
     FixedList <IExpression> arguments)
     : base(span, dataType, semantics)
 {
     Context          = context;
     ReferencedSymbol = referencedSymbol;
     Arguments        = arguments;
 }
                public P?TryGetP(ExpressionSemantics semantics, object?value, IGremlinQueryEnvironment environment)
                {
                    if (value is string { Length : > 0 } str&& semantics is StringExpressionSemantics {
                        Comparison : StringComparison.OrdinalIgnoreCase
                    } stringExpressionSemantics)
                    {
                        switch (_indexConfiguration)
                        {
                        case NeptuneElasticSearchIndexConfiguration.Standard :
                            {
                                if (!str.Any(c => char.IsWhiteSpace(c))) //Can't do better. Insight welcome.
                                {
                                    switch (stringExpressionSemantics)
                                    {
                                    // This will only work for property values that don't contain e.g. whitespace
                                    // and would be tokenized as a complete string. As it is, a vertex property
                                    // with value "John Doe" would match a query "StartsWith('Doe') which is
                                    // not really what's expected. So we can't do better than a case-insensitive
                                    // "Contains(..)"
                                    case HasInfixExpressionSemantics :
                                        return(new P("eq", $"Neptune#fts *{value}*"));
                                    }
                                }

                                break;
                            }

                        case NeptuneElasticSearchIndexConfiguration.LowercaseKeyword:
                        {
                            str = str
                                  .Replace(" ", @"\ ");

                            switch (stringExpressionSemantics)
                            {
                            case StartsWithExpressionSemantics:
                                return(new P("eq", $"Neptune#fts {str}*"));

                            case EndsWithExpressionSemantics:
                                return(new P("eq", $"Neptune#fts *{str}"));

                            case HasInfixExpressionSemantics:
                                return(new P("eq", $"Neptune#fts *{str}*"));
                            }

                            break;
                        }
                        }
                    }

                    return(default);
 public GremlinExpression(ExpressionFragment left, ExpressionSemantics semantics, ExpressionFragment right)
 {
     if (!(left is ParameterExpressionFragment) && right is ParameterExpressionFragment)
     {
         Left      = right;
         Semantics = semantics.Flip();
         Right     = left;
     }
     else
     {
         Left      = left;
         Right     = right;
         Semantics = semantics;
     }
 }
        public static string Action(this ExpressionSemantics valueSemantics)
        {
            string mutability = valueSemantics switch
            {
                ExpressionSemantics.Never => "never",
                ExpressionSemantics.Void => "void",
                ExpressionSemantics.Move => "move",
                ExpressionSemantics.Copy => "copy",
                ExpressionSemantics.Acquire => "own",
                ExpressionSemantics.Borrow => "borrow",
                ExpressionSemantics.Share => "share",
                ExpressionSemantics.CreateReference => "ref",
                _ => throw ExhaustiveMatch.Failed(valueSemantics),
            };

            return(mutability);
        }
Esempio n. 27
0
 public static ExpressionSemantics Flip(this ExpressionSemantics semantics)
 {
     return(semantics switch
     {
         ExpressionSemantics.Contains => ExpressionSemantics.IsContainedIn,
         ExpressionSemantics.StartsWith => ExpressionSemantics.IsPrefixOf,
         ExpressionSemantics.EndsWith => ExpressionSemantics.IsSuffixOf,
         ExpressionSemantics.HasInfix => ExpressionSemantics.IsInfixOf,
         ExpressionSemantics.LowerThan => ExpressionSemantics.GreaterThan,
         ExpressionSemantics.GreaterThan => ExpressionSemantics.LowerThan,
         ExpressionSemantics.Equals => ExpressionSemantics.Equals,
         ExpressionSemantics.Intersects => ExpressionSemantics.Intersects,
         ExpressionSemantics.GreaterThanOrEqual => ExpressionSemantics.LowerThanOrEqual,
         ExpressionSemantics.LowerThanOrEqual => ExpressionSemantics.GreaterThanOrEqual,
         ExpressionSemantics.NotEquals => ExpressionSemantics.NotEquals,
         ExpressionSemantics.IsContainedIn => ExpressionSemantics.Contains,
         ExpressionSemantics.IsInfixOf => ExpressionSemantics.HasInfix,
         ExpressionSemantics.IsPrefixOf => ExpressionSemantics.StartsWith,
         ExpressionSemantics.IsSuffixOf => ExpressionSemantics.EndsWith,
         _ => throw new ArgumentOutOfRangeException(nameof(semantics), semantics, null)
     });
Esempio n. 28
0
 public NextExpression(TextSpan span, DataType dataType, ExpressionSemantics semantics)
     : base(span, dataType, semantics)
 {
 }
Esempio n. 29
0
 protected Expression(TextSpan span, DataType dataType, ExpressionSemantics semantics)
     : base(span)
 {
     DataType  = dataType;
     Semantics = semantics;
 }
 protected LiteralExpression(TextSpan span, DataType dataType, ExpressionSemantics semantics)
     : base(span, dataType, semantics)
 {
 }