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