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

Don't append invalid characters to symbol name #364

Merged
merged 1 commit into from
Aug 17, 2019
Merged

Don't append invalid characters to symbol name #364

merged 1 commit into from
Aug 17, 2019

Conversation

dbrotz
Copy link
Contributor

@dbrotz dbrotz commented Jun 27, 2019

See #362 for details of the issue.

I fixed the problem by checking for characters in the macro arg that aren't valid symbol name characters and splitting off the rest of the macro arg at the point where the first invalid character is found.

As part of this change, I made it so that the individual token parsing functions are responsible for moving the current lexer buffer position past the current token. This allows for more flexibility and makes the code less hacky.

In particular, ParseFixedPoint() had a hack to allow the lex buffer to only advance to the point where a second dot was found in the string. It had to move the lex buffer position backwards because yylex_NORMAL() would always move the position forwards by nFloatLen, which it couldn't adjust. Now it can simply move the position forwards by the correct amount instead of going backwards and then forwards.

Fixes #362.

When a macro arg appears in a symbol name, the contents are appended.
However, the contents of the macro arg were not being validated.
Any character, regardless of whether it was allowed in a symbol name,
would be appended. With this change, the contents of the macro arg
are now validated character by character. The symbol name is considered
to end at the last valid character. The remainder of the macro arg is
treated as though it followed the symbol name in the asm source code.
@AntonioND AntonioND merged commit 88b66f2 into gbdev:master Aug 17, 2019
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.

Labels can be defined with colons in their name
2 participants