Skip to content
This repository has been archived by the owner on Jun 27, 2018. It is now read-only.

The preprocessor does not ignore comments #219

Open
cassiebeckley opened this issue Jan 20, 2013 · 1 comment
Open

The preprocessor does not ignore comments #219

cassiebeckley opened this issue Jan 20, 2013 · 1 comment

Comments

@cassiebeckley
Copy link

The preprocessor evaluates macros inside comments. Example:

.MACRO ilikepie(name)
    name likes pie
.ENDMACRO

; ilikepie(David)

will become

; David likes pie

This causes errors when a macro's name is referred to without parentheses

@hach-que
Copy link
Member

Rules should be added to the preprocessor for the "asm" directory to match on the ; character, which the preprocessor should then consume all characters until the end of a line on. I'm unsure of whether or not this will cause issues and it might not be a complete solution (for cases where the ; follows an instruction), so it might require some additional state checking infrastructure in the preprocessor to handle it.

One possible alternative might be providing a hook for each language that is called every time a character is encountered by the preprocessor (at the moment languages can only define matchers). Thus it could maintain state as to whether or not the current text is a comment and continually consume characters if that's the case until the end of the line (since there's no way a matcher can represent this case).

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

No branches or pull requests

2 participants