Subject: bug#8632: 23.2; shell-script[bash] doesn't handle bitshift $(( 1 << 16 ))

From: Stefan Monnier <[email-masked]>
Date: Fri, 13 May 2011 16:12:54 -0300

> In shell-script mode (bash minor mode) Emacs 23.2 incorrectly parses the
> following line as a HERE DOCUMENT.

> 	echo $(( 1 << 16 ))

> It is confused because sh-font-lock-open-heredoc (in sh-script.el)
> does not know about bash's ARITHMETIC EXPANSION.

Indeed, thanks for spotting this.

> There should be a function, similar to sh-in-comment-or-string, which
> parses the script looking for arithmetic expansion.

I guess the way to do it would be to try to handle $(( as
a string-opener in sh-syntax-propertize-function and then write
code to jump to the matching )) to mark it as the string-closer.

Patch welcome,

        Stefan