source/myhtml/tokenizer_script.c

filter: Statementstmt 0.0% 0 / 296 Branchbran 0.0% 0 / 202 Conditioncond n/a MC/DCmcdc n/a Subroutinesub n/a Podpod n/a totaltotal 0.0% 0 / 498 CC 0 SCAR 0
CC
0
Cov
0%
CRAP 0
« source/myhtml/tokenizer_end.c ↑ Summary source/myhtml/utils.c »
1 /*
2 Copyright 2015 Alexander Borisov
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Author: lex.borisov@gmail.com (Alexander Borisov)
17 */
18  
19 #include "myhtml/tokenizer_script.h"
20  
21  
22 0 size_t myhtml_tokenizer_state_script_data(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
23 {
24 0 ▶ while (html_offset < html_size)
Branch: 1 branch
BranchTrueFalseTotal
while (html_offset < html_size) 0 0 0
25 {
26 0 ▶ if(html[html_offset] == '<') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '<') { 0 0 0
27 0 html_offset++;
28 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_LESS_THAN_SIGN;
29
30 0 break;
31 }
32
33 0 html_offset++;
34 }
35
36 0 return html_offset;
37 }
38  
39 0 size_t myhtml_tokenizer_state_script_data_less_than_sign(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
40 {
41 0 ▶ if(html[html_offset] == '/')
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '/') 0 0 0
42 {
43 0 html_offset++;
44 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_END_TAG_OPEN;
45 }
46 0 ▶ else if(html[html_offset] == '!')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '!') 0 0 0
47 {
48 0 html_offset++;
49 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPE_START;
50 }
51 else {
52 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
53 }
54
55 0 return html_offset;
56 }
57  
58 0 size_t myhtml_tokenizer_state_script_data_escape_start(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
59 {
60 0 ▶ if(html[html_offset] == '-') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') { 0 0 0
61 0 html_offset++;
62 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPE_START_DASH;
63 }
64 else {
65 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
66 }
67
68 0 return html_offset;
69 }
70  
71 0 size_t myhtml_tokenizer_state_script_data_escape_start_dash(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
72 {
73 0 ▶ if(html[html_offset] == '-') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') { 0 0 0
74 0 html_offset++;
75 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_DASH_DASH;
76 }
77 else {
78 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
79 }
80
81 0 return html_offset;
82 }
83  
84 0 size_t myhtml_tokenizer_state_script_data_end_tag_open(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
85 {
86 0 ▶ if(myhtml_ascii_char_cmp(html[html_offset])) {
Branch: 4 branches
BranchTrueFalseTotal
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
87 0 qnode->token->begin = (html_offset + tree->global_offset);
88 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_END_TAG_NAME;
89 }
90 else {
91 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
92 }
93
94 0 return html_offset;
95 }
96  
97 0 size_t myhtml_tokenizer_state_script_data_end_tag_name(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
98 {
99 0 ▶ while(html_offset < html_size)
Branch: 1 branch
BranchTrueFalseTotal
while(html_offset < html_size) 0 0 0
100 {
101 0 ▶ if(myhtml_whithspace(html[html_offset], ==, ||))
Branch: 5 branches
BranchTrueFalseTotal
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
102 {
103 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
104 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
105 0 html_offset++;
106 0 break;
107 }
108
109 0 size_t tmp_size = qnode->begin;
110 0 qnode->begin = qnode->token->begin;
111
112 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
113
114 0 qnode->begin = tmp_size;
115
116 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) 0 0 0
117 {
118 0 qnode = myhtml_tokenizer_queue_create_text_node_if_need(tree, qnode, html, ((html_offset + tree->global_offset) - 8), MyHTML_TOKEN_TYPE_SCRIPT);
119
120 0 qnode->begin = qnode->token->begin;
121 0 qnode->length = 6;
122 0 qnode->token->tag_ctx_idx = MyHTML_TAG_SCRIPT;
123 0 qnode->token->type = MyHTML_TOKEN_TYPE_CLOSE;
124
125 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_BEFORE_ATTRIBUTE_NAME;
126 }
127 else {
128 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
129 }
130
131 0 html_offset++;
132 0 break;
133 }
134 0 ▶ else if(html[html_offset] == '/')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '/') 0 0 0
135 {
136 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
137 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
138 0 html_offset++;
139 0 break;
140 }
141
142 0 size_t tmp_size = qnode->begin;
143 0 qnode->begin = qnode->token->begin;
144
145 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
146
147 0 qnode->begin = tmp_size;
148
149 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) 0 0 0
150 {
151 0 qnode = myhtml_tokenizer_queue_create_text_node_if_need(tree, qnode, html, ((html_offset + tree->global_offset) - 8), MyHTML_TOKEN_TYPE_SCRIPT);
152
153 0 qnode->begin = qnode->token->begin;
154 0 qnode->length = 6;
155 0 qnode->token->tag_ctx_idx = MyHTML_TAG_SCRIPT;
156 0 qnode->token->type = MyHTML_TOKEN_TYPE_CLOSE|MyHTML_TOKEN_TYPE_CLOSE_SELF;
157
158 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_BEFORE_ATTRIBUTE_NAME;
159 }
160 else {
161 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
162 }
163
164 0 html_offset++;
165 0 break;
166 }
167 0 ▶ else if(html[html_offset] == '>')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '>') 0 0 0
168 {
169 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
170 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
171 0 html_offset++;
172 0 break;
173 }
174
175 0 size_t tmp_size = qnode->begin;
176 0 qnode->begin = qnode->token->begin;
177
178 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
179 0 qnode->begin = tmp_size;
180
181 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) 0 0 0
182 {
183 0 qnode = myhtml_tokenizer_queue_create_text_node_if_need(tree, qnode, html, ((html_offset + tree->global_offset) - 8), MyHTML_TOKEN_TYPE_SCRIPT);
184
185 0 qnode->begin = qnode->token->begin;
186 0 qnode->length = 6;
187 0 qnode->token->tag_ctx_idx = MyHTML_TAG_SCRIPT;
188 0 qnode->token->type = MyHTML_TOKEN_TYPE_CLOSE;
189
190 0 html_offset++;
191 0 myhtml_queue_add(tree, html, html_offset, qnode);
192
193 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_DATA;
194 }
195 else {
196 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
197 0 html_offset++;
198 }
199
200 0 break;
201 }
202 0 ▶ else if(myhtml_ascii_char_unless_cmp(html[html_offset]))
Branch: 4 branches
BranchTrueFalseTotal
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
203 {
204 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
205 0 break;
206 }
207
208 0 html_offset++;
209 }
210
211 0 return html_offset;
212 }
213  
214 0 size_t myhtml_tokenizer_state_script_data_escaped_dash_dash(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
215 {
216 0 ▶ if(html[html_offset] == '-') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') { 0 0 0
217 0 html_offset++;
218 0 return html_offset;
219 }
220
221 0 ▶ if(html[html_offset] == '<') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '<') { 0 0 0
222 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
223 }
224 0 ▶ else if(html[html_offset] == '>') {
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '>') { 0 0 0
225 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
226 }
227 else {
228 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
229 }
230
231 0 html_offset++;
232
233 0 return html_offset;
234 }
235  
236 0 size_t myhtml_tokenizer_state_script_data_escaped_less_than_sign(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
237 {
238 0 ▶ if(html[html_offset] == '/') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '/') { 0 0 0
239 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_END_TAG_OPEN;
240 0 html_offset++;
241 }
242 0 ▶ else if(myhtml_ascii_char_cmp(html[html_offset])) {
Branch: 4 branches
BranchTrueFalseTotal
else if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
else if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
else if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
else if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
243 0 qnode->token->begin = (html_offset + tree->global_offset);
244 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPE_START;
245 }
246 else {
247 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
248 }
249
250 0 return html_offset;
251 }
252  
253 0 size_t myhtml_tokenizer_state_script_data_escaped_end_tag_open(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
254 {
255 0 ▶ if(myhtml_ascii_char_cmp(html[html_offset])) {
Branch: 4 branches
BranchTrueFalseTotal
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
if(myhtml_ascii_char_cmp(html[html_offset])) { 0 0 0
256 0 qnode->token->begin = (html_offset + tree->global_offset);
257 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_END_TAG_NAME;
258 }
259 else {
260 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
261 }
262
263 0 return html_offset;
264 }
265  
266 0 size_t myhtml_tokenizer_state_script_data_escaped_end_tag_name(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
267 {
268 0 ▶ while(html_offset < html_size)
Branch: 1 branch
BranchTrueFalseTotal
while(html_offset < html_size) 0 0 0
269 {
270 0 ▶ if(myhtml_whithspace(html[html_offset], ==, ||))
Branch: 5 branches
BranchTrueFalseTotal
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||)) 0 0 0
271 {
272 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
273 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
274 0 html_offset++;
275 0 break;
276 }
277
278 0 size_t tmp_size = qnode->begin;
279 0 qnode->begin = qnode->token->begin;
280
281 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
282
283 0 qnode->begin = tmp_size;
284
285 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) 0 0 0
286 {
287 0 qnode = myhtml_tokenizer_queue_create_text_node_if_need(tree, qnode, html, ((html_offset + tree->global_offset) - 8), MyHTML_TOKEN_TYPE_SCRIPT);
288
289 0 qnode->begin = qnode->token->begin;
290 0 qnode->length = 6;
291 0 qnode->token->tag_ctx_idx = MyHTML_TAG_SCRIPT;
292 0 qnode->token->type = MyHTML_TOKEN_TYPE_CLOSE;
293
294 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_BEFORE_ATTRIBUTE_NAME;
295 }
296 else {
297 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
298 }
299
300 0 html_offset++;
301 0 break;
302 }
303 0 ▶ else if(html[html_offset] == '/')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '/') 0 0 0
304 {
305 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
306 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
307 0 html_offset++;
308 0 break;
309 }
310
311 0 size_t tmp_size = qnode->begin;
312 0 qnode->begin = qnode->token->begin;
313
314 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
315
316 0 qnode->begin = tmp_size;
317
318 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) 0 0 0
319 {
320 0 qnode = myhtml_tokenizer_queue_create_text_node_if_need(tree, qnode, html, ((html_offset + tree->global_offset) - 8), MyHTML_TOKEN_TYPE_SCRIPT);
321
322 0 qnode->begin = qnode->token->begin;
323 0 qnode->length = 6;
324 0 qnode->token->tag_ctx_idx = MyHTML_TAG_SCRIPT;
325 0 qnode->token->type = MyHTML_TOKEN_TYPE_CLOSE|MyHTML_TOKEN_TYPE_CLOSE_SELF;
326
327 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_BEFORE_ATTRIBUTE_NAME;
328 }
329 else {
330 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
331 }
332
333 0 html_offset++;
334 0 break;
335 }
336 0 ▶ else if(html[html_offset] == '>')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '>') 0 0 0
337 {
338 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
339 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
340 0 html_offset++;
341 0 break;
342 }
343
344 0 size_t tmp_size = qnode->begin;
345 0 qnode->begin = qnode->token->begin;
346
347 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
348
349 0 qnode->begin = tmp_size;
350
351 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0)
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) 0 0 0
352 {
353 0 qnode = myhtml_tokenizer_queue_create_text_node_if_need(tree, qnode, html, ((html_offset + tree->global_offset) - 8), MyHTML_TOKEN_TYPE_SCRIPT);
354
355 0 qnode->begin = qnode->token->begin;
356 0 qnode->length = 6;
357 0 qnode->token->tag_ctx_idx = MyHTML_TAG_SCRIPT;
358 0 qnode->token->type = MyHTML_TOKEN_TYPE_CLOSE;
359
360 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_DATA;
361
362 0 html_offset++;
363 0 myhtml_queue_add(tree, html, html_offset, qnode);
364 }
365 else {
366 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
367 0 html_offset++;
368 }
369 0 break;
370 }
371 0 ▶ else if(myhtml_ascii_char_unless_cmp(html[html_offset]))
Branch: 4 branches
BranchTrueFalseTotal
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
372 {
373 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
374 0 break;
375 }
376
377 0 html_offset++;
378 }
379
380 0 return html_offset;
381 }
382  
383 0 size_t myhtml_tokenizer_state_script_data_escaped(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
384 {
385 0 ▶ while(html_offset < html_size)
Branch: 1 branch
BranchTrueFalseTotal
while(html_offset < html_size) 0 0 0
386 {
387 0 ▶ if(html[html_offset] == '-')
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') 0 0 0
388 {
389 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_DASH;
390 0 html_offset++;
391 0 break;
392 }
393 0 ▶ else if(html[html_offset] == '<')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '<') 0 0 0
394 {
395 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
396 0 html_offset++;
397 0 break;
398 }
399
400 0 html_offset++;
401 }
402
403 0 return html_offset;
404 }
405  
406 0 size_t myhtml_tokenizer_state_script_data_escaped_dash(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
407 {
408 0 ▶ if(html[html_offset] == '-') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') { 0 0 0
409 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_DASH_DASH;
410 0 html_offset++;
411 }
412 0 ▶ else if(html[html_offset] == '<') {
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '<') { 0 0 0
413 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN;
414 }
415 0 ▶ else if(html[html_offset] == '\0') {
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '\0') { 0 0 0
416 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
417 }
418 else {
419 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
420 0 html_offset++;
421 }
422
423 0 return html_offset;
424 }
425  
426 0 size_t myhtml_tokenizer_state_script_data_double_escape_start(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
427 {
428 0 ▶ while(html_offset < html_size)
Branch: 1 branch
BranchTrueFalseTotal
while(html_offset < html_size) 0 0 0
429 {
430 0 ▶ if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>')
Branch: 7 branches
BranchTrueFalseTotal
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
431 {
432 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
433 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
434 0 html_offset++;
435 0 break;
436 }
437
438 0 size_t tmp_size = qnode->begin;
439 0 qnode->begin = qnode->token->begin;
440
441 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
442
443 0 qnode->begin = tmp_size;
444
445 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) { 0 0 0
446 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED;
447 }
448 else {
449 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
450 }
451
452 0 html_offset++;
453 0 break;
454 }
455 0 ▶ else if(myhtml_ascii_char_unless_cmp(html[html_offset]))
Branch: 4 branches
BranchTrueFalseTotal
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
456 {
457 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
458 0 break;
459 }
460
461 0 html_offset++;
462 }
463
464 0 return html_offset;
465 }
466  
467 0 size_t myhtml_tokenizer_state_script_data_double_escaped(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
468 {
469 0 ▶ while(html_offset < html_size)
Branch: 1 branch
BranchTrueFalseTotal
while(html_offset < html_size) 0 0 0
470 {
471 0 ▶ if(html[html_offset] == '-')
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') 0 0 0
472 {
473 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_DASH;
474 0 html_offset++;
475 0 break;
476 }
477 0 ▶ else if(html[html_offset] == '<')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '<') 0 0 0
478 {
479 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
480 0 html_offset++;
481 0 break;
482 }
483
484 0 html_offset++;
485 }
486
487 0 return html_offset;
488 }
489  
490 0 size_t myhtml_tokenizer_state_script_data_double_escaped_dash(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
491 {
492 0 ▶ if(html[html_offset] == '-')
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') 0 0 0
493 {
494 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH;
495 }
496 0 ▶ else if(html[html_offset] == '<')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '<') 0 0 0
497 {
498 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
499 }
500 else {
501 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED;
502 }
503
504 0 html_offset++;
505
506 0 return html_offset;
507 }
508  
509 0 size_t myhtml_tokenizer_state_script_data_double_escaped_dash_dash(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
510 {
511 0 ▶ if(html[html_offset] == '-') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '-') { 0 0 0
512 0 html_offset++;
513 0 return html_offset;
514 }
515
516 0 ▶ if(html[html_offset] == '<')
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '<') 0 0 0
517 {
518 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN;
519 }
520 0 ▶ else if(html[html_offset] == '>')
Branch: 1 branch
BranchTrueFalseTotal
else if(html[html_offset] == '>') 0 0 0
521 {
522 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA;
523 }
524 else {
525 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED;
526 }
527
528 0 html_offset++;
529
530 0 return html_offset;
531 }
532  
533 0 size_t myhtml_tokenizer_state_script_data_double_escaped_less_than_sign(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
534 {
535 0 ▶ if(html[html_offset] == '/') {
Branch: 1 branch
BranchTrueFalseTotal
if(html[html_offset] == '/') { 0 0 0
536 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPE_END;
537 0 html_offset++;
538
539 0 qnode->token->begin = (html_offset + tree->global_offset);
540 }
541 else {
542 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED;
543 }
544
545 0 return html_offset;
546 }
547  
548 0 size_t myhtml_tokenizer_state_script_data_double_escape_end(myhtml_tree_t* tree, mythread_queue_node_t* qnode, const char* html, size_t html_offset, size_t html_size)
549 {
550 0 ▶ while(html_offset < html_size)
Branch: 1 branch
BranchTrueFalseTotal
while(html_offset < html_size) 0 0 0
551 {
552 0 ▶ if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>')
Branch: 7 branches
BranchTrueFalseTotal
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
if(myhtml_whithspace(html[html_offset], ==, ||) || html[html_offset] == '/' || html[html_offset] == '>') 0 0 0
553 {
554 0 ▶ if((html_offset - qnode->token->begin) != 6) {
Branch: 1 branch
BranchTrueFalseTotal
if((html_offset - qnode->token->begin) != 6) { 0 0 0
555 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED;
556 0 html_offset++;
557 0 break;
558 }
559
560 0 size_t tmp_size = qnode->begin;
561 0 qnode->begin = qnode->token->begin;
562
563 0 const char *tem_name = myhtml_tree_incomming_buf_make_data(tree, qnode, 6);
564
565 0 qnode->begin = tmp_size;
566
567 0 ▶ if(myhtml_strncasecmp(tem_name, "script", 6) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if(myhtml_strncasecmp(tem_name, "script", 6) == 0) { 0 0 0
568 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_ESCAPED;
569 }
570 else {
571 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED;
572 }
573
574 0 html_offset++;
575 0 break;
576 }
577 0 ▶ else if(myhtml_ascii_char_unless_cmp(html[html_offset]))
Branch: 4 branches
BranchTrueFalseTotal
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
else if(myhtml_ascii_char_unless_cmp(html[html_offset])) 0 0 0
578 {
579 0 myhtml_tokenizer_state_set(tree) = MyHTML_TOKENIZER_STATE_SCRIPT_DATA_DOUBLE_ESCAPED;
580 0 break;
581 }
582
583 0 html_offset++;
584 }
585
586 0 return html_offset;
587 }
588  
589  
590  
591  
« source/myhtml/tokenizer_end.c ↑ Summary source/myhtml/utils.c »