ptomato / sublime_autotools

Autotools syntax highlighting for Sublime Text
GNU General Public License v3.0
17 stars 15 forks source link

Backticks (and case clauses?) explode Autoconf M4 syntax #12

Open nabijaczleweli opened 1 year ago

nabijaczleweli commented 1 year ago

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)

ptomato commented 1 year ago

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