Package: vim
Version: 2:7.3.154+hg~74503f6ee649-2
Severity: wishlist
Tags: patch

Hi!

Attached a patch which should improve the current automake syntax
highlighter, and a test file which I used to verify the syntax before
and after. The comments therein refer to the seubsequent lines. There's
still one item I know of which is bogus, AM_LDADD should not be
recognized, and this tends to be a common mistake to make so it would
be nice to not highlight it as correct, but I don't know how to exclude
just that one, help with that would be really appreciated!

thanks,
guillem
---
 runtime/syntax/automake.vim |   26 +++++++++++++++++---------
 1 file changed, 17 insertions(+), 9 deletions(-)

--- a/runtime/syntax/automake.vim
+++ b/runtime/syntax/automake.vim
@@ -2,7 +2,7 @@
 " Language:	automake Makefile.am
 " Maintainer:   Debian VIM Maintainers <[email protected]>
 " Former Maintainer:	John Williams <[email protected]>
-" Last Change:	2007-10-14
+" Last Change:	2010-12-13
 " URL: http://git.debian.org/?p=pkg-vim/vim.git;a=blob_plain;f=runtime/syntax/automake.vim;hb=debian
 "
 " XXX This file is in need of a new maintainer, Debian VIM Maintainers maintain
@@ -25,15 +25,23 @@ else
   runtime! syntax/make.vim
 endif
 
-syn match automakePrimary "^[A-Za-z0-9_]\+\(_PROGRAMS\|LIBRARIES\|_LIST\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_JAVA\|_LTLIBRARIES\)\s*="me=e-1
+syn match automakePrimary "^[A-Za-z0-9_]\+\(_PROGRAMS\|_LIBRARIES\|_LISP\|_PYTHON\|_JAVA\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_LTLIBRARIES\)\s*="me=e-1
+syn match automakePrimary "^[A-Za-z0-9_]\+\(_PROGRAMS\|_LIBRARIES\|_LISP\|_PYTHON\|_JAVA\|_SCRIPTS\|_DATA\|_HEADERS\|_MANS\|_TEXINFOS\|_LTLIBRARIES\)\s*+\=="me=e-2
 syn match automakePrimary "^TESTS\s*="me=e-1
-syn match automakeSecondary "^[A-Za-z0-9_]\+\(_SOURCES\|_LDADD\|_LIBADD\|_LDFLAGS\|_DEPENDENCIES\|_CPPFLAGS\)\s*="me=e-1
-syn match automakeSecondary "^OMIT_DEPENDENCIES\s*="me=e-1
+syn match automakePrimary "^TESTS\s*+\=="me=e-2
+syn match automakeSecondary "^[A-Za-z0-9_]\+\(_SOURCES\|_LDADD\|_LIBADD\|_LDFLAGS\|_DEPENDENCIES\|_AR\|_CCASFLAGS\|_CFLAGS\|_CPPFLAGS\|_CXXFLAGS\|_FCFLAGS\|_FFLAGS\|_GCJFLAGS\|_LFLAGS\|_LIBTOOLFLAGS\|OBJCFLAGS\|RFLAGS\|UPCFLAGS\|YFLAGS\)\s*="me=e-1
+syn match automakeSecondary "^[A-Za-z0-9_]\+\(_SOURCES\|_LDADD\|_LIBADD\|_LDFLAGS\|_DEPENDENCIES\|_AR\|_CCASFLAGS\|_CFLAGS\|_CPPFLAGS\|_CXXFLAGS\|_FCFLAGS\|_FFLAGS\|_GCJFLAGS\|_LFLAGS\|_LIBTOOLFLAGS\|OBJCFLAGS\|RFLAGS\|UPCFLAGS\|YFLAGS\)\s*+\=="me=e-2
+syn match automakeSecondary "^\(LDADD\|ARFLAGS\|OMIT_DEPENDENCIES\|AM_MAKEFLAGS\|\(AM_\)\=\(MAKEINFOFLAGS\|RUNTESTDEFAULTFLAGS\|ETAGSFLAGS\|CTAGSFLAGS\|JAVACFLAGS\)\)\s*="me=e-1
+syn match automakeSecondary "^\(LDADD\|ARFLAGS\|OMIT_DEPENDENCIES\|AM_MAKEFLAGS\|\(AM_\)\=\(MAKEINFOFLAGS\|RUNTESTDEFAULTFLAGS\|ETAGSFLAGS\|CTAGSFLAGS\|JAVACFLAGS\)\)\s*+\=="me=e-2
 syn match automakeExtra "^EXTRA_[A-Za-z0-9_]\+\s*="me=e-1
