Loading ...
Sorry, an error occurred while loading the content.

New question

Expand Messages
  • Mark Manning
    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
    Message 1 of 3 , Sep 10, 2006
    • 0 Attachment
      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?
    • Yakov Lerner
      ... 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
      Message 2 of 3 , Sep 10, 2006
      • 0 Attachment
        On 9/11/06, Mark Manning <markem@...> 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
      • Yakov Lerner
        ... From: Mark Manning Date: Sep 11, 2006 1:43 AM Subject: Re: New question To: Yakov Lerner Ok, tried it and it
        Message 3 of 3 , Sep 10, 2006
        • 0 Attachment
          ---------- Forwarded message ----------
          From: Mark Manning <markem@...>
          Date: Sep 11, 2006 1:43 AM
          Subject: Re: New question
          To: Yakov Lerner <iler.ml@...>


          Ok, tried it and it works! :-)

          Thanks! :-)

          Mark
        Your message has been successfully submitted and would be delivered to recipients shortly.