Tuesday, June 28, 2011

syntax highlight unusual strings

my company is using a propitiatory language. there are 4 kind of
different kind of strings that can be defined.

i"mystring"
x"mystring"
b"mystring"
"mystring"

i'm writing a syntax file and want to be able to highlight strings in
a regular manner except when they start with a letter, i.e. i want
everything that is quoted to be highlighted as a regular string but i
want the letters i,x and b that stand in front of the quotation marks
to be highlighted with a different color.

right now i have the following code for the strings:

syn region myRegularString start=/"/ end=/"/
syn region myByteString start=/b"/ end=/"/
syn region myHexString start=/x"/ end=/"/
syn region myOtherString start=/i"/ end=/"/

hi def link myRegularString myString
hi def link myByteString myString
hi def link myHexString myString
hi def link myOtherString myString

hi def link myString string

any ideas on how to improve it to achieve the goal stated above is
appreciated.

--
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

No comments:

Post a Comment