File: ClassDefinition.m.matlab.styled

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 (74 lines) | stat: -rw-r--r-- 2,244 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
{4}classdef{0} {7}Foo{0} {6}<{0} {7}handle{0}

    {1}% A couple of properties blocks{0}
    {4}properties{0} {6}({7}SetAccess{0} {6}={0} {7}private{6}){0}
        {7}Var1{0}
        {7}Var2{0}
    {4}end{0}

    {4}properties{0}
        {7}Var3{0}
        {7}Var4{0}
    {4}end{0}

    {4}methods{0} {6}({7}Static{6}){0}
        {4}function{0} {7}y{0} {6}={0} {7}f1{6}({7}x{6}){0}
            {1}% events, properties and methods are the valid idenifiers{0}
            {1}% in the function scope{0}
            {7}events{0} {6}={0} {3}1{6};{0}
            {7}properties{0} {6}={0} {3}2{6};{0}
            {7}y{0} {6}={0} {7}x{0} {6}+{0} {7}events{0} {6}*{0} {7}properties{6};{0}
        {4}end{0}

        {1}% Any of these words are also valid functions' names inside{0}
        {1}% methods block{0}
        {4}function{0} {7}y{0} {6}={0} {7}events{6}({7}x{6}){0}
            
            {4}arguments{0}
                {7}x{0} {6}{{7}mustBeNegative{6}}{0}
            {4}end{0}

            {7}y{0} {6}={0} {7}f2{6}({7}x{6})*{3}100{6};{0}
            {4}function{0} {7}b{0} {6}={0} {7}f2{6}({7}a{6}){0}
                {7}b{0} {6}={0} {7}a{0} {6}+{0} {3}5{6};{0}
            {4}end{0}
        {4}end{0}
    {4}end{0}

    {1}% Example events block{0}
    {4}events{0}
        {7}Event1{0}
        {7}Event2{0}
    {4}end{0}
{4}end{0}


{1}% Now, let's break some stuff{0}
{4}classdef{0} {7}Bar{0}

    {4}properties{0}
        {1}% Though MATLAB won't execute such a code, events, properties{0}
        {1}% and methods are keywords here, because we're still in the class scope{0}
        {4}events{0}
        {4}end{0}

        {4}methods{0}
        {4}end{0}        
    {4}end{0}
    
    {1}% Not allowed in MATLAB, but, technically, we're still in the class scope{0}
    {4}if{0} {7}condition1{0}
        {4}if{0} {7}condition2{0}
            {1}% Though we're in the class scope, lexel will recognize no{0}
            {1}% keywords here: to avoid the neccessaty to track nested scopes,{0}
            {1}% it just considers everything beyond level 2 of folding to be{0}
            {1}% a function scope{0}
            {7}methods{0}
            {7}events{0}
            {7}properties{0}
        {4}end{0}
    {4}end{0}


{4}end{0}