ptx_parser/parser/instruction/
bra.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::bra::section_0::*;
21
22 impl PtxParser for BraUni {
23 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
24 try_map(
25 seq_n!(
26 string_p("bra"),
27 map(optional(string_p(".uni")), |value, _| value.is_some()),
28 GeneralOperand::parse(),
29 semicolon_p()
30 ),
31 |(_, uni, tgt, _), span| {
32 ok!(BraUni {
33 uni = uni,
34 tgt = tgt,
35
36 })
37 },
38 )
39 }
40 }
41
42 impl PtxParser for BraUni1 {
43 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
44 try_map(
45 seq_n!(
46 string_p("bra"),
47 map(optional(string_p(".uni")), |value, _| value.is_some()),
48 GeneralOperand::parse(),
49 semicolon_p()
50 ),
51 |(_, uni, tgt, _), span| {
52 ok!(BraUni1 {
53 uni = uni,
54 tgt = tgt,
55
56 })
57 },
58 )
59 }
60 }
61}