Пример #1
0
void
xml_html_parser::parse () {
  string r;
  while (s) {
    if (s[0] == '<') {
      if (N(r) != 0) { a << tree (r); }
      if (test (s, "</")) a << parse_closing ();
      else if (test (s, "<?")) a << parse_pi ();
      else if (test (s, "<!--")) a << parse_comment ();
      else if (test (s, "<![CDATA[")) a << parse_cdata ();
      else if (test (s, "<!DOCTYPE")) a << parse_doctype ();
      else if (test (s, "<!")) a << parse_misc ();
      else a << parse_opening ();
      r= "";
    }
    else if (s[0] == '&') r << parse_entity ();
    else r << s->read (1);
  }
  if (N(r) != 0) a << tree (r);
}
Пример #2
0
bool
wcore_config_attrs_parse(
      const int32_t waffle_attrib_list[],
      struct wcore_config_attrs *attrs)
{
    memset(attrs, 0, sizeof(*attrs));

    if (!check_keys(waffle_attrib_list))
        return false;

    if (!parse_context_api(attrs, waffle_attrib_list))
        return false;

    if (!set_context_version_default(attrs))
        return false;

    if (!parse_context_version(attrs, waffle_attrib_list))
        return false;

    if (!set_context_profile_default(attrs))
        return false;

    if (!parse_context_profile(attrs, waffle_attrib_list))
        return false;

    if (!parse_context_forward_compatible(attrs, waffle_attrib_list))
        return false;

    if (!set_misc_defaults(attrs))
        return false;

    if (!parse_misc(attrs, waffle_attrib_list))
        return false;

    if (!check_final(attrs))
        return false;

    return true;
}