ptx_parser/parser/instruction/
prmt.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::prmt::section_0::*;
21
22 impl PtxParser for Mode {
27 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
28 alt!(
29 map(string_p(".rc16"), |_, _span| Mode::Rc16),
30 map(string_p(".f4e"), |_, _span| Mode::F4e),
31 map(string_p(".b4e"), |_, _span| Mode::B4e),
32 map(string_p(".rc8"), |_, _span| Mode::Rc8),
33 map(string_p(".ecl"), |_, _span| Mode::Ecl),
34 map(string_p(".ecr"), |_, _span| Mode::Ecr)
35 )
36 }
37 }
38
39 impl PtxParser for PrmtB32Mode {
40 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
41 try_map(
42 seq_n!(
43 string_p("prmt"),
44 string_p(".b32"),
45 optional(Mode::parse()),
46 GeneralOperand::parse(),
47 comma_p(),
48 GeneralOperand::parse(),
49 comma_p(),
50 GeneralOperand::parse(),
51 comma_p(),
52 GeneralOperand::parse(),
53 semicolon_p()
54 ),
55 |(_, b32, mode, d, _, a, _, b, _, c, _), span| {
56 ok!(PrmtB32Mode {
57 b32 = b32,
58 mode = mode,
59 d = d,
60 a = a,
61 b = b,
62 c = c,
63
64 })
65 },
66 )
67 }
68 }
69}