ptx_parser/parser/instruction/
mapa.rs1#![allow(unused)]
16
17use crate::parser::{
18 PtxParseError, PtxParser, PtxTokenStream, Span,
19 util::{
20 between, comma_p, directive_p, exclamation_p, lbracket_p, lparen_p, map, minus_p, optional,
21 pipe_p, rbracket_p, rparen_p, semicolon_p, sep_by, string_p, try_map,
22 },
23};
24use crate::r#type::common::*;
25use crate::{alt, ok, seq_n};
26
27pub mod section_0 {
28 use super::*;
29 use crate::r#type::instruction::mapa::section_0::*;
30
31 impl PtxParser for Space {
36 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
37 alt!(map(string_p(".shared::cluster"), |_, _span| {
38 Space::SharedCluster
39 }))
40 }
41 }
42
43 impl PtxParser for Type {
44 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
45 alt!(
46 map(string_p(".u32"), |_, _span| Type::U32),
47 map(string_p(".u64"), |_, _span| Type::U64)
48 )
49 }
50 }
51
52 impl PtxParser for MapaSpaceType {
53 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
54 try_map(
55 seq_n!(
56 string_p("mapa"),
57 optional(Space::parse()),
58 Type::parse(),
59 GeneralOperand::parse(),
60 comma_p(),
61 GeneralOperand::parse(),
62 comma_p(),
63 GeneralOperand::parse(),
64 semicolon_p()
65 ),
66 |(_, space, type_, d, _, a, _, b, _), span| {
67 ok!(MapaSpaceType {
68 space = space,
69 type_ = type_,
70 d = d,
71 a = a,
72 b = b,
73
74 })
75 },
76 )
77 }
78 }
79}