Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ProcessFunction()

Query MS.Internal.Xml.XPath.QueryBuilder.ProcessFunction ( Function root,
out Props props )
inlineprivate

Definition at line 294 of file QueryBuilder.cs.

295 {
296 props = Props.None;
297 Query query = null;
298 switch (root.TypeOfFunction)
299 {
300 case Function.FunctionType.FuncLast:
301 query = new NodeFunctions(root.TypeOfFunction, null);
302 props |= Props.HasLast;
303 return query;
304 case Function.FunctionType.FuncPosition:
305 query = new NodeFunctions(root.TypeOfFunction, null);
306 props |= Props.HasPosition;
307 return query;
308 case Function.FunctionType.FuncCount:
309 return new NodeFunctions(Function.FunctionType.FuncCount, ProcessNode(root.ArgumentList[0], Flags.None, out props));
310 case Function.FunctionType.FuncID:
311 query = new IDQuery(ProcessNode(root.ArgumentList[0], Flags.None, out props));
312 props |= Props.NonFlat;
313 return query;
314 case Function.FunctionType.FuncLocalName:
315 case Function.FunctionType.FuncNameSpaceUri:
316 case Function.FunctionType.FuncName:
317 if (root.ArgumentList != null && root.ArgumentList.Count > 0)
318 {
319 return new NodeFunctions(root.TypeOfFunction, ProcessNode(root.ArgumentList[0], Flags.None, out props));
320 }
321 return new NodeFunctions(root.TypeOfFunction, null);
322 case Function.FunctionType.FuncString:
323 case Function.FunctionType.FuncConcat:
324 case Function.FunctionType.FuncStartsWith:
325 case Function.FunctionType.FuncContains:
326 case Function.FunctionType.FuncSubstringBefore:
327 case Function.FunctionType.FuncSubstringAfter:
328 case Function.FunctionType.FuncSubstring:
329 case Function.FunctionType.FuncStringLength:
330 case Function.FunctionType.FuncNormalize:
331 case Function.FunctionType.FuncTranslate:
332 return new StringFunctions(root.TypeOfFunction, ProcessArguments(root.ArgumentList, out props));
333 case Function.FunctionType.FuncNumber:
334 case Function.FunctionType.FuncSum:
335 case Function.FunctionType.FuncFloor:
336 case Function.FunctionType.FuncCeiling:
337 case Function.FunctionType.FuncRound:
338 if (root.ArgumentList != null && root.ArgumentList.Count > 0)
339 {
340 return new NumberFunctions(root.TypeOfFunction, ProcessNode(root.ArgumentList[0], Flags.None, out props));
341 }
342 return new NumberFunctions(Function.FunctionType.FuncNumber, null);
343 case Function.FunctionType.FuncTrue:
344 case Function.FunctionType.FuncFalse:
345 return new BooleanFunctions(root.TypeOfFunction, null);
346 case Function.FunctionType.FuncBoolean:
347 case Function.FunctionType.FuncNot:
348 case Function.FunctionType.FuncLang:
349 return new BooleanFunctions(root.TypeOfFunction, ProcessNode(root.ArgumentList[0], Flags.None, out props));
350 case Function.FunctionType.FuncUserDefined:
351 _needContext = true;
352 if (!_allowCurrent && root.Name == "current" && root.Prefix.Length == 0)
353 {
355 }
356 if (!_allowKey && root.Name == "key" && root.Prefix.Length == 0)
357 {
359 }
360 query = new FunctionQuery(root.Prefix, root.Name, ProcessArguments(root.ArgumentList, out props));
361 props |= Props.NonFlat;
362 return query;
363 default:
365 }
366 }
List< Query > ProcessArguments(List< AstNode > args, out Props props)
Query ProcessNode(AstNode root, Flags flags, out Props props)
static string Xp_CurrentNotAllowed
Definition SR.cs:1264
static string Xp_InvalidKeyPattern
Definition SR.cs:1250
static string Xp_NotSupported
Definition SR.cs:1246
Definition SR.cs:7
static XPathException Create(string res)

References MS.Internal.Xml.XPath.QueryBuilder._allowCurrent, MS.Internal.Xml.XPath.QueryBuilder._allowKey, MS.Internal.Xml.XPath.QueryBuilder._needContext, MS.Internal.Xml.XPath.QueryBuilder._query, MS.Internal.Xml.XPath.Function.ArgumentList, System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.Xml.XPath.XPathException.Create(), MS.Internal.Xml.XPath.Function.Name, MS.Internal.Xml.XPath.Function.Prefix, MS.Internal.Xml.XPath.QueryBuilder.ProcessArguments(), MS.Internal.Xml.XPath.QueryBuilder.ProcessNode(), MS.Internal.Xml.XPath.Function.TypeOfFunction, System.SR.Xp_CurrentNotAllowed, System.SR.Xp_InvalidKeyPattern, and System.SR.Xp_NotSupported.

Referenced by MS.Internal.Xml.XPath.QueryBuilder.ProcessNode().