third_party/modest/source/mycss/property/parser_url.c

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 34 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« third_party/modest/source/mycss/property/parser_text_decoration.c ↑ Summary third_party/modest/source/mycss/property/shared.c »
1 /*
2 Copyright (C) 2016-2017 Alexander Borisov
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public
15 License along with this library; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
18 Author: lex.borisov@gmail.com (Alexander Borisov)
19 */
20  
21 #include "mycss/property/parser.h"
22  
23 0 static void mycss_values_parser_url_switch(mycss_entry_t* entry)
24 {
25 0 mycss_stack_entry_t *stack_entry = mycss_stack_pop(entry->declaration->stack);
26
27 0 ▶ if(stack_entry->value)
Branch: 1 branch
BranchTrueFalseTotal
if(stack_entry->value) 0 0 0
28 0 entry->declaration->entry_last->value = stack_entry->value;
29
30 0 entry->parser = stack_entry->parser;
31 0 }
32  
33 0 bool mycss_property_parser_url_end(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
34 {
35 0 switch (token->type) {
36 0 case MyCSS_TOKEN_TYPE_WHITESPACE:
37 0 return true;
38
39 0 case MyCSS_TOKEN_TYPE_RIGHT_PARENTHESIS:
40 0 mycss_values_parser_url_switch(entry);
41 0 return true;
42
43 0 default:
44 0 mycss_values_parser_url_switch(entry);
45 0 return false;
46 }
47 }
48  
49 0 bool mycss_property_parser_url_string(mycss_entry_t* entry, mycss_token_t* token, bool last_response)
50 {
51 0 ▶ if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE)
Branch: 1 branch
BranchTrueFalseTotal
if(token->type == MyCSS_TOKEN_TYPE_WHITESPACE) 0 0 0
52 0 return true;
53 0 ▶ else if(token->type != MyCSS_TOKEN_TYPE_STRING) {
Branch: 1 branch
BranchTrueFalseTotal
else if(token->type != MyCSS_TOKEN_TYPE_STRING) { 0 0 0
54 0 mycss_values_parser_url_switch(entry);
55 0 return false;
56 }
57
58 0 mycore_string_t *str = mycss_values_create(entry, sizeof(mycore_string_t));
59 0 mycss_token_data_to_string(entry, token, str, true, false);
60
61 0 mycss_declaration_entry_t* declr_entry = entry->declaration->entry_last;
62 0 declr_entry->value = str;
63
64 0 entry->parser = mycss_property_parser_url_end;
65 0 return true;
66 }
67  
68  
« third_party/modest/source/mycss/property/parser_text_decoration.c ↑ Summary third_party/modest/source/mycss/property/shared.c »