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 { struct AST {
nodes: Vec<Node>, nodes: Vec<Node>,

View file

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

View file

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