summaryrefslogtreecommitdiff
path: root/tnslc/tests/simple/comments.tnsl
blob: dbece20c3162707f645fc8cf378f8d22924013a7 (plain)
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
# These are tests for where comments may be located
# as well as the type of comments that may be parsed.
# A '#' denotes a single line comment, and will
# ignore everything on the line.
# '/#' denotes the start of a multi line comment
# if you want to use '#/' (the end of a multiline comment)
# inside of a multiline comment, use '#' at the start of the line
# to escape the whole line.

/#
    This is an example
    of a multiline comment.
#/

/#
#  This is also a multiline comment
#  however, you can use #/
#  inside of it because we have '#' at
#  the start of each line
#/

/##
#    This is an example of a doc comment.
#    It is a doc comment of a code block because it starts with '/##' instead of '/#'
#    and ends with '# ;' which ends the comment and opens a block.
#    This doc comment is on the main function
#; main /# Comment inside function declaration #/ [int /# Comment inside this list of outputs #/ ]
    return 0 # line comment inside a function
    /# Block comment inside function #/
;/

/# Comment before block opens #/ /; interface /# Comment in interface block definition #/ ITest
    # Comment in interface block
    /; test_method [int] ;/
/# Comment before block closes #/ ;/

struct Test {
    # comment inside a list of member variables
    int /# Comment btwn type and variable name #/ i
}

/; method /# Comment in method block definition #/ Test
    # Comment in method block
    /; /# Comment before method name#/ test_method (/# Comment inside function params #/) [/# comment inside return type again#/ int]
/# Comment at start of line before statement#/ return /# Comment btwn return and value #/ i
    ;/

    /; cf_comment [int]

    ;/
;/