ValueSetter::handleToken(QPDFTokenizer::Token const& token)
{
    QPDFTokenizer::token_type_e ttype = token.getType();
    std::string value = token.getValue();
    bool do_replace = false;
    switch (state)
    {
        case st_top:
          writeToken(token);
          if ((ttype == QPDFTokenizer::tt_word) && (value == "BMC"))
          {
              state = st_bmc;
          }
          break;

      case st_bmc:
        if ((ttype == QPDFTokenizer::tt_space) ||
            (ttype == QPDFTokenizer::tt_comment))
        {
            writeToken(token);
        }
        else
        {
            state = st_emc;
        }
        // fall through to emc

      case st_emc:
        if ((ttype == QPDFTokenizer::tt_word) && (value == "EMC"))
        {
            do_replace = true;
            state = st_end;
        }
        break;

      case st_end:
        writeToken(token);
        break;
    }
    if (do_replace)
    {
        writeAppearance();
    }
}
ValueSetter::handleToken(QPDFTokenizer::Token const& token)
{
    QPDFTokenizer::token_type_e ttype = token.getType();
    std::string value = token.getValue();
    bool do_replace = false;
    switch (state)
    {
        case st_top:
          writeToken(token);
          if ((ttype == QPDFTokenizer::tt_word) && (value == "BMC"))
          {
              state = st_bmc;
          }
          break;

      case st_bmc:
        if ((ttype == QPDFTokenizer::tt_space) ||
            (ttype == QPDFTokenizer::tt_comment))
        {
            writeToken(token);
        }
        else
        {
            state = st_emc;
        }
         

      case st_emc:
        if ((ttype == QPDFTokenizer::tt_word) && (value == "EMC"))
        {
            do_replace = true;
            state = st_end;
        }
        break;

      case st_end:
        writeToken(token);
        break;
    }
    if (do_replace)
    {
        writeAppearance();
    }
}