#![allow(unused)]
use crate::lexer::PtxToken;
use crate::parser::{PtxParseError, PtxParser, PtxTokenStream, Span};
use crate::r#type::common::*;
pub mod section_0 {
use super::*;
use crate::r#type::instruction::clz::section_0::*;
impl PtxParser for Type {
fn parse(stream: &mut PtxTokenStream) -> Result<Self, PtxParseError> {
{
let saved_pos = stream.position();
if stream.expect_string(".b32").is_ok() {
return Ok(Type::B32);
}
stream.set_position(saved_pos);
}
let saved_pos = stream.position();
{
let saved_pos = stream.position();
if stream.expect_string(".b64").is_ok() {
return Ok(Type::B64);
}
stream.set_position(saved_pos);
}
stream.set_position(saved_pos);
let span = stream
.peek()
.map(|(_, s)| s.clone())
.unwrap_or(Span { start: 0, end: 0 });
let expected = &[".b32", ".b64"];
let found = stream
.peek()
.map(|(t, _)| format!("{:?}", t))
.unwrap_or_else(|_| "<end of input>".to_string());
Err(crate::parser::unexpected_value(span, expected, found))
}
}
impl PtxParser for ClzType {
fn parse(stream: &mut PtxTokenStream) -> Result<Self, PtxParseError> {
stream.expect_string("clz")?;
let type_ = Type::parse(stream)?;
stream.expect_complete()?;
let d = GeneralOperand::parse(stream)?;
stream.expect_complete()?;
stream.expect(&PtxToken::Comma)?;
let a = GeneralOperand::parse(stream)?;
stream.expect_complete()?;
stream.expect_complete()?;
stream.expect(&PtxToken::Semicolon)?;
Ok(ClzType { type_, d, a })
}
}
}