@@ -106,7 +106,7 @@ skip_spaces (parser_context_t *context_p) /**< context */
106106
107107 context_p -> token .was_newline = 0 ;
108108
109- while (PARSER_TRUE )
109+ while (true )
110110 {
111111 if (context_p -> source_p >= source_end_p )
112112 {
@@ -419,7 +419,7 @@ static const keyword_string_t * const keyword_string_list[9] =
419419 */
420420static void
421421lexer_parse_identifier (parser_context_t * context_p , /**< context */
422- int check_keywords ) /**< check keywords */
422+ bool check_keywords ) /**< check keywords */
423423{
424424 /* Only very few identifiers contains \u escape sequences. */
425425 const uint8_t * source_p = context_p -> source_p ;
@@ -430,17 +430,17 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
430430 size_t length = 0 ;
431431
432432 context_p -> token .type = LEXER_LITERAL ;
433- context_p -> token .literal_is_reserved = PARSER_FALSE ;
433+ context_p -> token .literal_is_reserved = false ;
434434 context_p -> token .lit_location .type = LEXER_IDENT_LITERAL ;
435- context_p -> token .lit_location .has_escape = PARSER_FALSE ;
435+ context_p -> token .lit_location .has_escape = false ;
436436
437437 do
438438 {
439439 if (* source_p == LIT_CHAR_BACKSLASH )
440440 {
441441 uint16_t character ;
442442
443- context_p -> token .lit_location .has_escape = PARSER_TRUE ;
443+ context_p -> token .lit_location .has_escape = true ;
444444 context_p -> source_p = source_p ;
445445 context_p -> token .column = column ;
446446
@@ -520,7 +520,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
520520 parser_raise_error (context_p , PARSER_ERR_STRICT_IDENT_NOT_ALLOWED );
521521 }
522522
523- context_p -> token .literal_is_reserved = PARSER_TRUE ;
523+ context_p -> token .literal_is_reserved = true ;
524524 break ;
525525 }
526526
@@ -558,9 +558,9 @@ lexer_parse_string (parser_context_t *context_p) /**< context */
558558 parser_line_counter_t original_line = line ;
559559 parser_line_counter_t original_column = column ;
560560 size_t length = 0 ;
561- uint8_t has_escape = PARSER_FALSE ;
561+ uint8_t has_escape = false ;
562562
563- while (PARSER_TRUE )
563+ while (true )
564564 {
565565 if (source_p >= source_end_p )
566566 {
@@ -584,7 +584,7 @@ lexer_parse_string (parser_context_t *context_p) /**< context */
584584 continue ;
585585 }
586586
587- has_escape = PARSER_TRUE ;
587+ has_escape = true ;
588588
589589 /* Newline is ignored. */
590590 if (* source_p == LIT_CHAR_CR
@@ -697,7 +697,7 @@ lexer_parse_string (parser_context_t *context_p) /**< context */
697697 * after a backslash). Always converted to two 3 byte
698698 * long sequence. */
699699 length += 2 * 3 ;
700- has_escape = PARSER_TRUE ;
700+ has_escape = true ;
701701 source_p += 4 ;
702702 column ++ ;
703703 continue ;
@@ -755,15 +755,15 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
755755{
756756 const uint8_t * source_p = context_p -> source_p ;
757757 const uint8_t * source_end_p = context_p -> source_end_p ;
758- int can_be_float = PARSER_FALSE ;
758+ bool can_be_float = false ;
759759 size_t length ;
760760
761761 context_p -> token .type = LEXER_LITERAL ;
762- context_p -> token .literal_is_reserved = PARSER_FALSE ;
762+ context_p -> token .literal_is_reserved = false ;
763763 context_p -> token .extra_value = LEXER_NUMBER_DECIMAL ;
764764 context_p -> token .lit_location .char_p = source_p ;
765765 context_p -> token .lit_location .type = LEXER_NUMBER_LITERAL ;
766- context_p -> token .lit_location .has_escape = PARSER_FALSE ;
766+ context_p -> token .lit_location .has_escape = false ;
767767
768768 if (source_p [0 ] == LIT_CHAR_0
769769 && source_p + 1 < source_end_p )
@@ -818,7 +818,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
818818 }
819819 else
820820 {
821- can_be_float = PARSER_TRUE ;
821+ can_be_float = true ;
822822 source_p ++ ;
823823 }
824824 }
@@ -832,7 +832,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
832832 && source_p [0 ] >= LIT_CHAR_0
833833 && source_p [0 ] <= LIT_CHAR_9 );
834834
835- can_be_float = PARSER_TRUE ;
835+ can_be_float = true ;
836836 }
837837
838838 if (can_be_float )
@@ -987,7 +987,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
987987 if (lit_char_is_identifier_start (context_p -> source_p )
988988 || context_p -> source_p [0 ] == LIT_CHAR_BACKSLASH )
989989 {
990- lexer_parse_identifier (context_p , PARSER_TRUE );
990+ lexer_parse_identifier (context_p , true );
991991 return ;
992992 }
993993
@@ -1160,7 +1160,7 @@ lexer_process_char_literal (parser_context_t *context_p, /**< context */
11601160 const uint8_t * char_p , /**< characters */
11611161 size_t length , /**< length of string */
11621162 uint8_t literal_type , /**< final literal type */
1163- uint8_t has_escape ) /**< has escape sequences */
1163+ bool has_escape ) /**< has escape sequences */
11641164{
11651165 parser_list_iterator_t literal_iterator ;
11661166 lexer_literal_t * literal_p ;
@@ -1282,7 +1282,7 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
12821282 {
12831283 uint8_t str_end_character = source_p [-1 ];
12841284
1285- while (PARSER_TRUE )
1285+ while (true )
12861286 {
12871287 if (* source_p == str_end_character )
12881288 {
@@ -1514,12 +1514,12 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
15141514/**
15151515 * Construct a number object.
15161516 *
1517- * @return PARSER_TRUE if number is small number
1517+ * @return true if number is small number
15181518 */
1519- int
1519+ bool
15201520lexer_construct_number_object (parser_context_t * context_p , /**< context */
1521- int push_number_allowed , /**< push number support is allowed */
1522- int is_negative_number ) /**< sign is negative */
1521+ bool push_number_allowed , /**< push number support is allowed */
1522+ bool is_negative_number ) /**< sign is negative */
15231523{
15241524 parser_list_iterator_t literal_iterator ;
15251525 lexer_literal_t * literal_p ;
@@ -1556,7 +1556,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
15561556 && (int_num != 0 || !is_negative_number ))
15571557 {
15581558 context_p -> lit_object .index = (uint16_t ) int_num ;
1559- return PARSER_TRUE ;
1559+ return true ;
15601560 }
15611561 }
15621562 }
@@ -1576,7 +1576,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
15761576 {
15771577 context_p -> lit_object .literal_p = literal_p ;
15781578 context_p -> lit_object .index = (uint16_t ) literal_index ;
1579- return PARSER_FALSE ;
1579+ return false ;
15801580 }
15811581
15821582 literal_index ++ ;
@@ -1603,7 +1603,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
16031603 context_p -> lit_object .index = (uint16_t ) literal_index ;
16041604 context_p -> lit_object .type = LEXER_LITERAL_OBJECT_ANY ;
16051605
1606- return PARSER_FALSE ;
1606+ return false ;
16071607} /* lexer_construct_number_object */
16081608
16091609/**
@@ -1647,7 +1647,7 @@ lexer_construct_function_object (parser_context_t *context_p, /**< context */
16471647 */
16481648void
16491649lexer_construct_regexp_object (parser_context_t * context_p , /**< context */
1650- int parse_only ) /**< parse only */
1650+ bool parse_only ) /**< parse only */
16511651{
16521652#ifndef CONFIG_DISABLE_REGEXP_BUILTIN
16531653 const uint8_t * source_p = context_p -> source_p ;
@@ -1656,7 +1656,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
16561656 const uint8_t * source_end_p = context_p -> source_end_p ;
16571657 parser_line_counter_t column = context_p -> column ;
16581658 lexer_literal_t * literal_p ;
1659- int in_class = PARSER_FALSE ;
1659+ bool in_class = false ;
16601660 uint16_t current_flags ;
16611661 lit_utf8_size_t length ;
16621662
@@ -1668,7 +1668,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
16681668 regex_start_p -- ;
16691669 }
16701670
1671- while (PARSER_TRUE )
1671+ while (true )
16721672 {
16731673 if (source_p >= source_end_p )
16741674 {
@@ -1705,12 +1705,12 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
17051705 }
17061706 case LIT_CHAR_LEFT_SQUARE :
17071707 {
1708- in_class = PARSER_TRUE ;
1708+ in_class = true ;
17091709 break ;
17101710 }
17111711 case LIT_CHAR_RIGHT_SQUARE :
17121712 {
1713- in_class = PARSER_FALSE ;
1713+ in_class = false ;
17141714 break ;
17151715 }
17161716 case LIT_CHAR_BACKSLASH :
@@ -1829,7 +1829,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
18291829 literal_p -> u .bytecode_p = (ecma_compiled_code_t * ) re_bytecode_p ;
18301830
18311831 context_p -> token .type = LEXER_LITERAL ;
1832- context_p -> token .literal_is_reserved = PARSER_FALSE ;
1832+ context_p -> token .literal_is_reserved = false ;
18331833 context_p -> token .lit_location .type = LEXER_REGEXP_LITERAL ;
18341834
18351835 context_p -> lit_object .literal_p = literal_p ;
@@ -1895,20 +1895,20 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
18951895
18961896static const lexer_lit_location_t lexer_get_literal =
18971897{
1898- (const uint8_t * ) "get" , 3 , LEXER_IDENT_LITERAL , PARSER_FALSE
1898+ (const uint8_t * ) "get" , 3 , LEXER_IDENT_LITERAL , false
18991899};
19001900
19011901static const lexer_lit_location_t lexer_set_literal =
19021902{
1903- (const uint8_t * ) "set" , 3 , LEXER_IDENT_LITERAL , PARSER_FALSE
1903+ (const uint8_t * ) "set" , 3 , LEXER_IDENT_LITERAL , false
19041904};
19051905
19061906/**
19071907 * Next token must be an identifier.
19081908 */
19091909void
19101910lexer_expect_object_literal_id (parser_context_t * context_p , /**< context */
1911- int must_be_identifier ) /**< only identifiers are accepted */
1911+ bool must_be_identifier ) /**< only identifiers are accepted */
19121912{
19131913 skip_spaces (context_p );
19141914
@@ -1917,11 +1917,11 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
19171917
19181918 if (context_p -> source_p < context_p -> source_end_p )
19191919 {
1920- int create_literal_object = PARSER_FALSE ;
1920+ bool create_literal_object = false ;
19211921
19221922 if (lit_char_is_identifier_start (context_p -> source_p ) || context_p -> source_p [0 ] == LIT_CHAR_BACKSLASH )
19231923 {
1924- lexer_parse_identifier (context_p , PARSER_FALSE );
1924+ lexer_parse_identifier (context_p , false );
19251925
19261926 if (!must_be_identifier
19271927 && context_p -> token .lit_location .length == 3 )
@@ -1944,13 +1944,13 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
19441944 }
19451945 }
19461946
1947- create_literal_object = PARSER_TRUE ;
1947+ create_literal_object = true ;
19481948 }
19491949 else if (context_p -> source_p [0 ] == LIT_CHAR_DOUBLE_QUOTE
19501950 || context_p -> source_p [0 ] == LIT_CHAR_SINGLE_QUOTE )
19511951 {
19521952 lexer_parse_string (context_p );
1953- create_literal_object = PARSER_TRUE ;
1953+ create_literal_object = true ;
19541954 }
19551955 else if (!must_be_identifier && context_p -> source_p [0 ] == LIT_CHAR_RIGHT_BRACE )
19561956 {
@@ -1973,7 +1973,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
19731973 && char_p [0 ] <= LIT_CHAR_9 )
19741974 {
19751975 lexer_parse_number (context_p );
1976- lexer_construct_number_object (context_p , PARSER_FALSE , PARSER_FALSE );
1976+ lexer_construct_number_object (context_p , false, false );
19771977 return ;
19781978 }
19791979 }
@@ -1995,7 +1995,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
19951995 */
19961996void
19971997lexer_scan_identifier (parser_context_t * context_p , /**< context */
1998- int propety_name ) /**< property name */
1998+ bool propety_name ) /**< property name */
19991999{
20002000 skip_spaces (context_p );
20012001 context_p -> token .line = context_p -> line ;
@@ -2004,7 +2004,7 @@ lexer_scan_identifier (parser_context_t *context_p, /**< context */
20042004 if (context_p -> source_p < context_p -> source_end_p
20052005 && (lit_char_is_identifier_start (context_p -> source_p ) || context_p -> source_p [0 ] == LIT_CHAR_BACKSLASH ))
20062006 {
2007- lexer_parse_identifier (context_p , PARSER_FALSE );
2007+ lexer_parse_identifier (context_p , false );
20082008
20092009 if (propety_name && context_p -> token .lit_location .length == 3 )
20102010 {
@@ -2044,9 +2044,9 @@ lexer_scan_identifier (parser_context_t *context_p, /**< context */
20442044 * Compares the given identifier to that which is the current token
20452045 * in the parser context.
20462046 *
2047- * @return non-zero if the input identifiers are the same
2047+ * @return true if the input identifiers are the same
20482048 */
2049- int
2049+ bool
20502050lexer_compare_identifier_to_current (parser_context_t * context_p , /**< context */
20512051 const lexer_lit_location_t * right ) /**< identifier */
20522052{
@@ -2081,7 +2081,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
20812081 {
20822082 if (* left_p ++ != * right_p ++ )
20832083 {
2084- return PARSER_FALSE ;
2084+ return false ;
20852085 }
20862086 count -- ;
20872087 continue ;
@@ -2093,7 +2093,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
20932093
20942094 if (left_chr != lexer_hex_to_character (context_p , right_p , 6 ))
20952095 {
2096- return PARSER_FALSE ;
2096+ return false ;
20972097 }
20982098
20992099 left_p += 6 ;
@@ -2120,7 +2120,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
21202120 {
21212121 if (utf8_buf [offset ] != * right_p ++ )
21222122 {
2123- return PARSER_FALSE ;
2123+ return false ;
21242124 }
21252125 offset ++ ;
21262126 }
@@ -2130,7 +2130,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
21302130 }
21312131 while (count > 0 );
21322132
2133- return PARSER_TRUE ;
2133+ return true ;
21342134} /* lexer_compare_identifier_to_current */
21352135
21362136/**
0 commit comments