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

Re: Infinite loop in awk indentation

Expand Messages
  • Bram Moolenaar
    ... Have you tried contacting the author, Erik Janssen? -- A village. Sound of chanting of Latin canon, punctuated by short, sharp cracks. It comes nearer.
    Message 1 of 6 , Apr 2, 2011
    • 0 Attachment
      Philipp Edelmann wrote:

      > Dear Vim developers,
      >
      > I noticed certain cases which cause Vim's indentation for awk to go into
      > an infinite loop. The problem appears when there is a negative brace
      > balance, i.e. more closing braces than opening braces. This can easily
      > happen if one uses a regexp to match a closing brace. Vim then moves
      > upward through the file to find the corresponding opening brace, which
      > does not exist. The loop is missing a break condition for the case that
      > line 0 has been reached. I added it in my patch.
      >
      > You see for yourself by opening the attached demo.awk and inserting a
      > line below "match".
      >
      > Additionally, I think that strings and computed regexps should not be
      > scanned for matching braces at all when it comes to determining the
      > indentation. I changed the Get_brace_balance function to strip "..." and
      > /.../ while taking into account escape characters. I am novice in
      > writing Vim script and I'd be glad if somebody found a more elegant way
      > of doing this but at least it seems to give proper indentation now.
      >
      > The attached patch should apply to the current version of indent/awk.vim.

      Have you tried contacting the author, Erik Janssen?


      --
      A village. Sound of chanting of Latin canon, punctuated by short, sharp
      cracks. It comes nearer. We see it is a line of MONKS ala SEVENTH SEAL
      flagellation scene, chanting and banging themselves on the foreheads with
      wooden boards.
      "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
      \\\ an exciting new programming language -- http://www.Zimbu.org ///
      \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

      --
      You received this message from the "vim_dev" 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
    • Philipp Edelmann
      Dear Bram, ... No, I haven t. The history in the file shows only two entries back in 2002 and the repository shows no activity since the initial commit in
      Message 2 of 6 , Apr 2, 2011
      • 0 Attachment
        Dear Bram,

        On Sat, Apr 02, 2011 at 03:10:46PM +0200, Bram Moolenaar wrote:
        > Have you tried contacting the author, Erik Janssen?

        No, I haven't. The history in the file shows only two entries back in
        2002 and the repository shows no activity since the initial commit in
        2004, so I figured there is no active development going on and I could
        just as well submit the bug fix directly. If you think it's more
        appropriate, I can contact him and ask for his advice.


        Cheers,
        Philipp
      • Bram Moolenaar
        ... Yes, always contact the original author or current maintainer. If there is no response we can think of other solutions. -- BEDEVERE: Wait. Wait ... tell
        Message 3 of 6 , Apr 2, 2011
        • 0 Attachment
          Philipp Edelmann wrote:

          > On Sat, Apr 02, 2011 at 03:10:46PM +0200, Bram Moolenaar wrote:
          > > Have you tried contacting the author, Erik Janssen?
          >
          > No, I haven't. The history in the file shows only two entries back in
          > 2002 and the repository shows no activity since the initial commit in
          > 2004, so I figured there is no active development going on and I could
          > just as well submit the bug fix directly. If you think it's more
          > appropriate, I can contact him and ask for his advice.

          Yes, always contact the original author or current maintainer.
          If there is no response we can think of other solutions.

          --
          BEDEVERE: Wait. Wait ... tell me, what also floats on water?
          ALL: Bread? No, no, no. Apples .... gravy ... very small rocks ...
          ARTHUR: A duck.
          "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
          \\\ an exciting new programming language -- http://www.Zimbu.org ///
          \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

          --
          You received this message from the "vim_dev" 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
        • Philipp Edelmann
          Dear Bram, ... Erik just replied to me. In the next couple of days he is going to send you a fixed version along some patches that accumulated over the years.
          Message 4 of 6 , Apr 5, 2011
          • 0 Attachment
            Dear Bram,

            On Sat, Apr 02, 2011 at 06:25:17PM +0200, Bram Moolenaar wrote:
            > Yes, always contact the original author or current maintainer.
            > If there is no response we can think of other solutions.

            Erik just replied to me. In the next couple of days he is going to send
            you a fixed version along some patches that accumulated over the years.


            Cheers,
            Philipp
          Your message has been successfully submitted and would be delivered to recipients shortly.