forked from github-linguist/linguist
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github-linguist#162 from horchler/detect-matlab
More robust heuristics for .m files and 3 new Matlab tests. Finally.
- Loading branch information
Showing
5 changed files
with
90 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
classdef matlab_class | ||
properties | ||
R; | ||
G; | ||
B; | ||
end | ||
methods | ||
function obj = matlab_class(r,g,b) | ||
obj.R = r; | ||
obj.G = g; | ||
obj.B = b; | ||
end | ||
function disp(obj) | ||
disp(['Red: ' num2str(obj.R) ... | ||
', Green: ' num2str(obj.G) ... | ||
', Blue: ' num2str(obj.B)]); | ||
end | ||
end | ||
enumeration | ||
red (1,0,0) | ||
green (0,1,0) | ||
blue (0,0,1) | ||
cyan (0,1,1) | ||
magenta (1,0,1) | ||
yellow (1,1,0) | ||
black (0,0,0) | ||
white (1,1,1) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function ret = matlab_function2(A,B) | ||
% Simple function that combines two values using function handles and displays | ||
% the return value | ||
|
||
% create function handles | ||
fun1=@interface; | ||
fun2=@implementation; | ||
fun3=@property; | ||
fun4=@synthesize; | ||
|
||
% use function handles | ||
ret = fun1(A)+fun2(A)+fun3(B)+fun4(B); | ||
|
||
% Display the return value | ||
disp('Return value in function'); | ||
disp(ret); | ||
|
||
|
||
function A=interface(A) | ||
% simple sub-function with same name Objective-C @keyword | ||
A=2*A; | ||
|
||
function A=implementation(A) | ||
% simple sub-function with same name Objective-C @keyword | ||
A=A^2; | ||
|
||
function B=property(B) | ||
% simple sub-function with same name Objective-C @keyword | ||
B=2*B; | ||
|
||
function B=synthesize(B) | ||
% simple sub-function with same name Objective-C @keyword | ||
B=B^2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
% Matlab example script 2 | ||
% Comments precended with arbitrary whitespace (spaces or tabs) | ||
|
||
%Call matlab_function function which resides in the same directory | ||
|
||
value1 = 5 % semicolon at end of line is not mandatory, only suppresses output to command line. | ||
value2 = 3 | ||
|
||
% Calculate sum of value1 and value2 | ||
result = matlab_function(value1,value2); | ||
|
||
disp('called from script') | ||
disp(result); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters