Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REM and ENDREM as comment blocks #83

Open
blazer2k1 opened this issue Oct 2, 2023 · 2 comments
Open

REM and ENDREM as comment blocks #83

blazer2k1 opened this issue Oct 2, 2023 · 2 comments

Comments

@blazer2k1
Copy link

blazer2k1 commented Oct 2, 2023

I thought it would be more consistent to just use REM and ENDREM as comment blocks instead of '[ and '] which looks more like arrays. The syntax already has REM as a single line comment.

If there's no plan to change this, perhaps you could provide some pointers on how to do this update.

Reference:
https://picaxe.com/basic-commands/directives/hash-endrem/

@paladin-t
Copy link
Owner

  1. Change https://github.com/paladin-t/my_basic/blob/67ef347023fccdeae1081fce9c86d0bf176997a1/core/my_basic.c#L773-#L774 to
MBCONST static const char _MULTI_LINE_COMMENT_PREFIX[] = "'REM";
MBCONST static const char _MULTI_LINE_COMMENT_POSTFIX[] = "'ENDREM";

to use 'REM and 'ENDREM.

  1. Change the comparison from
c == _MULTI_LINE_COMMENT_PREFIX[context->multi_line_comment_count++]
...
c == _MULTI_LINE_COMMENT_POSTFIX[context->multi_line_comment_count++]

to

toupper(c) == _MULTI_LINE_COMMENT_PREFIX[context->multi_line_comment_count++]
...
toupper(c) == _MULTI_LINE_COMMENT_POSTFIX[context->multi_line_comment_count++]

for case-insensitive.

  1. Change the symbols in 1. to #REM and #ENDREM, then change https://github.com/paladin-t/my_basic/blob/67ef347023fccdeae1081fce9c86d0bf176997a1/core/my_basic.c#L5053-#L5055 to
static bool_t _is_comment_char(char c) {
	return (c == '\'') || (c == '#');
}

to use #REM and #ENDREM instead. Note that this also enables # for a single-line comment.

@blazer2k1
Copy link
Author

Thanks, but I was aiming for not using symbols before the keyword for this change so without ' or # just plain REM and ENDREM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants