Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9c33093

Browse files
committed
Name goto labels consistently
1 parent 634d803 commit 9c33093

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

‎src/generic/stage2/structural_parser.h

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -281,12 +281,12 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
281281
//
282282
switch (parser.current_char()) {
283283
case '{': {
284-
if (parser.empty_object()) { goto finish; }
284+
if (parser.empty_object()) { goto document_end; }
285285
SIMDJSON_TRY( parser.start_object() );
286286
goto object_begin;
287287
}
288288
case '[': {
289-
if (parser.empty_array()) { goto finish; }
289+
if (parser.empty_array()) { goto document_end; }
290290
SIMDJSON_TRY( parser.start_array() );
291291
// Make sure the outer array is closed before continuing; otherwise, there are ways we could get
292292
// into memory corruption. See https://github.com/simdjson/simdjson/issues/906
@@ -297,14 +297,14 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
297297
}
298298
goto array_begin;
299299
}
300-
case '"': SIMDJSON_TRY( parser.parse_string() ); goto finish;
301-
case 't': SIMDJSON_TRY( parser.parse_root_true_atom() ); goto finish;
302-
case 'f': SIMDJSON_TRY( parser.parse_root_false_atom() ); goto finish;
303-
case 'n': SIMDJSON_TRY( parser.parse_root_null_atom() ); goto finish;
300+
case '"': SIMDJSON_TRY( parser.parse_string() ); goto document_end;
301+
case 't': SIMDJSON_TRY( parser.parse_root_true_atom() ); goto document_end;
302+
case 'f': SIMDJSON_TRY( parser.parse_root_false_atom() ); goto document_end;
303+
case 'n': SIMDJSON_TRY( parser.parse_root_null_atom() ); goto document_end;
304304
case '-':
305305
case '0': case '1': case '2': case '3': case '4':
306306
case '5': case '6': case '7': case '8': case '9':
307-
SIMDJSON_TRY( parser.parse_root_number() ); goto finish;
307+
SIMDJSON_TRY( parser.parse_root_number() ); goto document_end;
308308
default:
309309
parser.log_error("Document starts with a non-value character");
310310
return TAPE_ERROR;
@@ -320,9 +320,9 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
320320
}
321321
parser.increment_count();
322322
SIMDJSON_TRY( parser.parse_string(true) );
323-
goto object_key_state;
323+
goto object_field;
324324

325-
object_key_state:
325+
object_field:
326326
if (unlikely( parser.advance_char() != ':' )) { parser.log_error("Missing colon after key in object"); return TAPE_ERROR; }
327327
switch (parser.advance_char()) {
328328
case '{': {
@@ -354,7 +354,7 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
354354
parser.increment_count();
355355
if (unlikely( parser.advance_char() != '"' )) { parser.log_error("Key string missing at beginning of field in object"); return TAPE_ERROR; }
356356
SIMDJSON_TRY( parser.parse_string(true) );
357-
goto object_key_state;
357+
goto object_field;
358358
case '}':
359359
parser.end_object();
360360
goto scope_end;
@@ -364,7 +364,7 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
364364
}
365365

366366
scope_end:
367-
if (parser.depth == 0) { goto finish; }
367+
if (parser.depth == 0) { goto document_end; }
368368
if (parser.parser.is_array[parser.depth]) { goto array_continue; }
369369
goto object_continue;
370370

@@ -374,7 +374,7 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
374374
array_begin:
375375
parser.increment_count();
376376

377-
main_array_switch:
377+
array_value:
378378
switch (parser.advance_char()) {
379379
case '{': {
380380
if (parser.empty_object()) { break; };
@@ -403,7 +403,7 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
403403
switch (parser.advance_char()) {
404404
case ',':
405405
parser.increment_count();
406-
goto main_array_switch;
406+
goto array_value;
407407
case ']':
408408
parser.end_array();
409409
goto scope_end;
@@ -412,9 +412,10 @@ WARN_UNUSED static really_inline error_code parse_structurals(dom_parser_impleme
412412
return TAPE_ERROR;
413413
}
414414

415-
finish:
415+
document_end:
416416
return parser.finish();
417-
}
417+
418+
} // parse_structurals()
418419

419420
} // namespace stage2
420421
} // namespace SIMDJSON_IMPLEMENTATION

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /