Skip to content

Extended syntax support (flags etc.); improved handling of #if 0 (chaining)#94

Draft
dsalt wants to merge 10 commits intojoe-editor:mainfrom
dsalt:syntax-c-if1
Draft

Extended syntax support (flags etc.); improved handling of #if 0 (chaining)#94
dsalt wants to merge 10 commits intojoe-editor:mainfrom
dsalt:syntax-c-if1

Conversation

@dsalt
Copy link
Copy Markdown
Contributor

@dsalt dsalt commented Apr 10, 2026

This adds a set of commands for setting and testing flags and an extra match type intended for use with testing flag bits to the syntax colouring language. The flags word is, by default, saved and restored across subroutine calls.

The C colouring code is modified to make some simple use of this, tracking whether #if 0 or #if 1 have been seen in the current #if chain and making decisions about colouring based on that.

--

The main reason for its existence is that I couldn't see an easy way to handle the marking of definitely-#if'd-out blocks without storing state somewhere. (I think that it's possible without this, but there'd be far too much duplication with all the maintenance headache which that brings.)

I wasn't sure how much I'd need (and I have no idea of how much will end up being used), so what got implemented is what seemed reasonable to provide enough flexibility to cover likely uses.

@dsalt
Copy link
Copy Markdown
Contributor Author

dsalt commented Apr 10, 2026

This currently includes commits queued in #93. Let's see if they disappear automatically…

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.

1 participant