On 9/11/06, Mark Manning <[EMAIL PROTECTED]> wrote:
Hey, I hate to keep barging in here asking questions and such but here is a new one. :-)In the new basic.vim file I am having a problem. In FreeBasic you can use both single as well as double quotes to enclose a string. Unfortunately, you can also have comments which start with a single quote. So far I can capture and highlight correctly these three conditions: 1. REM <Comment> 2. <Spaces>'<Comment> 3. :<Spaces><Comment> What I can not get is the: 1. '<Comment> Like so: test.bas rem This is a comment ' This is a comment : ' This is a comment ' This is a comment too but it doesn't properly highlight. Instead, it thinks it is a string. end Here are my commands: " Comments syn match bSpecial contained "\\." syn region bComment start="^rem" end="$" contains=bSpecial,bTodo syn region bComment start=":\s*'" end="$" contains=bSpecial,bTodo syn region bComment start="^\s*'" end="$" contains=bSpecial,bTodo " String and Character contstants syn region bString start='"' end='"' contains=bSpecial,bTodo syn region bString start="'" end="'" contains=bSpecial,bTodo Suggestions?
Try to reverse order of statements, putting Comment after String. The last one takes precedence, and you want Comment to take precedence over string. Like this: " String must go before Comments " String and Character contstants syn region bString start='"' end='"' contains=bSpecial,bTodo syn region bString start="'" end="'" contains=bSpecial,bTodo " Comments syn match bSpecial contained "\\." syn region bComment start="^rem" end="$" contains=bSpecial,bTodo syn region bComment start=":\s*'" end="$" contains=bSpecial,bTodo syn region bComment start="^\s*'" end="$" contains=bSpecial,bTodo Yakov
