Clean up and improve ident parsing

This commit is contained in:
Andrzej Janik 2024-08-15 18:51:11 +02:00
commit dbd37f97ad
3 changed files with 84 additions and 84 deletions

View file

@ -2,9 +2,8 @@ use gen::derive_parser;
use logos::Logos;
use std::mem;
use std::num::{ParseFloatError, ParseIntError};
use winnow::combinator::{alt, empty, fail, opt};
use winnow::stream::SliceLen;
use winnow::token::{any, literal};
use winnow::combinator::*;
use winnow::token::any;
use winnow::{
error::{ContextError, ParserError},
stream::{Offset, Stream, StreamIsPartial},
@ -206,6 +205,8 @@ fn ident<'a, 'input>(stream: &mut ParserState<'a, 'input>) -> PResult<&'input st
any.verify_map(|t| {
if let Token::Ident(text) = t {
Some(text)
} else if let Some(text) = t.opcode_text() {
Some(text)
} else {
None
}
@ -563,7 +564,6 @@ derive_parser!(
pub enum ScalarType { }
// https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#data-movement-and-conversion-instructions-mov
mov.type d, a => {
Instruction::Mov{
data: MovDetails::new(type_.into()),