ptx_parser/parser/instruction/
suq.rs1#![allow(unused)]
9
10use crate::parser::{
11 PtxParseError, PtxParser, PtxTokenStream, Span,
12 util::{
13 between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
14 pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
15 },
16};
17use crate::r#type::common::*;
18use crate::{alt, ok, seq_n};
19
20pub mod section_0 {
21 use super::*;
22 use crate::r#type::instruction::suq::section_0::*;
23
24 impl PtxParser for Query {
29 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
30 alt!(
31 map(string_p(".channel_data_type"), |_, _span| {
32 Query::ChannelDataType
33 }),
34 map(string_p(".channel_order"), |_, _span| Query::ChannelOrder),
35 map(string_p(".memory_layout"), |_, _span| Query::MemoryLayout),
36 map(string_p(".array_size"), |_, _span| Query::ArraySize),
37 map(string_p(".height"), |_, _span| Query::Height),
38 map(string_p(".width"), |_, _span| Query::Width),
39 map(string_p(".depth"), |_, _span| Query::Depth)
40 )
41 }
42 }
43
44 impl PtxParser for SuqQueryB32 {
45 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
46 try_map(
47 seq_n!(
48 string_p("suq"),
49 Query::parse(),
50 string_p(".b32"),
51 GeneralOperand::parse(),
52 comma_p(),
53 AddressOperand::parse(),
54 semicolon_p()
55 ),
56 |(_, query, b32, d, _, a, _), span| {
57 ok!(SuqQueryB32 {
58 query = query,
59 b32 = b32,
60 d = d,
61 a = a,
62
63 })
64 },
65 )
66 }
67 }
68}