Tuesday, April 20, 2010

Context aware syntax?

I'm using a simple syntax file to highlight the TAP protocol (http://en.wikipedia.org/wiki/Test_Anything_Protocol). The syntax can be found here:
http://github.com/threebytesfull/perltest/blob/master/syntax/TAPVerboseOutput.vim

There are two problems I would like to address. First, TAP is essentially a series of "ok/not ok" lines followed by an optional sequential number:

1..5
ok 1 - this is a test
not ok 2
ok - another test # number optional, assumed as 3
ok
ok 5 # number MUST be 5 because this is fifth result

Is there anyway to highlight a syntax error if the fifth "ok/not ok" line should have the number 5, but actually has a different number?

In a related case, we're trying to create "nested TAP". With this, you might see the following:

1..3
ok 1
1..2
ok 1
ok 2
ok 2
ok 3

If the TAP is nested to the correct level (four spaces every time a new stream is embedded), is should be an error. Again, is there any way for vim to be aware of this when highlighting?

Cheers,
Ovid
--
Buy the book - http://www.oreilly.com/catalog/perlhks/
Tech blog - http://blogs.perl.org/users/ovid/
Twitter - http://twitter.com/OvidPerl
Official Perl 6 Wiki - http://www.perlfoundation.org/perl6

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

Subscription settings: http://groups.google.com/group/vim_use/subscribe?hl=en

No comments: