public override bool UpdateDataQuerySelects(CallNode callNode, TexlBinding binding, DataSourceToQueryOptionsMap dataSourceToQueryOptionsMap) { Contracts.AssertValue(callNode); Contracts.AssertValue(binding); // Ignore delegation warning if (!CheckArgsCount(callNode, binding, DocumentErrorSeverity.Moderate)) { return(false); } TexlNode[] args = callNode.Args.Children.VerifyValue(); DType dsType = binding.GetType(args[0]); if (dsType.AssociatedDataSources == null) { return(false); } DType columnType = binding.GetType(args[1]); StrLitNode columnNode = args[1].AsStrLit(); if (columnType.Kind != DKind.String || columnNode == null) { return(false); } string columnName = columnNode.Value; Contracts.Assert(dsType.Contains(new DName(columnName))); return(dsType.AssociateDataSourcesToSelect(dataSourceToQueryOptionsMap, columnName, columnType, true)); }
public override LazyList <string> Visit(StrLitNode node, Precedence parentPrecedence) { Contracts.AssertValue(node); return(LazyList <string> .Of( "\"", CharacterUtils.ExcelEscapeString(node.Value), "\"")); }
private bool TryGetValidSortOrderNode(StrLitNode node, out string sortOrder) { Contracts.AssertValue(node); string order = node.Value; return(IsValidOrderString(order, out sortOrder)); }
private bool IsColumnSortable(StrLitNode node, TexlBinding binding, SortOpMetadata sortMetadata) { Contracts.AssertValue(node); Contracts.AssertValue(binding); Contracts.AssertValue(sortMetadata); DPath columnPath = DPath.Root.Append(new DName(node.Value)); if (!sortMetadata.IsDelegationSupportedByColumn(columnPath, DelegationCapability.Sort)) { SuggestDelegationHint(node, binding); return(false); } return(true); }
public override bool UpdateDataQuerySelects(CallNode callNode, TexlBinding binding, DataSourceToQueryOptionsMap dataSourceToQueryOptionsMap) { Contracts.AssertValue(callNode); Contracts.AssertValue(binding); if (!CheckArgsCount(callNode, binding, DocumentErrorSeverity.Moderate)) { return(false); } TexlNode[] args = callNode.Args.Children.VerifyValue(); DType dsType = binding.GetType(args[0]); if (dsType.AssociatedDataSources == null) { return(false); } bool retval = false; for (int i = 1; i < args.Length; i += 2) { DType columnType = binding.GetType(args[i]); StrLitNode columnNode = args[i].AsStrLit(); if (columnType.Kind != DKind.String || columnNode == null) { continue; } string columnName = columnNode.Value; Contracts.Assert(dsType.Contains(new DName(columnName))); retval |= dsType.AssociateDataSourcesToSelect(dataSourceToQueryOptionsMap, columnName, columnType, true); } return(retval); }
public override void Visit(StrLitNode node) { }
public override Result Visit(StrLitNode node, Context context) { return(Default); }
public override void Visit(StrLitNode node) { Contracts.AssertValue(node); _stringLiterals.Add(node); }
public abstract Result Visit(StrLitNode node, Context context);
public override bool CheckInvocation(TexlBinding binding, TexlNode[] args, DType[] argTypes, IErrorContainer errors, out DType returnType, out Dictionary <TexlNode, DType> nodeToCoercedTypeMap) { Contracts.AssertValue(args); Contracts.AssertAllValues(args); Contracts.AssertValue(argTypes); Contracts.Assert(args.Length == argTypes.Length); Contracts.AssertValue(errors); Contracts.Assert(MinArity <= args.Length && args.Length <= MaxArity); bool fValid = base.CheckInvocation(args, argTypes, errors, out returnType, out nodeToCoercedTypeMap); Contracts.Assert(returnType.IsTable); returnType = argTypes[0]; DType sourceType = argTypes[0]; TexlNode nameArg = args[1]; DType nameArgType = argTypes[1]; StrLitNode nameNode = null; DType columnType = DType.Invalid; if (nameArgType.Kind != DKind.String) { errors.EnsureError(DocumentErrorSeverity.Severe, nameArg, TexlStrings.ErrStringExpected); fValid = false; } else if ((nameNode = nameArg.AsStrLit()) != null) { // Verify that the name is valid. if (DName.IsValidDName(nameNode.Value)) { DName columnName = new DName(nameNode.Value); // Verify that the name exists. if (!sourceType.TryGetType(columnName, out columnType)) { sourceType.ReportNonExistingName(FieldNameKind.Logical, errors, columnName, nameNode); fValid = false; } else if (!columnType.IsPrimitive) { fValid = false; errors.EnsureError(nameArg, TexlStrings.ErrSortWrongType); } } else { errors.EnsureError(DocumentErrorSeverity.Severe, nameNode, TexlStrings.ErrArgNotAValidIdentifier_Name, nameNode.Value); fValid = false; } } TexlNode valuesArg = args[2]; IEnumerable <TypedName> columns; if ((columns = argTypes[2].GetNames(DPath.Root)).Count() != 1) { errors.EnsureError(DocumentErrorSeverity.Severe, valuesArg, TexlStrings.ErrInvalidSchemaNeedCol); return(false); } TypedName column = columns.Single(); if (nameNode != null && columnType.IsValid && !columnType.Accepts(column.Type)) { errors.EnsureError(DocumentErrorSeverity.Severe, valuesArg, TexlStrings.ErrTypeError_Arg_Expected_Found, nameNode.Value, columnType.GetKindString(), column.Type.GetKindString()); fValid = false; } return(fValid); }
public abstract void Visit(StrLitNode node);
public override LazyList <string> Visit(StrLitNode node, Precedence parentPrecedence) { Contracts.AssertValue(node); return(LazyList <string> .Of("#$string$#")); }
public override void Visit(StrLitNode node) { SetCurrentNodeAsResult(node); }