diff --git a/Account.m b/Account.m index d24fb78..bab53a3 100644 --- a/Account.m +++ b/Account.m @@ -28,36 +28,26 @@ end end function r = multiplyBy(obj,n) - r = [obj.Value] * n; + r = [obj.Value( end ) ]* n; n = 1; nFactorial = 1; while nFactorial < 1e100 n = n + 1; nFactorial = nFactorial * n; end - end - end - function r = multiplyBy(obj,n) - r = [obj.Value] * n; - n = 1; - nFactorial = 1; - while nFactorial < 1e100 - n = n + 1; - nFactorial = nFactorial * n; - end - end - function r = plus(o1,o2) - r = o1.Value + o2.Value; - end - end - % Some events + end + function r = plus(o1,o2) + r = o1.Value + o2.Value; + end + end + % Some events events (ListenAccess = protected) % A comment - % Event comment - StateChanged + % Event comment + StateChanged end - % Some enumeration + % Some enumeration enumeration % A comment - No (0) - Yes (1) + No (0) + Yes (1) end -end +end \ No newline at end of file diff --git a/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage b/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage index 7da0f31..173e1f0 100644 --- a/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage +++ b/Matlab.tmbundle/Syntaxes/MATLAB.tmLanguage @@ -13,24 +13,10 @@ patterns + comment + This and #all_after_command_dual are split out so #command_dual can be excluded in things like (), {}, [] include - #classdef - - - include - #function - - - include - #blocks - - - include - #control_statements - - - include - #global_persistent + #all_before_command_dual include @@ -38,43 +24,91 @@ include - #string - - - include - #line_continuation - - - include - #comments - - - include - #transpose - - - include - #constants - - - include - #variables - - - include - #end_in_parens + #all_after_command_dual + + repository + + all_before_command_dual - include - #numbers + patterns + + + include + #classdef + + + include + #function + + + include + #blocks + + + include + #control_statements + + + include + #global_persistent + + + include + #parens + + + include + #square_brackets + + + include + #indexing_curly_brackets + + + include + #curly_brackets + + + all_after_command_dual - include - #operators + patterns + + + include + #string + + + include + #line_continuation + + + include + #comments + + + include + #transpose + + + include + #constants + + + include + #variables + + + include + #numbers + + + include + #operators + + - - repository - blocks patterns @@ -1181,6 +1215,145 @@ name meta.globalpersistent.matlab + parens + + begin + \( + end + (\)|(? + comment + We don't include $self here to avoid matching command syntax inside (), [], {} + patterns + + + include + #end_in_parens + + + include + #all_before_command_dual + + + include + #all_after_command_dual + + + comment + These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written + include + #block_keywords + + + + square_brackets + + begin + \[ + end + \] + comment + We don't include $self here to avoid matching command syntax inside (), [], {} + patterns + + + include + #all_before_command_dual + + + include + #all_after_command_dual + + + comment + These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written + include + #block_keywords + + + + curly_brackets + + begin + \{ + end + \} + comment + We don't include $self here to avoid matching command syntax inside (), [], {} + patterns + + + include + #end_in_parens + + + include + #all_before_command_dual + + + include + #all_after_command_dual + + + include + #end_in_parens + + + comment + These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written + include + #block_keywords + + + + indexing_curly_brackets + + Comment + Match identifier{idx, idx, } and stop at newline without ... This helps with partially written code like x{idx + begin + ([a-zA-Z][a-zA-Z0-9_\.]*\s*)\{ + beginCaptures + + 1 + + patterns + + + include + $self + + + + + end + (\}|(? + comment + We don't include $self here to avoid matching command syntax inside (), [], {} + patterns + + + include + #end_in_parens + + + include + #all_before_command_dual + + + include + #all_after_command_dual + + + include + #end_in_parens + + + comment + These block keywords pick up any such missed keywords when the block matching for things like (), if-end, etc. don't work. Useful for when someone has partially written + include + #block_keywords + + + line_continuation captures diff --git a/controlFlow.m b/controlFlow.m index 51677f2..fde08cf 100644 --- a/controlFlow.m +++ b/controlFlow.m @@ -12,7 +12,7 @@ otherwise end try - if y < 10 + if y( end ) < 10 disp('y < 10'); elseif y < 20 disp('y < 20'); diff --git a/lineContinuations.m b/lineContinuations.m new file mode 100644 index 0000000..8992009 --- /dev/null +++ b/lineContinuations.m @@ -0,0 +1,16 @@ +vector = [ ... comment + 1 ... commentary + 2 ... + 3 ... some comments + ]; + +cellvector = { ... comment + 1 ... comment + 2 ... + 3 ... comment + }; + +output = foo( ... + arg1, ...comment + arg2 ... comment + );