File: ifstatement

package info (click to toggle)
icmake 13.05.01-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,132 kB
  • sloc: cpp: 11,595; fortran: 883; makefile: 853; sh: 546; pascal: 342
file content (51 lines) | stat: -rw-r--r-- 838 bytes parent folder | download | duplicates (3)
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
if_:
    IF
    {
        push();
    }
;

ifElse_:
    ELSE
    {
        semValPopPush();
    }
;

ifStatementElse_:
    ifElse_ statement
    {
        $$ = move($2);
    }
|
    {
        $$ = SemVal{};
    }
;

ifCond_:
    condition
    {
        $$ = Args{ $1 };
    }
|
    ';' condition
    {
        $$ = Args{ $2 };
    }
|
    flowInit ';' condition
    {
        $$ = move($1.add($3));  // $$ contains "if ('init'; cond)" 
                                // initialization list + the condition as
                                // final Args element.
    }
;

ifStatement:      //  condition: $4, statement: $8, ifStatementElse: $9
    if_ '(' syntaxExpression ifCond_ syntaxCloseParen ')' syntaxExpression
        statement ifStatementElse_
    {
        $$ = ifStmnt($4, $8, $9);       // also does d_dymtab.pop()
    }
;