Skip to content

Commit 5bc0bcc

Browse files
committed
chore: comments
1 parent 97c5046 commit 5bc0bcc

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/ps_visit_type.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ bool ps_visit_type_reference(ps_interpreter *interpreter, ps_interpreter_mode mo
303303
VISIT_END("OK")
304304
}
305305

306+
// TODO? replace with a symbol table?
306307
typedef struct s_ps_enum_values_pool
307308
{
308309
ps_unsigned size;
@@ -388,7 +389,7 @@ bool ps_visit_type_reference_enum(ps_interpreter *interpreter, ps_interpreter_mo
388389
{
389390
VISIT_BEGIN("TYPE_REFERENCE_ENUM", "");
390391

391-
// Up to 256 values in an enumeration, realloc by 16 more if exhausted
392+
// Up to 256 values in an enumeration, re-allocate 16 more if exhausted
392393
ps_enum_values_pool *pool = ps_enum_values_pool_alloc(16, 16);
393394
if (pool == NULL)
394395
RETURN_ERROR(PS_ERROR_OUT_OF_MEMORY)
@@ -397,13 +398,15 @@ bool ps_visit_type_reference_enum(ps_interpreter *interpreter, ps_interpreter_mo
397398
if (lexer->current_token.type != PS_TOKEN_LEFT_PARENTHESIS)
398399
GOTO_CLEANUP(PS_ERROR_UNEXPECTED_TOKEN)
399400
READ_NEXT_TOKEN_OR_CLEANUP
400-
// empty enumeration not allowed
401+
// Empty enumeration not allowed
401402
if (lexer->current_token.type == PS_TOKEN_RIGHT_PARENTHESIS)
402403
GOTO_CLEANUP(PS_ERROR_UNEXPECTED_TOKEN)
403404

405+
// Create enumeration type definition
404406
ps_type_definition *type_def = ps_type_definition_create_enum();
405407
if (type_def == NULL)
406408
GOTO_CLEANUP(PS_ERROR_OUT_OF_MEMORY)
409+
// Register it
407410
if (!ps_type_definition_register(interpreter, mode, type_name, type_def, type_symbol))
408411
GOTO_CLEANUP(interpreter->error)
409412
// Parse enumeration values
@@ -424,7 +427,8 @@ bool ps_visit_type_reference_enum(ps_interpreter *interpreter, ps_interpreter_mo
424427
GOTO_CLEANUP(PS_ERROR_OUT_OF_MEMORY)
425428
if (!ps_interpreter_add_symbol(interpreter, value_symbol))
426429
GOTO_CLEANUP(PS_ERROR_SYMBOL_NOT_ADDED)
427-
READ_NEXT_TOKEN_OR_CLEANUP if (lexer->current_token.type == PS_TOKEN_COMMA)
430+
READ_NEXT_TOKEN_OR_CLEANUP
431+
if (lexer->current_token.type == PS_TOKEN_COMMA)
428432
{
429433
READ_NEXT_TOKEN_OR_CLEANUP
430434
continue;

0 commit comments

Comments
 (0)