Re: sh.syntax



On Fri, 16 Aug 2002, Andrew V. Samoilov wrote:

> Hello!
> 
> Construction like
> source_tarball=${source_tarball:-"${PACKAGE}${VERSION:+-$VERSION}.tar.bz2"}
> confuses sh.syntax.

I don't see how to fix it.  We have only two levels of highligting -
context and keyword, and neigher can be nested.  Besides, the keywords of
the default context always take preference over context delimiters.  The
only way to work around this limitation is to use an exclusive context,
(see how /* */ is supported in c.syntax), but even that won't work because
there is no way to distinguish } in { } and ${ }.

Even if we make ${ } a context, we would only win one level.  
Constructions with three levels of braces would break it again:

${source_tarball:-${PACKAGE+${DEFAULT_PACKAGE}}}

I don't think the existing syntax engine is powerful enough to highlight 
so complicated shell scripts.

> Also it does not understand <<-EOF.

That's easy to fix.  Applied.

=======================
--- syntax/sh.syntax
+++ syntax/sh.syntax
@@ -164,8 +164,8 @@
 context # \n brown/22
     spellcheck
 
-context exclusive whole <<\[\s\]\[\\\]EOF EOF green/6
-context exclusive whole <<\[\s\]\[\\\]END END green/6
+context exclusive whole <<\[\s\]\[-\]\[\s\]\[\\\]EOF EOF green/6
+context exclusive whole <<\[\s\]\[-\]\[\s\]\[\\\]END END green/6
 
 context ' ' green/6
 
=======================

-- 
Regards,
Pavel Roskin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]