Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

New syntax file for vim

1 view
Skip to first unread message

rui....@gmail.com

unread,
Nov 9, 2006, 8:55:51 PM11/9/06
to
Hi, i need help to creat a new syntax file.
The problem is:
There are 2 cases where the word 'end' can appear:

-- 1
compose X of A1 A2 end;

-- 2
cases x:
xx -> aaa,
yy -> bbb,
zz -> ccc
end;


In the first case the word 'end' should be green (like 'compose' and
'of'), because is a type definition (the word appear between the word
'compose' and the character ';').
In the second case the word 'end' should be yellow (like 'cases'),
because is a statement (the word appear between the word 'cases' and
the character ';').

I try do that:
syn match xCompose /compose/ nextgroup=xAuxCo skipwhite
syn match xAuxCo /[^{end}]*/ contained nextgroup=xEndCo skipwhite
syn match xEndCo /end/ contained

syn match xCases /cases/ nextgroup=xAuxCa skipwhite
syn match xAuxCa /[^{end}]*/ contained nextgroup=xEndCa skipwhite
syn match xEndCa /end/ contained

hi link vdmCompose Type
hi link vdmEndC Type
hi link vdmCases Statement
hi link vdmEndCa Statement


But this doesn't work.
Anybody can help me?
Thanks

muede

unread,
Nov 10, 2006, 1:31:27 PM11/10/06
to
rui....@gmail.com schrieb:
Hi,
maybe this wont help you much , since im not very familiar with
vim-syntaxing,but...

First the highligthing-groups for which you define the syntax
expressions differ from the groups, which you actually link in the last
paragraph.
Second, this pattern /[^{end}]*/ matches anything but the characters
{,},n,e,d
.
andy

Karthick

unread,
Nov 11, 2006, 3:46:57 AM11/11/06
to

Try :help syn-region

syntax region cases keepend start="cases" end="end"
syntax region compose keepend start="compose" end="end"
syntax keyword compose_end end containedin=compose
syntax keyword cases_end end containedin=cases
hi link compose_end Type
hi link cases_end Statement

0 new messages