On Thu, May 11, 2006 at 10:40:20AM -0600, Shaun Cummins wrote:
> Thanks for the responses everyone!
> 
> >   BTW, do you realize that in your end pattern, ".\+" will match all of
> >      "STA1" "n" "" "" "" "" "" ""
> >and .* will then match nothing?
> 
> The values within the quotes can be any text [\w\d-\.\+].  The 6 value
> on the first line tells me how many lines are following. I needed to
> use .* in the case where the value is set to zero, otherwise my
> example where the number is set to zero doesn't match.

     I think you missed my point.  Everything from the first " on the
line to the last one, including all the " characters in between, is
matched by ".\+".  Maybe this *is* what you want, but it does look odd.

> >If that's the case I suspect the only way to do it is to set up
> >a separate syntax entry for each possible number, so it would be
> 
> > syntax region Keyword start="^\w\+\s\+1\>" end={pattern for one line}
> > syntax region Keyword start="^\w\+\s\+2\>" end={pattern for two lines}
> 
> >and so on.  Perhaps "syntax match" would be better, depending on the
> >precise requirements.  It's bad news if the number can go as high as
> >2000 but I can't think of an easier way to do it.
> 
> Thanks Matthew. I thought that might be the only way to do it.
> Theoretically the number is unlimited, but in practice the number is
> almost always less than 12. Since I can't use the captured value in
> the counter, I think you are right. This probably is the only way to
> do it.

     I think another way to do it would be using nextgroup.  That is,
after a start line ending in " 6", specify the nextgroup as Line6; Line6
specifies a nextgroup of Line5; Line5 specifies a nextgroup of Line4;
and so on.  I am not an expert on syntax definitions, so I am not sure
what (dis)advantages this method would have.

:help :syn-nextgroup

HTH                                     --Benji Fisher

Reply via email to