Bill Currie
3bd391d01f
[qfcc] Handle h-string and q-string only in #include
...
And #embed, though that's not implemented yet. Comparisons eating
multiple lines results in some rather interesting errors.
2023-10-27 17:24:54 +09:00
Bill Currie
ffb2514e75
[qfcc] Implement #include and search paths
...
Other than some trouble with line comments and continuation lines, it
seems to work nicely.
2023-10-25 21:07:50 +09:00
Bill Currie
f1f0a4a260
[qfcc] Update line directive handling
...
In addition to cleaning up the old flex line rules, this improves
handling of the '# num "file" flags' from cpp to at least parse the
additional flags (support for the system header flag might come later,
but I doubt the extern-c flag will have much meaning).
QuakePascal has lost its line directive handling (no errors, but dead
rules) for now. Eventually the lexers will be merged.
2023-10-25 12:22:33 +09:00
Bill Currie
717be4a12d
[qfcc] Update pragma handling for the preprocessor
...
This removes the now redundant flex rules, though does spread
preprocess-only checks around a little more.
2023-10-25 09:25:00 +09:00
Bill Currie
dc598c58b5
[qfcc] Record and expand macro arguments
...
Stringizing doesn't work correctly (stringizes only the first token, not
the whole argument), but things seems to work otherwise.
2023-10-24 23:32:13 +09:00
Bill Currie
e60f538664
[qfcc] Implement function-type macro argument parsing
...
The arguments are not recorded yet, but argument parsing can consume the
whole file if the closing ) is missing (same as gcc).
2023-10-24 22:06:01 +09:00
Bill Currie
3307ef77ec
[qfcc] Implement object-type macro expansion
...
Really, function-type macros expand too, but incorrectly as the
parameters are not parsed and thus not expanded, but this gets the basic
handling implemented, including # and ## processing.
2023-10-24 15:58:37 +09:00
Bill Currie
45e61544bb
[qfcc] Improve handling of spaces in macro definitions
...
Avoids space tokens on either side of ## and after #
2023-10-24 14:17:05 +09:00
Bill Currie
8341f48f9d
[qfcc] Implement #undef
...
That was pleasantly easy :)
2023-10-23 19:00:37 +09:00
Bill Currie
5cab587207
[qfcc] Implement macro recording and defined()
...
So far, very consistent with gcc's cpp from my limited testing, though
some error handling may be a little different.
2023-10-23 19:00:30 +09:00
Bill Currie
5794c68bda
[qfcc] Implement basic conditional compilation
...
Just #if, #else and #endif for now. However, much of the preprocessor
parsing working minus the semantics (expressions do work, though).
2023-10-23 00:10:25 +09:00