Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add bulk resolution #45

Closed
k94ll13nn3 opened this issue Oct 12, 2017 · 3 comments
Closed

Add bulk resolution #45

k94ll13nn3 opened this issue Oct 12, 2017 · 3 comments

Comments

@k94ll13nn3
Copy link
Owner

k94ll13nn3 commented Oct 12, 2017

Add a Resolve method that takes a list of values and returns a list of string, one for each value.

@k94ll13nn3
Copy link
Owner Author

Paused until 4.0 dev is started (will cause an ambiguous method resolution if used with null, like #44).

@k94ll13nn3
Copy link
Owner Author

This might be an issue when resolving multiples times (stack is emptied):

public string Resolve(ActionDictionary actions)
{
if (tokenStack.Count == 1 && tokenStack.Peek().Type == TokenType.None)
{
return tokenStack.Peek().Data;
}
var result = new StringBuilder();
while (tokenStack.Count > 0)
{
var nextToken = tokenStack.Peek();
switch (nextToken.Type)
{
case TokenType.None:
var currentToken = tokenStack.Pop();
result.Insert(0, currentToken.Data);
break;
default:
result.Insert(0, ResolveTagOrFilter(actions));
break;
}
}
return result.ToString();
}

@k94ll13nn3 k94ll13nn3 added this to the 4.0 milestone Feb 15, 2018
@k94ll13nn3
Copy link
Owner Author

Solution (with yields):

  • IEnumerable<string> Resolve(CompiledString compiledString, IEnumerable<T> values)
  • IEnumerable<string> Resolve(string input, IEnumerable<T> values) that will call the other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant