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

73443Re: [BUG] While skipping eval7() cannot handle dictionaries with keys starting with number correctly

Expand Messages
  • Bram Moolenaar
    Sep 29, 2013
    • 0 Attachment
      ZyX -

      > Try the following code:
      >
      > let d={'0d': 1}
      > if 0 && (d.0d)
      > endif
      >
      > . This code is completely correct if you replace `if 0` with `if 1`, but with `if 0` it throws
      >
      >
      > Error detected while processing /home/zyx/tmp/vim/subscript-bug.vim:
      > line 2:
      > E110: Missing ')'
      > E15: Invalid expression: 0 && (d.0d)
      >
      > . Reason is the following: when `evaluate` argument is set to FALSE in eval7() handle_subscript does not take .0d as dictionary key (because it checks for variable type which is VAR_UNKNOWN if evaluate is FALSE). Thus `.0d` is handled in eval5() like string concatenation and when it tries to evaluate second argument ā€œ0dā€ in eval7() it is handled like number in that big switch(**arg) statement. As a number it can consume only leading zero, which means when eval7() *that is handling top ā€œ(d.0d)ā€ expression* sees that in place of getting **arg equal to ')' it gets **arg equal to 'd' and errors out.

      Right. Overloading "." for string concatenation has its disadvantages.
      For Zimbu I decided to use ".." instead.

      I'll add the bug to the todo list, hopefully someone can fix it.

      - Bram

      --
      "Never be afraid to tell the world who you are."
      -- Anonymous

      /// 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

      ---
      You received this message because you are subscribed to the Google Groups "vim_dev" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscribe@....
      For more options, visit https://groups.google.com/groups/opt_out.
    • Show all 4 messages in this topic