Posted 19 years ago by Tim Davis
Avatar
I'm thinking that scope is what I need to use but I'm not sure.

The language file I'm writing has to be able to colorize a script. There are sections to this script, I want to be able to colorize all the sections but one a certain way and the last section to be a completely different way.

For Example:

{Setup}

Value=blah
Value1=blah

{Code}

function test():
var
  value: String;
begin
  //DO SOMETHING
end;
With the way I have it set up now, it will highlight both the 'value' in SETUP and the 'value' in CODE. I need to only highlight the value in SETUP. The CODE section of the script will be using different rules.

Is this possible? Point me in the right direction and I should be able to figure it out <IMG SRC="smile.gif" border="0">

Comments (4)

Posted 19 years ago by Tim Davis
Avatar
I think I found it, sorry, just came across Multiple Language Support in the help file. But I do have a thought, can i use the multi language features if the sections don't have a closing tag. Like in the image in the help file &lt;script lang=vb&gt; has a closing tag of &lt;/scope&gt;. My scripts do not have a closing tag. Is also something I'm going to have to worry about when doing the semantic parser for outlining those sections.

Thanks
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You probably don't have to change languages to do this, just change to a different state instead.

Also if your last section is the one without the end then you might be ok. With outlining, it will appear "open" at the end of the document but it will still allow you to collapse it.


Actipro Software Support

Posted 19 years ago by Tim Davis
Avatar
I must say that you are a genious. It appears that you (or your team) have thought of every possible usage scenario for this control. That worked perfectly and it was so easy to do.

I do have another question though. I have succesfully written the semantic parser for mine, it now folds the file from the {Code} word to the EOF.

My question is what is the Regex pattern for a blank/empty/line.

I want to fold the document on {Setup} (see example in first post) and have it stop folding on first blank new line.

I'm not quite getting a grasp on this regex stuff, I've gotten several helpers and I can't create a patter that will match an empty line.
Posted 19 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
You might be able to use a pattern of two zero-width assertions... one for the beginning of line followed by the one for the end of line.

But we actually have a sample using another method. If you look at the C# example, XML comments consume line feeds until one is found that is not followed by a /// pattern. Check that out, it may help.


Actipro Software Support

The latest build of this product (v24.1.0) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.