I am using ACE web editor for coding in pascal language and a want to add a rule in the mode-pascal.js native file.
What I want is to highlight all 'read' and 'write' keywords in all lines begining with 'property' and ending with ';'.
Something like :
property Lala : Integer read (123) write (456);
But not :
var read := "write";
And with ACE... I need to do that with only one regexp, fun.
If someone have an idea, it can save a life !
Ace syntax highlighter supports states similar to textmate and sublime.
That means you can match property
keyword, and switch to a state that highlights read
and write
, something like this:
[
...
{
regex: /property\b/
token: "keyword",
next: [
{
regex: /(read|write)\b/
token: "keyword",
},
{ include: "start" }, // include other rules if you want
{
regex: "$|;",
token: "text",
next: "start" // exit the property state on line end or ;
}
]
}
...