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

Showing 1-4 of 4 messages
[BUG] While skipping eval7() cannot handle dictionaries with keys starting with number correctly ZyX 9/29/13 7:01 AM
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.
Re: [BUG] While skipping eval7() cannot handle dictionaries with keys starting with number correctly Bram Moolenaar 9/29/13 8:38 AM

ZyX -
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@Moolenaar.net -- 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    ///
Re: [BUG] While skipping eval7() cannot handle dictionaries with keys starting with number correctly Christian Brabandt 9/30/13 9:11 AM
This looks a little bit like the bug that has been fixed with 7.3.841.

Nevertheless the fix seems more complicated this time, as I don't know
how to only consume the argument for dictionaries while leaving string
concatenation alone.

regards,
Christian

Re: [BUG] While skipping eval7() cannot handle dictionaries with keys starting with number correctly ZyX 9/30/13 9:20 AM

This is skipping. We do not care whether it should be treated as concatenation or indexing. In fact all skips take indexing as concatenation always and most of time everything is fine. What we do care is that it should not error out.

I think that taking dot followed by an identifier character as indexing always (while skipping obviously) (which is something like one-line patch to handle_subscript) should work, but have not constructed a proof for this.

Allowing any identifier character in a number *while skipping* may also work.

> regards,
> Christian
>
> --
> --
> 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+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.