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

Properly Lex String Literals #38

Closed

Conversation

TheCrystalKeeper
Copy link
Collaborator

Not fully functional yet but placing for review to see if anyone has any issues with how the strings/chars are read in. I want to make sure I didn't misinterpret anything. Also, note backslashes are not implemented yet.

@TheCrystalKeeper TheCrystalKeeper self-assigned this Jun 25, 2024
@TheCrystalKeeper TheCrystalKeeper linked an issue Jun 25, 2024 that may be closed by this pull request
@TheCrystalKeeper TheCrystalKeeper marked this pull request as draft June 25, 2024 22:21
@@ -218,6 +224,46 @@ int real_lex(Lexer *l, Token *t) {
}

// TODO - parse character or string literal
int c;
int *type;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might be clearer if we used named constants here instead of integer literals for the values of type. Also, is there a reason for the usage of an int*?

@@ -83,6 +83,12 @@ int is_valid_numeric_or_id_char(char c) {
return isalnum(c) || (c == '_') || (c == '.');
}

int is_valid_string_char(char c, int* type) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is type used for here? It doesn't seem to be used in the logic of the function and isn't accessible outside of it.

@adamhutchings
Copy link
Contributor

Closing due to inactivity.

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

Successfully merging this pull request may close these issues.

Properly lex character and string literals
2 participants