ptx_parser/parser/instruction/
isspacep.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::isspacep::section_0::*;
21
22 impl PtxParser for Space {
27 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
28 alt!(
29 map(string_p(".shared::cluster"), |_, _span| {
30 Space::SharedCluster
31 }),
32 map(string_p(".param::entry"), |_, _span| Space::ParamEntry),
33 map(string_p(".shared::cta"), |_, _span| Space::SharedCta),
34 map(string_p(".global"), |_, _span| Space::Global),
35 map(string_p(".shared"), |_, _span| Space::Shared),
36 map(string_p(".const"), |_, _span| Space::Const),
37 map(string_p(".local"), |_, _span| Space::Local),
38 map(string_p(".param"), |_, _span| Space::Param)
39 )
40 }
41 }
42
43 impl PtxParser for IsspacepSpace {
44 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
45 try_map(
46 seq_n!(
47 string_p("isspacep"),
48 Space::parse(),
49 GeneralOperand::parse(),
50 comma_p(),
51 GeneralOperand::parse(),
52 semicolon_p()
53 ),
54 |(_, space, p, _, a, _), span| {
55 ok!(IsspacepSpace {
56 space = space,
57 p = p,
58 a = a,
59
60 })
61 },
62 )
63 }
64 }
65}