ptx_parser/parser/instruction/
griddepcontrol.rs

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