Hi everybody,
I am trying to create a syntax file with folding. However after
pouring over the documentation for hours, I seem to be stuck. I want
to, for instance, fold a begin/end block. I have created a simple
syntax file with just this line:

syntax region xBlock start="begin" end="end" transparent
contains=xBlock,xKeyword fold

As expected, this works well. However 'begin' and 'end' are keywords. So I add:
syntax keyword xKeyword begin
This breaks the fold. It no longer sees the begin. I changed it to
syntax match xKeyword "\<begin\>"
And now it works again. Now for 'end'. I know that defining it as a
keyword is problematic, so I do a match again.
syntax match xKeyword "\<end\>"
This breaks the fold again however. Even though every 'begin' starts a
new fold, 'end' doesn't end them. I tried adding keepend to the
region, but then the first 'end' ends all folds. There must be
something that I am not understanding. Any help would be appreciated.

I have included a file I have used to test.

Thanks
Marius

#####################################
Test file
#####################################
function myFunction
begin
  some code;
  command;
  and ;
  other stuff;

  begin
     a new
     block;
  end;


  and some;
  more stuff;

end;

Reply via email to