ptx_parser/parser/instruction/
applypriority.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::applypriority::section_0::*;
21
22 impl PtxParser for LevelEvictionPriority {
27 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
28 alt!(map(string_p(".L2::evict_normal"), |_, _span| {
29 LevelEvictionPriority::L2EvictNormal
30 }))
31 }
32 }
33
34 impl PtxParser for ApplypriorityGlobalLevelEvictionPriority {
35 fn parse() -> impl Fn(&mut PtxTokenStream) -> Result<(Self, Span), PtxParseError> {
36 try_map(
37 seq_n!(
38 string_p("applypriority"),
39 map(optional(string_p(".global")), |value, _| value.is_some()),
40 LevelEvictionPriority::parse(),
41 AddressOperand::parse(),
42 comma_p(),
43 GeneralOperand::parse(),
44 semicolon_p()
45 ),
46 |(_, global, level_eviction_priority, a, _, size, _), span| {
47 ok!(ApplypriorityGlobalLevelEvictionPriority {
48 global = global,
49 level_eviction_priority = level_eviction_priority,
50 a = a,
51 size = size,
52
53 })
54 },
55 )
56 }
57 }
58}