-
Notifications
You must be signed in to change notification settings - Fork 0
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
Handle preprocessor directives #13
Comments
One idea:
|
On further consideration it may make sense to just extend the lexer itself to be "preprocessor aware" and perform tokenisation as-if preprocessing happens first. One consideration for preprocessing is the position of reported errors. Some inspiration may be taken from the C preprocessor |
Decided to introduce a new class for better functional encapsulation and clear distribution of duties. First step is to handle comments in the preprocessor since that's where they are actually stripped out which results in some slightly different behaviour of tokenisation (added tests to capture this). On the road to #13
My current idea for
|
Still need to handle the actual macro replacement when calling `get` Another step towards #13
Decided to introduce a new class for better functional encapsulation and clear distribution of duties. First step is to handle comments in the preprocessor since that's where they are actually stripped out which results in some slightly different behaviour of tokenisation (added tests to capture this). On the road to #13
Still need to handle the actual macro replacement when calling `get` Another step towards #13
With da91d20 the bulk of directives are now handled in some form. The remaining |
I probably need to introduce a lexical preprocessor to truly handle these since they'd be resolved before the sqf lexer takes over
#include
#define MACRO value
#define MACRO_FUNC(ARG1, ARG2, ...)
#
(stringification)##
(token concatenation)\
(exactly before a newline, multi-line definition)#undef
#if
#ifdef
#ifndef
#else
#endif
The text was updated successfully, but these errors were encountered: