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