4 cf_dialect : $ => prec.right(choice(
5 // operation ::= `cf.assert` $arg `,` $msg attr-dict
6 seq('cf.assert', field('argument', $.value_use), ',',
7 field('message', $.string_literal),
8 field('attributes', optional($.attribute))),
10 // operation ::= `cf.br` $dest (`(` $destOperands^ `:`
11 // type($destOperands) `)`)? attr-dict
12 seq('cf.br', field('successor', $.successor),
13 field('attributes', optional($.attribute))),
15 // operation ::= `cf.cond_br` $condition `,`
16 // $trueDest(`(` $trueDestOperands ^ `:`
17 // type($trueDestOperands)`)`)? `,`
18 // $falseDest(`(` $falseDestOperands ^ `:`
19 // type($falseDestOperands)`)`)? attr-dict
20 seq('cf.cond_br', field('condition', $.value_use), ',',
21 field('trueblk', $.successor), ',',
22 field('falseblk', $.successor),
23 field('attributes', optional($.attribute))),
25 // operation ::= `cf.switch` $flag `:` type($flag) `,` `[` `\n`
26 // custom<SwitchOpCases>(ref(type($flag)),$defaultDestination,
28 // type($defaultOperands),
32 // type($caseOperands))
35 seq('cf.switch', field('flag', $._value_use_and_type), ',',
36 '[', $.cf_case_label, $.successor,
37 repeat(seq(',', $.cf_case_label, $.successor)), ']',
38 field('attributes', optional($.attribute))),
41 cf_case_label : $ => seq(choice($.integer_literal, token('default')), ':')