diff options
author | pommicket <pommicket@gmail.com> | 2022-01-29 11:13:56 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2022-01-29 11:13:56 -0500 |
commit | 44e11303beca15198a2021024f32e1e8c8cf62ab (patch) | |
tree | f1a4cb41dce5b6ddfd62fcc0c2fee82b2909146d /05 | |
parent | 1fd79e0ad7d55b7f04babb59b23943a5bfd02068 (diff) |
little corrections
Diffstat (limited to '05')
-rw-r--r-- | 05/main.c | 1 | ||||
-rw-r--r-- | 05/parse.b | 12 |
2 files changed, 8 insertions, 5 deletions
@@ -38,6 +38,7 @@ typedef struct { int a = -138; double f = 0; +void *p = 0; int j = 3+7<<5, k = 123; /* @@ -271,9 +271,9 @@ function parse_constant_initializer :found_init_end if *1token == SYMBOL_LBRACE goto parse_braced_initializer - + if *1token == TOKEN_STRING_LITERAL goto parse_string_literal_initializer p = types + type - if *1p > TYPE_DOUBLE goto expression_initializer_for_nonscalar_type + if *1p > TYPE_POINTER goto expression_initializer_for_nonscalar_type global 8000 dat_const_initializer expr = &dat_const_initializer @@ -307,13 +307,15 @@ function parse_constant_initializer return - :init_floating_check + :init_floating_check ; also checks pointer types (e.g. don't do static void *x = 1;) if value != 0 goto floating_initializer_other_than_0 goto init_good :parse_braced_initializer byte 0xcc ; @TODO - + :parse_string_literal_initializer + byte 0xcc ; @TODO + :find_init_end_eof token_error(token, .str_find_init_end_eof) :str_find_init_end_eof @@ -332,7 +334,7 @@ function parse_constant_initializer :floating_initializer_other_than_0 token_error(token, .str_floating_initializer_other_than_0) :str_floating_initializer_other_than_0 - string Only 0 is supported as a floating-point initializer. + string Only 0 is supported as a floating-point/pointer initializer. byte 0 ; *p_token should be pointing to a {, this will advance it to point to the matching } function token_skip_to_matching_rbrace |