Example #1
0
FAXPP_Error
elementdecl_pcdata_name_seen_colon_state2(FAXPP_TokenizerEnv *env)
{
  while(1) {
    read_char(env);

    switch(env->current_char) {
    WHITESPACE:
    case '%':
      env->state = elementdecl_pcdata_end_or_names_ws_state2;
      token_end_position(env);
      report_token(ELEMENTDECL_NAME_TOKEN, env);
      // No next_char
      return NO_ERROR;
    case ')':
    case '|':
      env->state = elementdecl_pcdata_end_or_names_state2;
      token_end_position(env);
      report_token(ELEMENTDECL_NAME_TOKEN, env);
      // No next_char
      return NO_ERROR;
    default:
      break;
    }

    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_char) == 0)
      return INVALID_CHAR_IN_ELEMENTDECL_NAME;
  }

  // Never happens
  return NO_ERROR;  
}
Example #2
0
FAXPP_Error
xml_decl_or_pi_state3(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case 'l':
    env->state = xml_decl_or_pi_state4;
    next_char(env);
    break;
  WHITESPACE:
    env->state = pi_ws_state;
    token_end_position(env);
    report_token(PI_NAME_TOKEN, env);
    next_char(env);
    break;
  case '?':
    env->state = pi_content_seen_question_state;
    token_end_position(env);
    report_token(PI_NAME_TOKEN, env);
    token_start_position(env);
    next_char(env);
    break;
  default:
    env->state = pi_name_m_state;
    break;
  }
  return NO_ERROR;
}
Example #3
0
FAXPP_Error
xml_decl_or_pi_state4(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  WHITESPACE:
    env->stored_state = xml_decl_version_state1;
    env->state = ws_state;
    token_end_position(env);
    next_char(env);
    break;
  case '?':
    env->state = xml_decl_seen_question_state;
    token_end_position(env);
    next_char(env);
    return INVALID_CHAR_IN_XML_DECL;
  default:
    env->state = pi_name_state;
    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_char) == 0)
      return INVALID_CHAR_IN_PI_NAME;
    break;
  }
  return NO_ERROR;
}
Example #4
0
FAXPP_Error
elementdecl_cp_name_state2(FAXPP_TokenizerEnv *env)
{
  while(1) {
    read_char(env);

    switch(env->current_char) {
    WHITESPACE:
    case '%':
      env->state = elementdecl_cp_separator_or_end_ws_state;
      token_end_position(env);
      report_token(ELEMENTDECL_NAME_TOKEN, env);
      // No next_char
      return NO_ERROR;
    case '?':
    case '*':
    case '+':
      env->state = elementdecl_cp_cardinality_state;
      token_end_position(env);
      report_token(ELEMENTDECL_NAME_TOKEN, env);
      // No next_char
      return NO_ERROR;
    case '|':
    case ',':
    case ')':
      env->state = elementdecl_cp_separator_or_end_state;
      token_end_position(env);
      report_token(ELEMENTDECL_NAME_TOKEN, env);
      // No next_char
      return NO_ERROR;
    case ':':
      env->state = elementdecl_cp_name_seen_colon_state1;
      token_end_position(env);
      report_token(ELEMENTDECL_PREFIX_TOKEN, env);
      next_char(env);
      token_start_position(env);
      return NO_ERROR;
    default:
      break;
    }

    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_char) == 0)
      return INVALID_CHAR_IN_ELEMENTDECL_NAME;
  }

  // Never happens
  return NO_ERROR;  
}
Example #5
0
FAXPP_Error
parameter_entity_reference_in_markup_state2(FAXPP_TokenizerEnv *env)
{
  while(1) {
    read_char(env);

    switch(env->current_char) {
    LINE_ENDINGS
      break;
    case ';':
      retrieve_state(env);
      token_end_position(env);
      report_token(PE_REFERENCE_IN_MARKUP_TOKEN, env);
      next_char(env);
      token_start_position(env);
      return NO_ERROR;
    }

    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_char) == 0)
      return INVALID_CHAR_IN_ENTITY_REFERENCE;
  }

  // Never happens
  return NO_ERROR;
}
Example #6
0
FAXPP_Error
xml_decl_encoding_value_apos_state2(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case '\'':
    env->state = xml_decl_standalone_ws_state;
    token_end_position(env);
    report_token(XML_DECL_ENCODING_TOKEN, env);
    break;
  case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M':
  case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z':
  case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm':
  case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z':
  case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case '.': case '_': case '-':
    break;
  LINE_ENDINGS
  default:
    next_char(env);
    return INVALID_ENCODING_VALUE;
  }
  next_char(env);
  return NO_ERROR;
}
Example #7
0
FAXPP_Error
hex_char_reference_state2(FAXPP_TokenizerEnv *env)
{
  while(1) {
    read_char(env);

    switch(env->current_char) {
    case ';':
      retrieve_state(env);
      token_end_position(env);
      report_token(HEX_CHAR_REFERENCE_TOKEN, env);
      next_char(env);
      token_start_position(env);
      return NO_ERROR;
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
    case 'a':
    case 'b':
    case 'c':
    case 'd':
    case 'e':
    case 'f':
    case 'A':
    case 'B':
    case 'C':
    case 'D':
    case 'E':
    case 'F':
      next_char(env);
      break;
    LINE_ENDINGS
    default:
      next_char(env);
      return INVALID_CHAR_IN_CHAR_REFERENCE;
    }
  }

  // Never happens
  return NO_ERROR;
}
Example #8
0
FAXPP_Error
amp_entity_reference_state2(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case ';':
    retrieve_state(env);
    token_end_position(env);
    report_token(AMP_ENTITY_REFERENCE_TOKEN, env);
    next_char(env);
    token_start_position(env);
    return NO_ERROR;
  }

  env->state = entity_reference_state;
  return NO_ERROR;
}
Example #9
0
FAXPP_Error
xml_decl_version_value_apos_state(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case '\'':
    env->state = xml_decl_encoding_ws_state;
    token_end_position(env);
    report_token(XML_DECL_VERSION_TOKEN, env);
    next_char(env);
    break;
  LINE_ENDINGS
  default:
    next_char(env);
    return UNKNOWN_XML_VERSION;
  }
  return NO_ERROR;
}
Example #10
0
FAXPP_Error
xml_decl_standalone_value_apos_state(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case '\'':
    env->stored_state = xml_decl_question_state;
    env->state = ws_state;
    token_end_position(env);
    report_token(XML_DECL_STANDALONE_TOKEN, env);
    next_char(env);
    break;
  LINE_ENDINGS
  default:
    next_char(env);
    return INVALID_CHAR_IN_XML_DECL;
  }
  return NO_ERROR;
}