ptx_parser/parser/instruction/
bmsk.rs1#![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::bmsk::section_0::*;
21
22 impl PtxParser for Mode {
27 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
28 alt!(
29 map(string_p(".clamp"), |_, _span| Mode::Clamp),
30 map(string_p(".wrap"), |_, _span| Mode::Wrap)
31 )
32 }
33 }
34
35 impl PtxParser for BmskModeB32 {
36 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
37 try_map(
38 seq_n!(
39 string_p("bmsk"),
40 Mode::parse(),
41 string_p(".b32"),
42 GeneralOperand::parse(),
43 comma_p(),
44 GeneralOperand::parse(),
45 comma_p(),
46 GeneralOperand::parse(),
47 semicolon_p()
48 ),
49 |(_, mode, b32, d, _, a, _, b, _), span| {
50 ok!(BmskModeB32 {
51 mode = mode,
52 b32 = b32,
53 d = d,
54 a = a,
55 b = b,
56
57 })
58 },
59 )
60 }
61 }
62}