-syn match automakeOptions "^\(AUTOMAKE_OPTIONS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*="me=e-1
+syn match automakeExtra "^EXTRA_[A-Za-z0-9_]\+\s*+\=="me=e-2
+syn match automakeOptions "^\(ACLOCAL_AMFLAGS\|AUTOMAKE_OPTIONS\|DISTCHECK_CONFIGURE_FLAGS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*="me=e-1
+syn match automakeOptions "^\(ACLOCAL_AMFLAGS\|AUTOMAKE_OPTIONS\|DISTCHECK_CONFIGURE_FLAGS\|ETAGS_ARGS\|TAGS_DEPENDENCIES\)\s*+\=="me=e-2
 syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*="me=e-1
+syn match automakeClean "^\(MOSTLY\|DIST\|MAINTAINER\)\=CLEANFILES\s*+\=="me=e-2
 syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*="me=e-1
-syn match automakeConditional "^\(if\s*[a-zA-Z0-9_]\+\|else\|endif\)\s*$"
+syn match automakeSubdirs "^\(DIST_\)\=SUBDIRS\s*+\=="me=e-2
+syn match automakeConditional "^\(if\s*!\=[a-zA-Z0-9_]\+\|else\|endif\)\s*$"
 
 syn match automakeSubst     "@[a-zA-Z0-9_]\+@"
 syn match automakeSubst     "^\s*@[a-zA-Z0-9_]\+@"
@@ -42,9 +50,9 @@ syn match automakeComment2 "##.*$"
 
 syn match automakeMakeError "$[{(][^})]*[^a-zA-Z0-9_})][^})]*[})]" " GNU make function call
 
-syn region automakeNoSubst start="^EXTRA_[a-zA-Z0-9_]*\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
-syn region automakeNoSubst start="^DIST_SUBDIRS\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
-syn region automakeNoSubst start="^[a-zA-Z0-9_]*_SOURCES\s*=" end="$" contains=ALLBUT,automakeNoSubst transparent
+syn region automakeNoSubst start="^EXTRA_[a-zA-Z0-9_]*\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent
+syn region automakeNoSubst start="^DIST_SUBDIRS\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent
+syn region automakeNoSubst start="^[a-zA-Z0-9_]*_SOURCES\s*+\==" end="$" contains=ALLBUT,automakeNoSubst transparent
 syn match automakeBadSubst  "@\([a-zA-Z0-9_]*@\=\)\=" contained
 
 syn region  automakeMakeDString start=+"+  skip=+\\"+  end=+"+  contains=makeIdent,automakeSubstitution
# Correctly recgonized
AM_LDFLAGS =

# Correctly recgonized
foo_LDADD =
# FIXME: Invalidly recognized
AM_LDADD =
# Unrecognized
LDADD =

# Correctly recgonized
foo_SOURCES = a.c
# Urecognized +=
foo_SOURCES += b.c

# Correctly recgonized
SUBDIRS = aa
# Urecognized +=
SUBDIRS += bb

# Correctly recgonized
foo_LIBRARIES =
# Wrongly matched w/o _
fooLIBRARIES =

# Wrongly matched foo_LIST instead of foo_LISP
foo_LIST =
foo_LISP =

# Correctly recgonized
foo_CPPFLAGS =
# Unreceognized
foo_CFLAGS =
foo_CXXFLAGS =
foo_CCASFLAGS =
AM_RUNTESTDEFAULTFLAGS =
RUNTESTDEFAULTFLAGS =
AM_MAKEINFOFLAGS =
MAKEINFOFLAGS =
AM_MAKEFLAGS = -DFOO=1

# Correctly recgonized
AUTOMAKE_OPTIONS = aa
# Urecognized
ACLOCAL_AMFLAGS = -I m4
DISTCHECK_CONFIGURE_FLAGS = --disable-checks

# Correctly recgonized
transform =

# Correctly recgonized
foo_LIBS =
if COND_A
var += true
else !COND
var += false
endif

# Unrecognized negated conditional
if !COND_B
var += false
endif

Reply via email to