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

vim 7.1 - sh.vim syntax file - unwarranted syntax error detected.

Expand Messages
  • Patrick Gen-Paul
    From the kdb package in debian lenny: $ cat /etc/init.d/console-screen.kbd.sh 1 #!/bin/sh [some comments snipped..] 17 PKG=kbd 18 if [ -r /etc/$PKG/config ];
    Message 1 of 6 , Aug 29, 2009
    • 0 Attachment
      From the kdb package in debian lenny:

      $ cat /etc/init.d/console-screen.kbd.sh

      1 #!/bin/sh

      [some comments snipped..]

      17 PKG=kbd
      18 if [ -r /etc/$PKG/config ]; then
      19 . /etc/$PKG/config
      20 fi
      21
      22 if [ -d /etc/$PKG/config.d ]; then
      23 for i in `run-parts --list /etc/$PKG/config.d `; do
      24 . $i
      25 done
      26 fi
      27
      28 # do some magic with the variables for compatibility with the config
      29 # file of console-tools
      30 for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed
      's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
      31 ..

      [..]

      Syntax highlighting after line 30. colors the rest of the script mostly
      red - which I understand is the color used to highlight a syntax error,
      but the script executes without any problems.

      I believe I am using the "default" color scheme on an xterm with a black
      background.

      It seems things start to go wrong just after the "for vc in" statement
      so it looks like either the two single quotes followed by a back quote
      or possibly, the regex following the "grep" is causing the problem.

      Or maybe it is the bash + sed syntax mix?

      I have seen some issues with back quotes, though nothing conclusive, and
      I was wondering if the $VIMRUNTIME/syntax/sh.vim maintainer was aware of
      this issue?

      Maybe it has been addressed or circumvented in a more recent version of
      the syntax file?

      Or if this is caused by a "syntax mix", is there a way to tell vim not
      to report this type of error?

      I'm attaching a clean copy of the entire script to this message.

      Gen-Paul.



      --~--~---------~--~----~------------~-------~--~----~
      You received this message from the "vim_use" maillist.
      For more information, visit http://www.vim.org/maillist.php
      -~----------~----~----~----~------~----~------~--~---
    • Patrick Gen-Paul
      From the kdb package in debian lenny: $ cat /etc/init.d/console-screen.kbd.sh 1 #!/bin/sh [some comments snipped..] 17 PKG=kbd 18 if [ -r /etc/$PKG/config ];
      Message 2 of 6 , Aug 29, 2009
      • 0 Attachment
        From the kdb package in debian lenny:

        $ cat /etc/init.d/console-screen.kbd.sh

        1 #!/bin/sh

        [some comments snipped..]

        17 PKG=kbd
        18 if [ -r /etc/$PKG/config ]; then
        19 . /etc/$PKG/config
        20 fi
        21
        22 if [ -d /etc/$PKG/config.d ]; then
        23 for i in `run-parts --list /etc/$PKG/config.d `; do
        24 . $i
        25 done
        26 fi
        27
        28 # do some magic with the variables for compatibility with the config
        29 # file of console-tools
        30 for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed
        's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
        31 ..

        [..]

        Syntax highlighting after line 30. colors the rest of the script mostly
        red - which I understand is the color used to highlight a syntax error,
        but the script executes without any problems.

        I believe I am using the "default" color scheme on an xterm with a black
        background.

        It seems things start to go wrong just after the "for vc in" statement
        so it looks like either the two single quotes followed by a back quote
        or possibly, the regex following the "grep" is causing the problem.

        Or maybe it is the bash + sed syntax mix?

        I have seen some issues with back quotes, though nothing conclusive, and
        I was wondering if the $VIMRUNTIME/syntax/sh.vim maintainer was aware of
        this issue?

        Maybe it has been addressed or circumvented in a more recent version of
        the syntax file?

        Or if this is caused by a "syntax mix", is there a way to tell vim not
        to report this type of error?

        I'm attaching a clean copy of the entire script to this message.

        Gen-Paul.



        --~--~---------~--~----~------------~-------~--~----~
        You received this message from the "vim_use" maillist.
        For more information, visit http://www.vim.org/maillist.php
        -~----------~----~----~----~------~----~------~--~---
      • Patrick Gen-Paul
        From the kdb package in debian lenny: $ cat /etc/init.d/console-screen.kbd.sh 1 #!/bin/sh [some comments snipped..] 17 PKG=kbd 18 if [ -r /etc/$PKG/config ];
        Message 3 of 6 , Aug 29, 2009
        • 0 Attachment
          From the kdb package in debian lenny:

          $ cat /etc/init.d/console-screen.kbd.sh

          1 #!/bin/sh

          [some comments snipped..]

          17 PKG=kbd
          18 if [ -r /etc/$PKG/config ]; then
          19 . /etc/$PKG/config
          20 fi
          21
          22 if [ -d /etc/$PKG/config.d ]; then
          23 for i in `run-parts --list /etc/$PKG/config.d `; do
          24 . $i
          25 done
          26 fi
          27
          28 # do some magic with the variables for compatibility with the config
          29 # file of console-tools
          30 for vc in '' `set | grep "^.*_vc[0-9][0-9]*=" | sed
          's/^.*\(_vc[0-9][0-9]*\)=.*/\1/'`
          31 ..

          [..]

          Syntax highlighting after line 30. colors the rest of the script mostly
          red - which I understand is the color used to highlight a syntax error,
          but the script executes without any problems.

          I believe I am using the "default" color scheme on an xterm with a black
          background.

          It seems things start to go wrong just after the "for vc in" statement
          so it looks like either the two single quotes followed by a back quote
          or possibly, the regex following the "grep" is causing the problem.

          Or maybe it is the bash + sed syntax mix?

          I have seen some issues with back quotes, though nothing conclusive, and
          I was wondering if the $VIMRUNTIME/syntax/sh.vim maintainer was aware of
          this issue?

          Maybe it has been addressed or circumvented in a more recent version of
          the syntax file?

          Or if this is caused by a "syntax mix", is there a way to tell vim not
          to report this type of error?

          I'm attaching a clean copy of the entire script to this message.

          Gen-Paul.




          --~--~---------~--~----~------------~-------~--~----~
          You received this message from the "vim_use" maillist.
          For more information, visit http://www.vim.org/maillist.php
          -~----------~----~----~----~------~----~------~--~---
        • John Little
          ... With vim 7.2.245, the highlighting of line 30 is ok but fails on and after line 32, even with the very latest syntax file (v108) from the maintainer s
          Message 4 of 6 , Aug 30, 2009
          • 0 Attachment
            >  console-screen.kbd.sh

            With vim 7.2.245, the highlighting of line 30 is ok but fails on and
            after line 32, even with the very latest syntax file (v108) from the
            maintainer's website (http://mysite.verizon.net/astronaut/vim/
            index.html#vimlinks_syntax). It doesn't like the escaped double quote
            after the square bracket. The following two line shell script
            exhibits the problem:

            echo [ \"Lorem
            echo ipsum

            Dr Chip will likely see this thread, I hope this helps him, should he
            be inclined to fix it.

            Regards, John
            --~--~---------~--~----~------------~-------~--~----~
            You received this message from the "vim_use" maillist.
            For more information, visit http://www.vim.org/maillist.php
            -~----------~----~----~----~------~----~------~--~---
          • Patrick Gen-Paul
            ... I had downloaded the latest version of the syntax file before I posted and indeed it doesn t make any difference. I guess I can always send him an email
            Message 5 of 6 , Aug 31, 2009
            • 0 Attachment
              John Little wrote:
              >> console-screen.kbd.sh
              >
              > With vim 7.2.245, the highlighting of line 30 is ok but fails on and
              > after line 32, even with the very latest syntax file (v108) from the
              > maintainer's website (http://mysite.verizon.net/astronaut/vim/
              > index.html#vimlinks_syntax). It doesn't like the escaped double quote
              > after the square bracket. The following two line shell script
              > exhibits the problem:
              >
              > echo [ \"Lorem
              > echo ipsum
              >
              > Dr Chip will likely see this thread, I hope this helps him, should he
              > be inclined to fix it.

              I had downloaded the latest version of the syntax file before I posted
              and indeed it doesn't make any difference.

              I guess I can always send him an email to his contact address in sh.vim
              if he does not respond within the next few days.

              Where this particular linux init.d script is concerned, and especially
              since the line that's affected is very near the beginning, it pretty
              much defeats the purpose of syntax highlighting - as time allows, I'm
              sure he will want to come up with a fix.

              Gen-Paul.

              --~--~---------~--~----~------------~-------~--~----~
              You received this message from the "vim_use" maillist.
              For more information, visit http://www.vim.org/maillist.php
              -~----------~----~----~----~------~----~------~--~---
            • John Little
              Hi Dr Chip sent me his v109 sh.vim to try, but... This handles my two line test case, but the OP s script is still not highlighted correctly; the line is eval
              Message 6 of 6 , Sep 1, 2009
              • 0 Attachment
                Hi

                Dr Chip sent me his v109 sh.vim to try, but...

                This handles my two line test case, but the OP's script is still not
                highlighted correctly; the line is

                eval [ \"\${SCREEN_FONT$vc}\" ] &&
                eval CONSOLE_FONT$vc=3D\${CONSOLE_=
                FONT$vc:-\${SCREEN_FONT$vc}}

                The highlighting is still not handling escaped quotes in evals well.
                My test case used echo so that the result would be a valid script, but
                it was a poor choice, the following would have been better.

                eval [ \"Lorem\" ]
                eval ipsum

                With these convoluted eval expressions IMO rendering them perfectly is
                not so desirable, but getting the parsing state (f.ex. in or out of a
                quoted string) right so that the rest of the file highlights properly
                is desirable.

                Regards, John
                --~--~---------~--~----~------------~-------~--~----~
                You received this message from the "vim_use" maillist.
                For more information, visit http://www.vim.org/maillist.php
                -~----------~----~----~----~------~----~------~--~---
              Your message has been successfully submitted and would be delivered to recipients shortly.