Bug#468366: vim: Wrong highlighting for sh arithmetic expressions

Charles E. Campbell, Jr. drchip at campbellfamily.biz
Sun Mar 2 22:38:44 UTC 2008


James Vega wrote:

>Charles,
>
>As shown below, sh.vim is too loosely interpreting the arithmetic
>expansion syntax.  As noted in Bash's manpage and SUS[0], arithmetic
>expansion should be treated as if the contained expression were within
>double quotes.  shArithmetic should contain a cluster that doesn't
>include shSubSh.
>
>Also, I noticed that the default syntax highlighting highlights $(()) as
>an error.  Should that be the case since it is specified in SUS?
>
>On Thu, Feb 28, 2008 at 10:31:15AM -0500, Edward Allcutt wrote:
>  
>
>>The following is highlighted badly:
>>
>>==== start file ========
>>#!/bin/bash
>>
>>echo $(( ( 2 << 5 ) + 1 ))
>>
>>echo foo bar
>>==== end file ==========
>>
>>The 5 is the wrong colour and everything following until the end of file
>>is highlighted as if it were quoted text. Removing the parentheses around
>>the sub-expression corrects the highlighting but changes the meaning of the
>>expression.
>>    
>>
Hello!

The << was getting treated as the start of a here document -- so that 
explains the "treated as text" problem.  Please try the attached file.

Regards,
Chip Campbell

>
>[0] - http://www.opengroup.org/onlinepubs/000095399/utilities/xcu_chap02.html#tag_02_06_04
>  
>

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: sh.vim
Url: http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20080302/4e68251c/attachment-0001.txt 


More information about the pkg-vim-maintainers mailing list