Commit from GitHub Actions ()

This commit is contained in:
[Clippy] 2024-07-31 23:32:50 +00:00
parent 5a0656fbe7
commit 020c0a4544
3 changed files with 6 additions and 10 deletions

View file

@ -1,4 +1,4 @@
use crate::{lex::lexer::Lexer, tokens::Token};
use crate::tokens::Token;
struct AST {
nodes: Vec<Node>,

View file

@ -1,4 +1,3 @@
use core::panic;
use crate::lex::lexer::Lexer;
impl Lexer {
@ -37,7 +36,7 @@ impl Lexer {
let mut is_float = false;
let mut is_swizzle = false;
while let Some(c) = self.current_char {
if c.is_digit(10)
if c.is_ascii_digit()
/* && self.peek().unwrap_or_else(|| ' ') == 'f' */
{
number.push(c);
@ -47,7 +46,7 @@ impl Lexer {
//ALLES HIER DRIN IST NICHT SCHÖN//
////////////////////////////////////
match self.peek().unwrap_or_else(|| ' ') {
match self.peek().unwrap_or(' ') {
'x' | 'y' | 'z' | 'w' | 'r' | 'g' | 'b' | 'a' => {
is_swizzle = true;
number.push(c);
@ -68,7 +67,7 @@ impl Lexer {
break;
}
} else if c.is_alphabetic() {
if c == '.' && self.peek().unwrap_or_else(|| ' ') == 'e' {
if c == '.' && self.peek().unwrap_or(' ') == 'e' {
is_float = true;
self.advance();
dbg!("break in alphabetic");
@ -77,7 +76,6 @@ impl Lexer {
is_swizzle = true;
number.push(c);
self.advance();
} else {
}
}
if is_float {

View file

@ -1,9 +1,7 @@
use crate::lex::util::make_symbols;
use crate::tokens::Token;
use std::collections::HashMap;
use std::sync::Arc;
use super::util::make_keywords;
pub struct Lexer {
/// GLSL source
@ -85,7 +83,7 @@ impl Lexer {
tokens.push(Token::Whitespace);
} else if c.is_alphabetic() || c == '_' {
tokens.push(self.consume_identifier_or_keyword());
} else if c.is_digit(10) {
} else if c.is_ascii_digit() {
tokens.push(self.consume_number());
} else if c == '/' && self.peek() == Some('/') {
tokens.push(self.consume_comment());