HTML5-DOM

 view release on metacpan or  search on metacpan

third_party/modest/source/mycss/property/parser.c  view on Meta::CPAN

    
    mycore_string_t str = {0};
    mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
    
    if(mycss_property_shared_length(entry, token, &dec_entry->value, &dec_entry->value_type, &str) ||
       mycss_property_shared_by_value_type(entry, token, &dec_entry->value_type, MyCSS_PROPERTY_LETTER_SPACING_NORMAL, &str) ||
       mycss_property_shared_default(entry, token, &dec_entry->value_type, &str))
    {
        return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
    }
    
    return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
}

bool mycss_property_parser_direction(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
    if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
        return true;
    
    mycore_string_t str = {0};
    mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
    
    if(token->type != MyCSS_TOKEN_TYPE_IDENT)
        return mycss_property_shared_switch_to_parse_error(entry);
    
    mycss_token_data_to_string(entry, token, &str, true, false);
    dec_entry->value_type = mycss_property_value_type_by_name(str.data, str.length);
    
    switch (dec_entry->value_type) {
        case MyCSS_PROPERTY_DIRECTION_LTR:
        case MyCSS_PROPERTY_DIRECTION_RTL:
            /* default values */
        case MyCSS_PROPERTY_VALUE_INHERIT:
        case MyCSS_PROPERTY_VALUE_INITIAL:
        case MyCSS_PROPERTY_VALUE_UNSET:
            return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
            
        default:
            break;
    }
    
    return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
}

bool mycss_property_parser_unicode_bidi(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
    if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
        return true;
    
    mycore_string_t str = {0};
    mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
    
    if(token->type != MyCSS_TOKEN_TYPE_IDENT)
        return mycss_property_shared_switch_to_parse_error(entry);
    
    mycss_token_data_to_string(entry, token, &str, true, false);
    dec_entry->value_type = mycss_property_value_type_by_name(str.data, str.length);
    
    switch (dec_entry->value_type) {
        case MyCSS_PROPERTY_UNICODE_BIDI_NORMAL:
        case MyCSS_PROPERTY_UNICODE_BIDI_EMBED:
        case MyCSS_PROPERTY_UNICODE_BIDI_ISOLATE:
        case MyCSS_PROPERTY_UNICODE_BIDI_BIDI_OVERRIDE:
        case MyCSS_PROPERTY_UNICODE_BIDI_ISOLATE_OVERRIDE:
        case MyCSS_PROPERTY_UNICODE_BIDI_PLAINTEXT:
            /* default values */
        case MyCSS_PROPERTY_VALUE_INHERIT:
        case MyCSS_PROPERTY_VALUE_INITIAL:
        case MyCSS_PROPERTY_VALUE_UNSET:
            return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
            
        default:
            break;
    }
    
    return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
}

bool mycss_property_parser_writing_mode(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
    if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
        return true;
    
    mycore_string_t str = {0};
    mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
    
    if(token->type != MyCSS_TOKEN_TYPE_IDENT)
        return mycss_property_shared_switch_to_parse_error(entry);
    
    mycss_token_data_to_string(entry, token, &str, true, false);
    dec_entry->value_type = mycss_property_value_type_by_name(str.data, str.length);
    
    switch (dec_entry->value_type) {
        case MyCSS_PROPERTY_WRITING_MODE_HORIZONTAL_TB:
        case MyCSS_PROPERTY_WRITING_MODE_VERTICAL_LR:
        case MyCSS_PROPERTY_WRITING_MODE_VERTICAL_RL:
        case MyCSS_PROPERTY_WRITING_MODE_SIDEWAYS_LR:
        case MyCSS_PROPERTY_WRITING_MODE_SIDEWAYS_RL:
            /* default values */
        case MyCSS_PROPERTY_VALUE_INHERIT:
        case MyCSS_PROPERTY_VALUE_INITIAL:
        case MyCSS_PROPERTY_VALUE_UNSET:
            return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_find_important(entry));
            
        default:
            break;
    }
    
    return mycss_property_parser_destroy_string(&str, mycss_property_shared_switch_to_parse_error(entry));
}

bool mycss_property_parser_text_orientation(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
{
    if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
        return true;
    
    mycore_string_t str = {0};
    mycss_declaration_entry_t* dec_entry = entry->declaration->entry_last;
    
    if(token->type != MyCSS_TOKEN_TYPE_IDENT)
        return mycss_property_shared_switch_to_parse_error(entry);



( run in 1.660 second using v1.01-cache-2.11-cpan-71847e10f99 )