ptx_parser/parser/instruction/
shr.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::shr::section_0::*;
23
24 impl PtxParser for Type {
29 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
30 alt!(
31 map(string_p(".b16"), |_, _span| Type::B16),
32 map(string_p(".b32"), |_, _span| Type::B32),
33 map(string_p(".b64"), |_, _span| Type::B64),
34 map(string_p(".u16"), |_, _span| Type::U16),
35 map(string_p(".u32"), |_, _span| Type::U32),
36 map(string_p(".u64"), |_, _span| Type::U64),
37 map(string_p(".s16"), |_, _span| Type::S16),
38 map(string_p(".s32"), |_, _span| Type::S32),
39 map(string_p(".s64"), |_, _span| Type::S64)
40 )
41 }
42 }
43
44 impl PtxParser for ShrType {
45 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
46 try_map(
47 seq_n!(
48 string_p("shr"),
49 Type::parse(),
50 GeneralOperand::parse(),
51 comma_p(),
52 GeneralOperand::parse(),
53 comma_p(),
54 GeneralOperand::parse(),
55 semicolon_p()
56 ),
57 |(_, type_, d, _, a, _, b, _), span| {
58 ok!(ShrType {
59 type_ = type_,
60 d = d,
61 a = a,
62 b = b,
63
64 })
65 },
66 )
67 }
68 }
69}