Skip to content

Commit

Permalink
Units,MatLab: new for set and get methods
Browse files Browse the repository at this point in the history
Tag returned should be
   get.myproperty f
   set.myproperty f

(@masatake added --sort=no.)
  • Loading branch information
Dave authored and masatake committed Jul 17, 2023
1 parent bf2b6d7 commit a53c1e2
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Units/parser-matlab.r/matlab_setget.m.d/args.ctags
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
--sort=no

16 changes: 16 additions & 0 deletions Units/parser-matlab.r/matlab_setget.m.d/expected.tags
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
input input.m /^classdef input < handle$/;" c
get.myproperty input.m /^ function out=get.myproperty(obj)$/;" f
set.myproperty input.m /^ function out=set.myproperty(obj,val)$/;" f
classfunc1 input.m /^ function [x,y,z] = classfunc1$/;" f
classfunc2 input.m /^ function x = classfunc2()$/;" f
x input.m /^ x = func2(1);$/;" v
classfunc3 input.m /^ function classfunc3;$/;" f
func1 input.m /^function [x,y,z] = func1() % Silly function with multiple outputs$/;" f
x input.m /^ x = 1;$/;" v
y input.m /^ y = 2;$/;" v
z input.m /^ z = 3;$/;" v
func2 input.m /^function x = func2(arg)$/;" f
x input.m /^ x = arg;$/;" v
func3 input.m /^function func3()$/;" f
A input.m /^ A = magic(4);$/;" v
R input.m /^ R = randn(3,4,5);$/;" v
1 change: 1 addition & 0 deletions Units/parser-matlab.r/matlab_setget.m.d/features
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
regex
45 changes: 45 additions & 0 deletions Units/parser-matlab.r/matlab_setget.m.d/input.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
classdef input < handle
properties
myproperty
end
properties(Hidden)
myproperty_
end
function out=get.myproperty(obj)
out=myproperty_;
end
function out=set.myproperty(obj,val)
myproperty_=val;
end
methods(Static)
function [x,y,z] = classfunc1
[x, y, z] = func1();
end
function x = classfunc2()
x = func2(1);
end
function classfunc3;
func3();
end
end
end

function [x,y,z] = func1() % Silly function with multiple outputs
x = 1;
y = 2;
z = 3;
end
function x = func2(arg)
x = arg;
end
function func3()
% Silly function without any arguments
A = magic(4);
R = randn(3,4,5);

disp('A:');
disp(A);

disp('R:');
disp(R);
end

0 comments on commit a53c1e2

Please sign in to comment.