in src/Microsoft.Azure.WebJobs.Host/Bindings/Path/BindingTemplateToken.cs [37:81]
public static BindingTemplateToken NewExpression(string expression)
{
// BindingData takes precedence over builtins.
BindingParameterResolver builtin;
BindingParameterResolver.TryGetResolver(expression, out builtin);
// check for formatter, which is applied to finale results.
string format = null;
if (builtin == null)
{
int indexColon = expression.IndexOf(':');
if (indexColon > 0)
{
format = expression.Substring(indexColon + 1);
expression = expression.Substring(0, indexColon);
}
}
if (!BindingTemplateParser.IsValidIdentifier(expression))
{
throw new FormatException($"Invalid template expression '{expression}");
}
// Expression is just a series of dot operators like: a.b.c
var parts = expression.Split('.');
// For backwards compat, first part can't have a '-'
if (builtin == null)
{
if (parts[0].IndexOf('-') >= 0)
{
throw new FormatException($"The parameter name '{parts[0]}' is invalid.");
}
}
foreach (var part in parts)
{
if (string.IsNullOrWhiteSpace(part))
{
throw new InvalidOperationException($"Illegal expression: {parts}");
}
}
return new ExpressionToken(parts, format, builtin);
}