Skip to content
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

Update adept.cpp #96

Closed
wants to merge 1 commit into from
Closed

Update adept.cpp #96

wants to merge 1 commit into from

Conversation

Curculigo
Copy link
Contributor

@Curculigo Curculigo commented Mar 24, 2025

Fix SpartanJ/ecode#412 the stupid way.

@SpartanJ
Copy link
Owner

I think it would be better to just highlight ^%s*#%w+ (any line starting with #word). Each rule added will need to be run on each token which can be slow (won't be something perceptible for the user but it's better to keep it lightweight).

@Curculigo
Copy link
Contributor Author

Curculigo commented Mar 24, 2025

I think it would be better to just highlight ^%s*#%w+ (any line starting with #word). Each rule added will need to be run on each token which can be slow (won't be something perceptible for the user but it's better to keep it lightweight).

I got the list of meta-directives here:

https://github.com/AdeptLanguage/Adept/wiki/Meta-Directives

I don't know where the C/C++ language is defined, too (SpartanJ/ecode#414). But I used ecode --export-lang=c --export-lang-path=./c.json and I found not even the C/C++ language treats everything started with # as a macro like the OP of SpartanJ/ecode#412 suggested. They seem to not understand the language Adept much. But if doing so will help performance I will change according to your suggestion. Please confirm that you want me to change it this way.

@SpartanJ
Copy link
Owner

Yeah, C++ implementation isn't ideal either, I'll fix it later. The best and easiest way to do it is by setting each macro as a symbol with a single rule. I just pushed the implementation here. So this PR isn't needed, thanks anyways!

@SpartanJ SpartanJ closed this Mar 25, 2025
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.

[Adept] Preprocessor is not correctly highlighted
2 participants