Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

matlab: Parse variables in Matlab cod #571

Merged
merged 1 commit into from
Sep 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Units/matlab-tg-corpus.d/expected.tags
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions Units/noext-tg-matlab.d/expected.tags
Original file line number Diff line number Diff line change
@@ -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
10 changes: 10 additions & 0 deletions Units/review-needed.r/matlab_backtracking.m.t/expected.tags
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions Units/review-needed.r/matlab_test.m.t/expected.tags
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions Units/review-needed.r/matlab_test.m.t/input.m
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
function x = func2
function func3

A = magic(4);
R = randn(3,4,5);
2 changes: 2 additions & 0 deletions parsers/matlab.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down