BracketHandler

A bracket handler is used to resolve ZenTokens inside <tokens>.
In order to do that, ZS will add all tokens inside the brackets to a list and go through all registered bracket handlers to find one that does not return null.
The annotated class simply need to implement IBracketHandler.

Example:

CraftTweaker Test Project Bracket Handler

@BracketHandler(priority = 34)
@ZenRegister
public class BracketWiki implements IBracketHandler{

    @Override
    public IZenSymbol resolve(IEnvironmentGlobal environment, List<Token> tokens) {
        if ((tokens.size() < 3)) return null; 
        if (!tokens.get(0).getValue().equalsIgnoreCase("devBracket")) return null;
        if (!tokens.get(1).getValue().equals(":")) return null;

        return new devSymbol(tokens);
    }


    private class devSymbol implements IZenSymbol {

        private final String value;
        public devSymbol(List<Token> tokens) {
            StringBuilder sB = new StringBuilder();
            tokens.stream().map(Token::getValue).forEach(sB::append);
            this.value = sB.toString().replaceAll(":", " ");
        }

        @Override
        public IPartialExpression instance(ZenPosition position) {
            return new ExpressionString(position, "DevSymbol: ".concat(value));
        }

    }

}

What classes can be annotated || Additional Info