Previously, the function_def contexts worked like this:
In the main context, when function was matched, function_def_name was pushed.
In the function_def_name context, when ( (function args start) was matched, function_def_args was pushed.
function_def_name was not popped, as you cannot pushandpop in the same match.
In the function_def_args context, when ) (function args end) was matched, the context main was set (as you cannot pop twice).
However, this broke compatibility with other syntaxes that use LuaExtended, such as @hbomb79's 'Titanium', which included LuaExtended.sublime-syntax in its main context.
After function_def_args matched ), the context would be set to LuaExtended's main, not Titanium's. Titanium's main context would no longer work.
In order to fix this, I made a slight change:
In the main context, when function is matched, function_def_name is pushed (same as before).
In the function_def_name context, when ( (function args start) is matched, function_def_args is set.
In the function_def_args context, when ) (function args end) is matched, function_def_args is popped.
This is a much nicer way to transition between the two contexts, and it worked perfectly when tested with @hbomb79's Titanium.sublime_syntaxfile.
On a different note, I also removed some leftover comments from 7708a4784b7e6b6a8093b35516fdf2698ae058aa that were meant to be temporary, but somehow made it into the commit (probably due to a faulty rebase). Sorry about that!
Previously, the function_def contexts worked like this:
main
context, whenfunction
was matched,function_def_name
was pushed.function_def_name
context, when(
(function args start) was matched,function_def_args
was pushed.function_def_name
was not popped, as you cannotpush
andpop
in the same match.function_def_args
context, when)
(function args end) was matched, the contextmain
was set (as you cannotpop
twice).However, this broke compatibility with other syntaxes that use LuaExtended, such as @hbomb79's 'Titanium', which included
LuaExtended.sublime-syntax
in itsmain
context. Afterfunction_def_args
matched)
, the context would be set to LuaExtended's main, not Titanium's. Titanium'smain
context would no longer work.In order to fix this, I made a slight change:
main
context, whenfunction
is matched,function_def_name
is pushed (same as before).function_def_name
context, when(
(function args start) is matched,function_def_args
is set.function_def_args
context, when)
(function args end) is matched,function_def_args
is popped.This is a much nicer way to transition between the two contexts, and it worked perfectly when tested with @hbomb79's
Titanium.sublime_syntax
file.On a different note, I also removed some leftover comments from 7708a4784b7e6b6a8093b35516fdf2698ae058aa that were meant to be temporary, but somehow made it into the commit (probably due to a faulty rebase). Sorry about that!