@@ -106,7 +106,7 @@ skip_spaces (parser_context_t *context_p) /**< context */
106
106
107
107
context_p -> token .was_newline = 0 ;
108
108
109
- while (PARSER_TRUE )
109
+ while (true )
110
110
{
111
111
if (context_p -> source_p >= source_end_p )
112
112
{
@@ -419,7 +419,7 @@ static const keyword_string_t * const keyword_string_list[9] =
419
419
*/
420
420
static void
421
421
lexer_parse_identifier (parser_context_t * context_p , /**< context */
422
- int check_keywords ) /**< check keywords */
422
+ bool check_keywords ) /**< check keywords */
423
423
{
424
424
/* Only very few identifiers contains \u escape sequences. */
425
425
const uint8_t * source_p = context_p -> source_p ;
@@ -430,17 +430,17 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
430
430
size_t length = 0 ;
431
431
432
432
context_p -> token .type = LEXER_LITERAL ;
433
- context_p -> token .literal_is_reserved = PARSER_FALSE ;
433
+ context_p -> token .literal_is_reserved = false ;
434
434
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 ;
436
436
437
437
do
438
438
{
439
439
if (* source_p == LIT_CHAR_BACKSLASH )
440
440
{
441
441
uint16_t character ;
442
442
443
- context_p -> token .lit_location .has_escape = PARSER_TRUE ;
443
+ context_p -> token .lit_location .has_escape = true ;
444
444
context_p -> source_p = source_p ;
445
445
context_p -> token .column = column ;
446
446
@@ -520,7 +520,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
520
520
parser_raise_error (context_p , PARSER_ERR_STRICT_IDENT_NOT_ALLOWED );
521
521
}
522
522
523
- context_p -> token .literal_is_reserved = PARSER_TRUE ;
523
+ context_p -> token .literal_is_reserved = true ;
524
524
break ;
525
525
}
526
526
@@ -558,9 +558,9 @@ lexer_parse_string (parser_context_t *context_p) /**< context */
558
558
parser_line_counter_t original_line = line ;
559
559
parser_line_counter_t original_column = column ;
560
560
size_t length = 0 ;
561
- uint8_t has_escape = PARSER_FALSE ;
561
+ uint8_t has_escape = false ;
562
562
563
- while (PARSER_TRUE )
563
+ while (true )
564
564
{
565
565
if (source_p >= source_end_p )
566
566
{
@@ -584,7 +584,7 @@ lexer_parse_string (parser_context_t *context_p) /**< context */
584
584
continue ;
585
585
}
586
586
587
- has_escape = PARSER_TRUE ;
587
+ has_escape = true ;
588
588
589
589
/* Newline is ignored. */
590
590
if (* source_p == LIT_CHAR_CR
@@ -697,7 +697,7 @@ lexer_parse_string (parser_context_t *context_p) /**< context */
697
697
* after a backslash). Always converted to two 3 byte
698
698
* long sequence. */
699
699
length += 2 * 3 ;
700
- has_escape = PARSER_TRUE ;
700
+ has_escape = true ;
701
701
source_p += 4 ;
702
702
column ++ ;
703
703
continue ;
@@ -755,15 +755,15 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
755
755
{
756
756
const uint8_t * source_p = context_p -> source_p ;
757
757
const uint8_t * source_end_p = context_p -> source_end_p ;
758
- int can_be_float = PARSER_FALSE ;
758
+ bool can_be_float = false ;
759
759
size_t length ;
760
760
761
761
context_p -> token .type = LEXER_LITERAL ;
762
- context_p -> token .literal_is_reserved = PARSER_FALSE ;
762
+ context_p -> token .literal_is_reserved = false ;
763
763
context_p -> token .extra_value = LEXER_NUMBER_DECIMAL ;
764
764
context_p -> token .lit_location .char_p = source_p ;
765
765
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 ;
767
767
768
768
if (source_p [0 ] == LIT_CHAR_0
769
769
&& source_p + 1 < source_end_p )
@@ -818,7 +818,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
818
818
}
819
819
else
820
820
{
821
- can_be_float = PARSER_TRUE ;
821
+ can_be_float = true ;
822
822
source_p ++ ;
823
823
}
824
824
}
@@ -832,7 +832,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
832
832
&& source_p [0 ] >= LIT_CHAR_0
833
833
&& source_p [0 ] <= LIT_CHAR_9 );
834
834
835
- can_be_float = PARSER_TRUE ;
835
+ can_be_float = true ;
836
836
}
837
837
838
838
if (can_be_float )
@@ -987,7 +987,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
987
987
if (lit_char_is_identifier_start (context_p -> source_p )
988
988
|| context_p -> source_p [0 ] == LIT_CHAR_BACKSLASH )
989
989
{
990
- lexer_parse_identifier (context_p , PARSER_TRUE );
990
+ lexer_parse_identifier (context_p , true );
991
991
return ;
992
992
}
993
993
@@ -1160,7 +1160,7 @@ lexer_process_char_literal (parser_context_t *context_p, /**< context */
1160
1160
const uint8_t * char_p , /**< characters */
1161
1161
size_t length , /**< length of string */
1162
1162
uint8_t literal_type , /**< final literal type */
1163
- uint8_t has_escape ) /**< has escape sequences */
1163
+ bool has_escape ) /**< has escape sequences */
1164
1164
{
1165
1165
parser_list_iterator_t literal_iterator ;
1166
1166
lexer_literal_t * literal_p ;
@@ -1282,7 +1282,7 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
1282
1282
{
1283
1283
uint8_t str_end_character = source_p [-1 ];
1284
1284
1285
- while (PARSER_TRUE )
1285
+ while (true )
1286
1286
{
1287
1287
if (* source_p == str_end_character )
1288
1288
{
@@ -1514,12 +1514,12 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
1514
1514
/**
1515
1515
* Construct a number object.
1516
1516
*
1517
- * @return PARSER_TRUE if number is small number
1517
+ * @return true if number is small number
1518
1518
*/
1519
- int
1519
+ bool
1520
1520
lexer_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 */
1523
1523
{
1524
1524
parser_list_iterator_t literal_iterator ;
1525
1525
lexer_literal_t * literal_p ;
@@ -1556,7 +1556,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
1556
1556
&& (int_num != 0 || !is_negative_number ))
1557
1557
{
1558
1558
context_p -> lit_object .index = (uint16_t ) int_num ;
1559
- return PARSER_TRUE ;
1559
+ return true ;
1560
1560
}
1561
1561
}
1562
1562
}
@@ -1576,7 +1576,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
1576
1576
{
1577
1577
context_p -> lit_object .literal_p = literal_p ;
1578
1578
context_p -> lit_object .index = (uint16_t ) literal_index ;
1579
- return PARSER_FALSE ;
1579
+ return false ;
1580
1580
}
1581
1581
1582
1582
literal_index ++ ;
@@ -1603,7 +1603,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
1603
1603
context_p -> lit_object .index = (uint16_t ) literal_index ;
1604
1604
context_p -> lit_object .type = LEXER_LITERAL_OBJECT_ANY ;
1605
1605
1606
- return PARSER_FALSE ;
1606
+ return false ;
1607
1607
} /* lexer_construct_number_object */
1608
1608
1609
1609
/**
@@ -1647,7 +1647,7 @@ lexer_construct_function_object (parser_context_t *context_p, /**< context */
1647
1647
*/
1648
1648
void
1649
1649
lexer_construct_regexp_object (parser_context_t * context_p , /**< context */
1650
- int parse_only ) /**< parse only */
1650
+ bool parse_only ) /**< parse only */
1651
1651
{
1652
1652
#ifndef CONFIG_DISABLE_REGEXP_BUILTIN
1653
1653
const uint8_t * source_p = context_p -> source_p ;
@@ -1656,7 +1656,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
1656
1656
const uint8_t * source_end_p = context_p -> source_end_p ;
1657
1657
parser_line_counter_t column = context_p -> column ;
1658
1658
lexer_literal_t * literal_p ;
1659
- int in_class = PARSER_FALSE ;
1659
+ bool in_class = false ;
1660
1660
uint16_t current_flags ;
1661
1661
lit_utf8_size_t length ;
1662
1662
@@ -1668,7 +1668,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
1668
1668
regex_start_p -- ;
1669
1669
}
1670
1670
1671
- while (PARSER_TRUE )
1671
+ while (true )
1672
1672
{
1673
1673
if (source_p >= source_end_p )
1674
1674
{
@@ -1705,12 +1705,12 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
1705
1705
}
1706
1706
case LIT_CHAR_LEFT_SQUARE :
1707
1707
{
1708
- in_class = PARSER_TRUE ;
1708
+ in_class = true ;
1709
1709
break ;
1710
1710
}
1711
1711
case LIT_CHAR_RIGHT_SQUARE :
1712
1712
{
1713
- in_class = PARSER_FALSE ;
1713
+ in_class = false ;
1714
1714
break ;
1715
1715
}
1716
1716
case LIT_CHAR_BACKSLASH :
@@ -1829,7 +1829,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
1829
1829
literal_p -> u .bytecode_p = (ecma_compiled_code_t * ) re_bytecode_p ;
1830
1830
1831
1831
context_p -> token .type = LEXER_LITERAL ;
1832
- context_p -> token .literal_is_reserved = PARSER_FALSE ;
1832
+ context_p -> token .literal_is_reserved = false ;
1833
1833
context_p -> token .lit_location .type = LEXER_REGEXP_LITERAL ;
1834
1834
1835
1835
context_p -> lit_object .literal_p = literal_p ;
@@ -1895,20 +1895,20 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
1895
1895
1896
1896
static const lexer_lit_location_t lexer_get_literal =
1897
1897
{
1898
- (const uint8_t * ) "get" , 3 , LEXER_IDENT_LITERAL , PARSER_FALSE
1898
+ (const uint8_t * ) "get" , 3 , LEXER_IDENT_LITERAL , false
1899
1899
};
1900
1900
1901
1901
static const lexer_lit_location_t lexer_set_literal =
1902
1902
{
1903
- (const uint8_t * ) "set" , 3 , LEXER_IDENT_LITERAL , PARSER_FALSE
1903
+ (const uint8_t * ) "set" , 3 , LEXER_IDENT_LITERAL , false
1904
1904
};
1905
1905
1906
1906
/**
1907
1907
* Next token must be an identifier.
1908
1908
*/
1909
1909
void
1910
1910
lexer_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 */
1912
1912
{
1913
1913
skip_spaces (context_p );
1914
1914
@@ -1917,11 +1917,11 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
1917
1917
1918
1918
if (context_p -> source_p < context_p -> source_end_p )
1919
1919
{
1920
- int create_literal_object = PARSER_FALSE ;
1920
+ bool create_literal_object = false ;
1921
1921
1922
1922
if (lit_char_is_identifier_start (context_p -> source_p ) || context_p -> source_p [0 ] == LIT_CHAR_BACKSLASH )
1923
1923
{
1924
- lexer_parse_identifier (context_p , PARSER_FALSE );
1924
+ lexer_parse_identifier (context_p , false );
1925
1925
1926
1926
if (!must_be_identifier
1927
1927
&& context_p -> token .lit_location .length == 3 )
@@ -1944,13 +1944,13 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
1944
1944
}
1945
1945
}
1946
1946
1947
- create_literal_object = PARSER_TRUE ;
1947
+ create_literal_object = true ;
1948
1948
}
1949
1949
else if (context_p -> source_p [0 ] == LIT_CHAR_DOUBLE_QUOTE
1950
1950
|| context_p -> source_p [0 ] == LIT_CHAR_SINGLE_QUOTE )
1951
1951
{
1952
1952
lexer_parse_string (context_p );
1953
- create_literal_object = PARSER_TRUE ;
1953
+ create_literal_object = true ;
1954
1954
}
1955
1955
else if (!must_be_identifier && context_p -> source_p [0 ] == LIT_CHAR_RIGHT_BRACE )
1956
1956
{
@@ -1973,7 +1973,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
1973
1973
&& char_p [0 ] <= LIT_CHAR_9 )
1974
1974
{
1975
1975
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 );
1977
1977
return ;
1978
1978
}
1979
1979
}
@@ -1995,7 +1995,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
1995
1995
*/
1996
1996
void
1997
1997
lexer_scan_identifier (parser_context_t * context_p , /**< context */
1998
- int propety_name ) /**< property name */
1998
+ bool propety_name ) /**< property name */
1999
1999
{
2000
2000
skip_spaces (context_p );
2001
2001
context_p -> token .line = context_p -> line ;
@@ -2004,7 +2004,7 @@ lexer_scan_identifier (parser_context_t *context_p, /**< context */
2004
2004
if (context_p -> source_p < context_p -> source_end_p
2005
2005
&& (lit_char_is_identifier_start (context_p -> source_p ) || context_p -> source_p [0 ] == LIT_CHAR_BACKSLASH ))
2006
2006
{
2007
- lexer_parse_identifier (context_p , PARSER_FALSE );
2007
+ lexer_parse_identifier (context_p , false );
2008
2008
2009
2009
if (propety_name && context_p -> token .lit_location .length == 3 )
2010
2010
{
@@ -2044,9 +2044,9 @@ lexer_scan_identifier (parser_context_t *context_p, /**< context */
2044
2044
* Compares the given identifier to that which is the current token
2045
2045
* in the parser context.
2046
2046
*
2047
- * @return non-zero if the input identifiers are the same
2047
+ * @return true if the input identifiers are the same
2048
2048
*/
2049
- int
2049
+ bool
2050
2050
lexer_compare_identifier_to_current (parser_context_t * context_p , /**< context */
2051
2051
const lexer_lit_location_t * right ) /**< identifier */
2052
2052
{
@@ -2081,7 +2081,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
2081
2081
{
2082
2082
if (* left_p ++ != * right_p ++ )
2083
2083
{
2084
- return PARSER_FALSE ;
2084
+ return false ;
2085
2085
}
2086
2086
count -- ;
2087
2087
continue ;
@@ -2093,7 +2093,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
2093
2093
2094
2094
if (left_chr != lexer_hex_to_character (context_p , right_p , 6 ))
2095
2095
{
2096
- return PARSER_FALSE ;
2096
+ return false ;
2097
2097
}
2098
2098
2099
2099
left_p += 6 ;
@@ -2120,7 +2120,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
2120
2120
{
2121
2121
if (utf8_buf [offset ] != * right_p ++ )
2122
2122
{
2123
- return PARSER_FALSE ;
2123
+ return false ;
2124
2124
}
2125
2125
offset ++ ;
2126
2126
}
@@ -2130,7 +2130,7 @@ lexer_compare_identifier_to_current (parser_context_t *context_p, /**< co
2130
2130
}
2131
2131
while (count > 0 );
2132
2132
2133
- return PARSER_TRUE ;
2133
+ return true ;
2134
2134
} /* lexer_compare_identifier_to_current */
2135
2135
2136
2136
/**
0 commit comments