I have a custom syntax for a simple preprocessor. Lines that start with ‘#:’ are C++ code that I would like highlighted as C++. I’m currently using a syntax file with:
- match: '^#:'
embed: Packages/C++/C++.sublime-syntax
embed_scope: source.c++.embedded
escape: \n
This works fine. The problem is that lines such as:
#:#define ABC
are not highlighted correctly because the syntax file for C++ uses ‘^\s*#’ to find preprocessor directives. Although my syntax consumes the ‘#:’, so the embedded scope starts in the correct place, the ‘^’ anchor will not match the beginning of the C++ line. Is there a way to set ‘^’ to mark the current position? Or is there a different way to solve this?
Thanks.