sublime_autotools icon indicating copy to clipboard operation
sublime_autotools copied to clipboard

Backticks (and case clauses?) explode Autoconf M4 syntax

Open nabijaczleweli opened this issue 3 years ago • 1 comments

Consider the following block (part of dash):

if test "enable_test_workaround" = "auto" &&
   test "$ac_cv_func_faccessat" = yes; then
	case `uname -s 2>/dev/null` in
	GNU/kFreeBSD | \
	FreeBSD)
		enable_test_workaround=yes
	esac
fi
if test "$enable_test_workaround" = "yes"; then
	AC_DEFINE([HAVE_TRADITIONAL_FACCESSAT], [1],
		[Define if your faccessat tells root all files are executable])
fi

if test "$enable_fnmatch" != no; then
	use_fnmatch=
	AC_CHECK_FUNCS(fnmatch, use_fnmatch=yes)
fi

if test "$use_fnmatch" = yes && test "$enable_glob" = yes; then
	AC_CHECK_FUNCS(glob)
fi

On the closing paren after "FreeBSD" with ScopeAlways I see source.m4 meta.scope.if-block.shell meta.scope.case-block.shell string.interpolated.backtick.shell meta.function-call.arguments.shell meta.interpolation.command.shell

If I convert the `` to $()s I get source.m4 meta.scope.if-block.shell meta.scope.case-block.shell meta.scope.case-clause.shell meta.scope.case-clause-body.shell

This causes all subsequent highlights to break: (on the blank line before the first dnl I see source.m4 meta.scope.if-block.shell meta.scope.case-block.shell string.interpolated.backtick.shell meta.function-call.arguments.shell meta.interpolation.command.shell as well)

Cf. when replaced with $(): (well, admittedly, I also see source.m4 meta.scope.if-block.shell meta.scope.case-block.shell meta.scope.case-body.shell meta.scope.case-clause.shell meta.scope.case-clause-body.shell on the same blank line, so idk, but at least it's highlighted correctly)

nabijaczleweli avatar Dec 18 '22 03:12 nabijaczleweli

This may be due to the shell grammar changing? See #10. I'd welcome a pull request to fix this.

ptomato avatar Dec 29 '22 22:12 ptomato