File: ClassDefinition.m.matlab.folded

package info (click to toggle)
codequery 1.0.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 17,860 kB
  • sloc: cpp: 151,420; xml: 16,576; python: 5,602; ansic: 5,487; makefile: 559; perl: 496; ruby: 209; sql: 194; sh: 106; php: 53; vhdl: 51; erlang: 47; objc: 22; lisp: 18; cobol: 18; modula3: 17; asm: 14; fortran: 12; ml: 11; tcl: 6
file content (75 lines) | stat: -rw-r--r-- 2,577 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
 2 400 401 + classdef Foo < handle
 1 401 401 | 
 0 401 401 |     % A couple of properties blocks
 2 401 402 +     properties (SetAccess = private)
 0 402 402 |         Var1
 0 402 402 |         Var2
 0 402 401 |     end
 1 401 401 | 
 2 401 402 +     properties
 0 402 402 |         Var3
 0 402 402 |         Var4
 0 402 401 |     end
 1 401 401 | 
 2 401 402 +     methods (Static)
 2 402 403 +         function y = f1(x)
 0 403 403 |             % events, properties and methods are the valid idenifiers
 0 403 403 |             % in the function scope
 0 403 403 |             events = 1;
 0 403 403 |             properties = 2;
 0 403 403 |             y = x + events * properties;
 0 403 402 |         end
 1 402 402 | 
 0 402 402 |         % Any of these words are also valid functions' names inside
 0 402 402 |         % methods block
 2 402 403 +         function y = events(x)
 1 403 403 |             
 2 403 404 +             arguments
 0 404 404 |                 x {mustBeNegative}
 0 404 403 |             end
 1 403 403 | 
 0 403 403 |             y = f2(x)*100;
 2 403 404 +             function b = f2(a)
 0 404 404 |                 b = a + 5;
 0 404 403 |             end
 0 403 402 |         end
 0 402 401 |     end
 1 401 401 | 
 0 401 401 |     % Example events block
 2 401 402 +     events
 0 402 402 |         Event1
 0 402 402 |         Event2
 0 402 401 |     end
 0 401 400 | end
 1 400 400   
 1 400 400   
 0 400 400   % Now, let's break some stuff
 2 400 401 + classdef Bar
 1 401 401 | 
 2 401 402 +     properties
 0 402 402 |         % Though MATLAB won't execute such a code, events, properties
 0 402 402 |         % and methods are keywords here, because we're still in the class scope
 2 402 403 +         events
 0 403 402 |         end
 1 402 402 | 
 2 402 403 +         methods
 0 403 402 |         end        
 0 402 401 |     end
 1 401 401 |     
 0 401 401 |     % Not allowed in MATLAB, but, technically, we're still in the class scope
 2 401 402 +     if condition1
 2 402 403 +         if condition2
 0 403 403 |             % Though we're in the class scope, lexel will recognize no
 0 403 403 |             % keywords here: to avoid the neccessaty to track nested scopes,
 0 403 403 |             % it just considers everything beyond level 2 of folding to be
 0 403 403 |             % a function scope
 0 403 403 |             methods
 0 403 403 |             events
 0 403 403 |             properties
 0 403 402 |         end
 0 402 401 |     end
 1 401 401 | 
 1 401 401 | 
 0 401 400 | end
 1 400 400   
 1 400 400