ptx_parser/parser/instruction/
elect_sync.rs

1//! Original PTX specification:
2//!
3//! elect.sync d|p, membermask;
4
5#![allow(unused)]
6
7use crate::parser::{
8    PtxParseError, PtxParser, PtxTokenStream, Span,
9    util::{
10        between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
11        pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
12    },
13};
14use crate::r#type::common::*;
15use crate::{alt, ok, seq_n};
16
17pub mod section_0 {
18    use super::*;
19    use crate::r#type::instruction::elect_sync::section_0::*;
20
21    impl PtxParser for ElectSync {
22        fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
23            try_map(
24                seq_n!(
25                    string_p("elect"),
26                    string_p(".sync"),
27                    GeneralOperand::parse(),
28                    pipe_p(),
29                    GeneralOperand::parse(),
30                    comma_p(),
31                    GeneralOperand::parse(),
32                    semicolon_p()
33                ),
34                |(_, sync, d, _, p, _, membermask, _), span| {
35                    ok!(ElectSync {
36                        sync = sync,
37                        d = d,
38                        p = p,
39                        membermask = membermask,
40
41                    })
42                },
43            )
44        }
45    }
46}