summaryrefslogtreecommitdiffstats
path: root/debian/uncrustify-trinity/uncrustify-trinity-0.73.0/tests/input/pawn/comment.p
blob: 785521ac25601f4385328f617f133dd6e814c6f6 (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
/* parse C comments interactively, using events and a state machine */
main()
    state plain
@keypressed(key) <plain>
    {
    state (key == '/') slash
    if (key != '/')
        echo key
    }
@keypressed(key) <slash>
    {
    state (key != '/') plain
    state (key == '*') comment
    echo '/'    /* print '/' held back from previous state */
    if (key != '/')
        echo key
    }
@keypressed(key) <comment>
    {
    echo key
    state (key == '*') star
    }
@keypressed(key) <star>
    {
    echo key
    state (key != '*') comment
    state (key == '/') plain
    }
echo(key) <plain, slash>
    printchar key, yellow
echo(key) <comment, star>
    printchar key, green
printchar(ch, colour)
    {
    setattr .foreground = colour
    printf "%c", ch
    }