示例#1
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;
}
示例#2
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;  
}
示例#3
0
文件: xmldecl.c 项目: AliSayed/MoSync
FAXPP_Error
xml_decl_or_markup_state(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case '?':
    env->state = xml_decl_or_pi_state1;
    next_char(env);
    token_start_position(env);
    break;
  case '!':
    env->state = comment_start_state1;
    next_char(env);
    token_start_position(env);
    break;
  LINE_ENDINGS
  default:
    env->state = (env)->start_element_name_state;
    env->seen_doc_element = 1;
    token_start_position(env);
    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_start_char) == 0)
      return INVALID_CHAR_IN_ELEMENT_NAME;
    break;
  }
  return NO_ERROR;
}
示例#4
0
文件: xmldecl.c 项目: AliSayed/MoSync
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;
}
示例#5
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;  
}
示例#6
0
FAXPP_Error
elementdecl_pcdata_name_seen_colon_state1(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  LINE_ENDINGS
  default:
    env->state = elementdecl_pcdata_name_seen_colon_state2;
    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_start_char) == 0)
      return INVALID_CHAR_IN_ELEMENTDECL_NAME;
    break;
  }

  return NO_ERROR;  
}
示例#7
0
FAXPP_Error
parameter_entity_reference_in_markup_state(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  env->state = parameter_entity_reference_in_markup_state2;

  switch(env->current_char) {
  LINE_ENDINGS
  default:
    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_start_char) == 0)
      return INVALID_CHAR_IN_ENTITY_REFERENCE;
    break;
  }

  return NO_ERROR;
}
示例#8
0
FAXPP_Error
reference_state(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case '#':
    env->state = char_reference_state;
    next_char(env);
    token_start_position(env);
    break;
  case 'a':
    env->state = a_entity_reference_state;
    token_start_position(env);
    next_char(env);
    break;
  case 'g':
    env->state = gt_entity_reference_state1;
    token_start_position(env);
    next_char(env);
    break;
  case 'l':
    env->state = lt_entity_reference_state1;
    token_start_position(env);
    next_char(env);
    break;
  case 'q':
    env->state = quot_entity_reference_state1;
    token_start_position(env);
    next_char(env);
    break;
  LINE_ENDINGS
  default:
    env->state = entity_reference_state;
    token_start_position(env);
    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_start_char) == 0)
      return INVALID_CHAR_IN_ENTITY_REFERENCE;
    break;
  }
  return NO_ERROR;
}
示例#9
0
FAXPP_Error
elementdecl_cp_name_state1(FAXPP_TokenizerEnv *env)
{
  read_char(env);

  switch(env->current_char) {
  case '(':
    env->elemdecl_content_level += 1;
    env->state = elementdecl_cp_name_ws_state;
    report_empty_token(ELEMENTDECL_LPAR_TOKEN, env);
    next_char(env);
    break;
  LINE_ENDINGS
  default:
    env->state = elementdecl_cp_name_state2;
    next_char(env);
    if((FAXPP_char_flags(env->current_char) & env->ncname_start_char) == 0)
      return INVALID_CHAR_IN_ELEMENTDECL_NAME;
    break;
  }
  return NO_ERROR;
}