Home Download Buy Blog Forum Support

Syntax highlight, incrementally addition of matching rules

Syntax highlight, incrementally addition of matching rules

Postby tcn on Wed Jul 16, 2014 2:36 pm


I initially posted this in the technical support forum but I think this would be a better place for it.... Sorry for the duplicity.

I'm writing my own package hoping to release it to the public once I'm satisfied with it. Right now, I am struggling to do something ... weird. As most of us are fluent in C, I will explain this as if I was writing a C syntax highlight plugin.

I would like to be able to let's say write:
Code: Select all
#include <stdio.h>
#include <math.h>

Now, I could write:
Code: Select all
printf("Testing: %f\n", log10(3));

Now, I would like to have functions (printf and log10) highlighted when both includes are specified but not when their related include isn't there or commented out.

I have played quite a lot with recurrence, with rules inclusion and $self/$base but can't get the proper behavior. The problem being that once inside an included rule, matches outside this rule are forgotten.

This means that if I have a super rule which defines two sub-rules, one for stdio and the other for math, once inside the sub-rules I can't get matches from the other one. I will always end up getting either one or the other sub-rule.

Hence the title of this post: being able to add rules when a match occurs.

Posts: 2
Joined: Sat Jun 14, 2014 7:40 pm

Return to Plugin Development

Who is online

Users browsing this forum: No registered users and 5 guests