Add support for #else and #elif preprocessor directives #56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The parser supported
#ifndef,#ifdef,#if, and#endifbut failed on#elseand#elif, causing parse errors on standard C preprocessor patterns:#ifndef FOO namespace Primary { runtimeclass MyClass { } } #else namespace Fallback { runtimeclass MyClass { } } #endifChanges
PEG.js grammar (
server/src/midl.pegjs):elseKWandelifKWkeyword definitions following existing preprocessor directive patternpreprocessorStatementrule to include both directivesTextMate grammar (
syntaxes/midl3.tmGrammar.json):#elifto preprocessor regex pattern (#elsewas already present)Package version (
package.json):Agent configuration (
.github/agents/midl-dev.agent.md):Test coverage:
preprocessor.idlvalidating#ifndef/#else/#endifpreprocessor_elif.idlvalidating#if/#elif/#else/#endifchains<issue_title>ifndef not supported</issue_title>
><issue_description>
idl > #ifndef FOO > // ... > #else > // ... > #endif >>
> doesn't seem to be understood.</issue_description>
>
> ## Comments on the Issue (you are @copilot in this section)
>
>
>
>
> Custom agent used: MIDL Language Server Developer
> Expert in MIDL 3.0 language server development, VSCode extensions, and WinRT API definitions
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.