Skip to content

Support #ifdef/#elif/#else/#endif - #13

Merged
hanoglu merged 1 commit into
hanoglu:mainfrom
MaxGyver83:feature/support-ifdef
Aug 16, 2023
Merged

hanoglu merged 1 commit into
hanoglu:mainfrom
MaxGyver83:feature/support-ifdef

Conversation

@MaxGyver83

Copy link
Copy Markdown
Contributor

Whenever I paste a block like this into TermiC

#ifdef _WIN32
	#include "windows/os_windows.h"
#else
	#include "linux/os_linux.h"
#endif

the compiler complains about an unterminated #ifdef and TermiC adds only the parts of such blocks.

(In this case I know that I only need the Linux header but it's much easier to copy and paste the whole include block as is.)

This pull requests handles an #ifdef like an open curly bracket. It's also necessary to keep the line breaks of such a block. Functions will be merged into a single line as before. It's also noteworthy that #ifdef blocks are always inserted at the beginning of the file (not in main()).

(This PR uses the fixed spelling of addToBeginning, so it depends on #9 being merged first.)

@MaxGyver83
MaxGyver83 force-pushed the feature/support-ifdef branch from 567b061 to 4299c26 Compare August 12, 2023 19:54
@hanoglu
hanoglu merged commit 2be93e2 into hanoglu:main Aug 16, 2023
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.

2 participants