List<Token> tokenize() throws ScanException {
        List<Token> tokenList = new ArrayList<Token>();
        StringBuilder buf = new StringBuilder();

        while (pointer < patternLength) {
            char c = pattern.charAt(pointer);
            pointer++;

            switch (state) {
            case LITERAL_STATE:
                handleLiteralState(c, tokenList, buf);
                break;
            case START_STATE:
                handleStartState(c, tokenList, buf);
                break;
            case DEFAULT_VAL_STATE:
                handleDefaultValueState(c, tokenList, buf);
            default:
            }
        }
        // EOS
        switch (state) {
        case LITERAL_STATE:
            addLiteralToken(tokenList, buf);
            break;
        case DEFAULT_VAL_STATE:
            // trailing colon. see also LOGBACK-1140
            buf.append(CoreConstants.COLON_CHAR);
            addLiteralToken(tokenList, buf);
            break;
        case START_STATE:
            // trailing $. see also LOGBACK-1149
            buf.append(CoreConstants.DOLLAR);
            addLiteralToken(tokenList, buf);
            break;
        }
        return tokenList;
    }
@Test
    public void colonFollowedByDollar() throws ScanException {
        String input = "a:${b}";
        Tokenizer tokenizer = new Tokenizer(input);
        List<Token> tokenList = tokenizer.tokenize();
        witnessList.add(new Token(Token.Type.LITERAL, "a"));
        witnessList.add(new Token(Token.Type.LITERAL, ":"));
        witnessList.add(Token.START_TOKEN);
        witnessList.add(new Token(Token.Type.LITERAL, "b"));
        witnessList.add(Token.CURLY_RIGHT_TOKEN);
        assertEquals(witnessList, tokenList);

    }