diff --git a/Units/matlab-tg-corpus.d/expected.tags b/Units/matlab-tg-corpus.d/expected.tags index d90c209134..b7f1c9f352 100644 --- a/Units/matlab-tg-corpus.d/expected.tags +++ b/Units/matlab-tg-corpus.d/expected.tags @@ -1,4 +1,14 @@ backtrack input.m /^function [xn,fn,fcall] = backtrack(xc,d,fc,fnc,DDfnc,c,gamma,eps)$/;" f +cDDfnc input.m /^ cDDfnc = gamma*cDDfnc;$/;" v +cDDfnc input.m /^cDDfnc = c*DDfnc;$/;" v +d input.m /^ d = gamma*d;$/;" v +fcall input.m /^ fcall = fcall+1;$/;" v +fcall input.m /^fcall = 1 ;$/;" v +fn input.m /^ fn = feval(fnc,xn);$/;" v +fn input.m /^fn = feval(fnc,xn);$/;" v func1 input.m /^function [x,y,z] = func1 $/;" f func2 input.m /^function x = func2 $/;" f func3 input.m /^function func3 $/;" f +xn input.m /^ xn = xc;$/;" v +xn input.m /^ xn = xc+d;$/;" v +xn input.m /^xn = xc+d;$/;" v diff --git a/Units/noext-tg-matlab.d/expected.tags b/Units/noext-tg-matlab.d/expected.tags index 6cd84ca4bf..3542e899f2 100644 --- a/Units/noext-tg-matlab.d/expected.tags +++ b/Units/noext-tg-matlab.d/expected.tags @@ -1,4 +1,14 @@ backtrack input.nolang /^function [xn,fn,fcall] = backtrack(xc,d,fc,fnc,DDfnc,c,gamma,eps)$/;" f +cDDfnc input.nolang /^ cDDfnc = gamma*cDDfnc;$/;" v +cDDfnc input.nolang /^cDDfnc = c*DDfnc;$/;" v +d input.nolang /^ d = gamma*d;$/;" v +fcall input.nolang /^ fcall = fcall+1;$/;" v +fcall input.nolang /^fcall = 1 ;$/;" v +fn input.nolang /^ fn = feval(fnc,xn);$/;" v +fn input.nolang /^fn = feval(fnc,xn);$/;" v func1 input.nolang /^function [x,y,z] = func1 $/;" f func2 input.nolang /^function x = func2 $/;" f func3 input.nolang /^function func3 $/;" f +xn input.nolang /^ xn = xc;$/;" v +xn input.nolang /^ xn = xc+d;$/;" v +xn input.nolang /^xn = xc+d;$/;" v diff --git a/Units/review-needed.r/matlab_backtracking.m.t/expected.tags b/Units/review-needed.r/matlab_backtracking.m.t/expected.tags index 8fb10ac348..64e807e649 100644 --- a/Units/review-needed.r/matlab_backtracking.m.t/expected.tags +++ b/Units/review-needed.r/matlab_backtracking.m.t/expected.tags @@ -1 +1,11 @@ backtrack input.m /^function [xn,fn,fcall] = backtrack(xc,d,fc,fnc,DDfnc,c,gamma,eps)$/;" f +cDDfnc input.m /^ cDDfnc = gamma*cDDfnc;$/;" v +cDDfnc input.m /^cDDfnc = c*DDfnc;$/;" v +d input.m /^ d = gamma*d;$/;" v +fcall input.m /^ fcall = fcall+1;$/;" v +fcall input.m /^fcall = 1 ;$/;" v +fn input.m /^ fn = feval(fnc,xn);$/;" v +fn input.m /^fn = feval(fnc,xn);$/;" v +xn input.m /^ xn = xc;$/;" v +xn input.m /^ xn = xc+d;$/;" v +xn input.m /^xn = xc+d;$/;" v diff --git a/Units/review-needed.r/matlab_test.m.t/expected.tags b/Units/review-needed.r/matlab_test.m.t/expected.tags index d54c4735b7..a5ecdeff0c 100644 --- a/Units/review-needed.r/matlab_test.m.t/expected.tags +++ b/Units/review-needed.r/matlab_test.m.t/expected.tags @@ -1,3 +1,5 @@ +A input.m /^A = magic(4);$/;" v +R input.m /^R = randn(3,4,5);$/;" v func1 input.m /^function [x,y,z] = func1 $/;" f func2 input.m /^function x = func2 $/;" f func3 input.m /^function func3 $/;" f diff --git a/Units/review-needed.r/matlab_test.m.t/input.m b/Units/review-needed.r/matlab_test.m.t/input.m index 5bf4885e1b..1b0b235f2a 100644 --- a/Units/review-needed.r/matlab_test.m.t/input.m +++ b/Units/review-needed.r/matlab_test.m.t/input.m @@ -2,3 +2,5 @@ function x = func2 function func3 +A = magic(4); +R = randn(3,4,5); diff --git a/parsers/matlab.c b/parsers/matlab.c index d028c6fe67..fbdaf46a60 100644 --- a/parsers/matlab.c +++ b/parsers/matlab.c @@ -28,6 +28,8 @@ static void installMatLabRegex (const langType language) addTagRegex (language, "^function[ \t]*[a-zA-Z0-9_]+[ \t]*=[ \t]*([a-zA-Z0-9_]+)", "\\1", "f,function", NULL); /* function asdf */ addTagRegex (language, "^function[ \t]*([a-zA-Z0-9_]+)[^=]*$", "\\1", "f,function", NULL); + /* variables */ + addTagRegex (language, "^[ \t]*([a-zA-Z0-9_]+)[ \t]*=[ \t]", "\\1", "v,variable", NULL); } extern parserDefinition* MatLabParser (void)