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

Syntax Highlighting

Expand Messages
  • ANDY KENNEDY
    In the kconfig.vim file, there exists the following: syn keyword kconfigPreProc source nextgroup=kconfigPath skipwhite Later, there is: syn
    Message 1 of 17 , Jan 17, 2013
    • 0 Attachment
      In the kconfig.vim file, there exists the following:

      syn keyword kconfigPreProc source
      \ nextgroup=kconfigPath
      \ skipwhite

      Later, there is:

      syn match kconfigPath '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
      \ contained

      which appears to match something like:

      source "path/to/myfile"

      however, it also seems to match

      source path/to/myfile

      which has caused me issues in the past. To that end, I want to do
      something like what lilo.conf has in it where I can set
      "source path/to/myfile" as Error text so I can clearly see what my
      problem is.

      I attempted to do something like:

      syn match kconfigPreProcError source
      \ nextgroup=kconfigPathError
      \ skipwhite

      syn match kconfigPathError '[^"]*.*$'

      then later

      hi def link kconfigPreProcError Error

      But this didn't do what I expected.

      Please tell me where I've gone wrong.

      Thanks!
      Andy

      --
      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
    • Andy Wokula
      ... This should give you E402: Garbage after pattern: source nextgroup=kconfigPathError skipwhite E475: Invalid argument: kconfigPreProcError source
      Message 2 of 17 , Jan 18, 2013
      • 0 Attachment
        Am 17.01.2013 23:31, schrieb Andy Kennedy:
        > In the kconfig.vim file, there exists the following:
        >
        > syn keyword kconfigPreProc source
        > \ nextgroup=kconfigPath
        > \ skipwhite
        >
        > Later, there is:
        >
        > syn match kconfigPath '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
        > \ contained
        >
        > which appears to match something like:
        >
        > source "path/to/myfile"
        >
        > however, it also seems to match
        >
        > source path/to/myfile
        >
        > which has caused me issues in the past. To that end, I want to do
        > something like what lilo.conf has in it where I can set
        > "source path/to/myfile" as Error text so I can clearly see what my
        > problem is.
        >
        > I attempted to do something like:
        >
        > syn match kconfigPreProcError source
        > \ nextgroup=kconfigPathError
        > \ skipwhite

        This should give you
        E402: Garbage after pattern: source nextgroup=kconfigPathError skipwhite
        E475: Invalid argument: kconfigPreProcError source nextgroup=kconfigPathError skipwhite

        > syn match kconfigPathError '[^"]*.*$'
        >
        > then later
        >
        > hi def link kconfigPreProcError Error
        >
        > But this didn't do what I expected.
        >
        > Please tell me where I've gone wrong.
        >
        > Thanks!
        > Andy

        Try the following:

        ~/.vim/after/syntax/kconfig.vim
        #v+

        syn clear kconfigPreProc
        syn keyword kconfigPreProc source nextgroup=kconfigPath,kconfigPathError skipwhite

        syn match kconfigPathError '[^" \t].*$' contained

        hi def link kconfigPathError Error

        #v-

        --
        Andy

        --
        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
      • ANDY KENNEDY
        ... Probably did. I guess I need to spend more time with :help syn-define. ... Cool! Thanks! I had to make a slight modification to what you put up there:
        Message 3 of 17 , Jan 18, 2013
        • 0 Attachment
          > Am 17.01.2013 23:31, schrieb Andy Kennedy:
          > > In the kconfig.vim file, there exists the following:
          > >
          > > syn keyword kconfigPreProc source
          > > \ nextgroup=kconfigPath
          > > \ skipwhite
          > >
          > > Later, there is:
          > >
          > > syn match kconfigPath '"[^"\\]*\%(\\.[^"\\]*\)*"\|\S\+'
          > > \ contained
          > >
          > > which appears to match something like:
          > >
          > > source "path/to/myfile"
          > >
          > > however, it also seems to match
          > >
          > > source path/to/myfile
          > >
          > > which has caused me issues in the past. To that end, I want to do
          > > something like what lilo.conf has in it where I can set
          > > "source path/to/myfile" as Error text so I can clearly see what my
          > > problem is.
          > >
          > > I attempted to do something like:
          > >
          > > syn match kconfigPreProcError source
          > > \ nextgroup=kconfigPathError
          > > \ skipwhite
          >
          > This should give you
          > E402: Garbage after pattern: source nextgroup=kconfigPathError skipwhite
          > E475: Invalid argument: kconfigPreProcError source nextgroup=kconfigPathError skipwhite

          Probably did. I guess I need to spend more time with :help syn-define.

          >
          > > syn match kconfigPathError '[^"]*.*$'
          > >
          > > then later
          > >
          > > hi def link kconfigPreProcError Error
          > >
          > > But this didn't do what I expected.
          > >
          > > Please tell me where I've gone wrong.
          > >
          > > Thanks!
          > > Andy
          >
          > Try the following:
          >
          > ~/.vim/after/syntax/kconfig.vim
          > #v+
          >
          > syn clear kconfigPreProc
          > syn keyword kconfigPreProc source nextgroup=kconfigPath,kconfigPathError skipwhite
          >
          > syn match kconfigPathError '[^" \t].*$' contained
          >
          > hi def link kconfigPathError Error
          >

          Cool! Thanks! I had to make a slight modification to what you put up
          there:

          syn match kconfigPathError '\s*[^"].*$' contained

          Otherwise, the obvious space prior to the path matches and the string is
          accepted. I want it to fail for anything not quoted. So, the
          modification is to allow any whitespace then look for anything not `"'.
          But that really helped. I am super grateful!

          Thanks again!
          Andy

          > #v-
          >
          > --
          > Andy
          >
          > --
          > 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

          --
          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
        Your message has been successfully submitted and would be delivered to recipients shortly.