ptx_parser/unparser/instruction/
vote.rs1#![allow(unused)]
8
9use crate::lexer::PtxToken;
10use crate::unparser::{PtxUnparser, common::*};
11
12pub mod section_0 {
13 use super::*;
14 use crate::r#type::instruction::vote::section_0::*;
15
16 impl PtxUnparser for VoteModePred {
17 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
18 self.unparse_tokens_mode(tokens, false);
19 }
20 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
21 push_opcode(tokens, "vote");
22 match &self.mode {
23 Mode::All => {
24 push_directive(tokens, "all");
25 }
26 Mode::Any => {
27 push_directive(tokens, "any");
28 }
29 Mode::Uni => {
30 push_directive(tokens, "uni");
31 }
32 }
33 push_directive(tokens, "pred");
34 if spaced {
35 tokens.push(PtxToken::Space);
36 }
37 self.d.unparse_tokens_mode(tokens, spaced);
38 tokens.push(PtxToken::Comma);
39 if self.a_op {
40 tokens.push(PtxToken::Exclaim);
41 }
42 if spaced {
43 tokens.push(PtxToken::Space);
44 }
45 self.a.unparse_tokens_mode(tokens, spaced);
46 tokens.push(PtxToken::Semicolon);
47 if spaced {
48 tokens.push(PtxToken::Newline);
49 }
50 }
51 }
52
53 impl PtxUnparser for VoteBallotB32 {
54 fn unparse_tokens(&self, tokens: &mut ::std::vec::Vec<PtxToken>) {
55 self.unparse_tokens_mode(tokens, false);
56 }
57 fn unparse_tokens_mode(&self, tokens: &mut ::std::vec::Vec<PtxToken>, spaced: bool) {
58 push_opcode(tokens, "vote");
59 push_directive(tokens, "ballot");
60 push_directive(tokens, "b32");
61 if spaced {
62 tokens.push(PtxToken::Space);
63 }
64 self.d.unparse_tokens_mode(tokens, spaced);
65 tokens.push(PtxToken::Comma);
66 if self.a_op {
67 tokens.push(PtxToken::Exclaim);
68 }
69 if spaced {
70 tokens.push(PtxToken::Space);
71 }
72 self.a.unparse_tokens_mode(tokens, spaced);
73 tokens.push(PtxToken::Semicolon);
74 if spaced {
75 tokens.push(PtxToken::Newline);
76 }
77 }
78 }
79}