refactor: formatting

This commit is contained in:
Araozu 2024-07-30 15:55:29 -05:00
parent 9b75323dc9
commit 23b3ece588
5 changed files with 18 additions and 17 deletions

View File

@ -26,7 +26,7 @@
## v0.0.15
- [x] Multiline comments
- [ ] Nested multiline comments
- [x] Nested multiline comments
- [ ] Include comments in the AST
- [ ] Replace all panics with actual errors
- [ ] Remove all old codegen

View File

@ -20,7 +20,8 @@ impl Transpilable for PhpStatement<'_> {
fn transpile(&self) -> String {
match self {
PhpStatement::PhpEchoStatement(expr_list) => {
let expressions_vec = expr_list.expressions
let expressions_vec = expr_list
.expressions
.iter()
.map(|e| e.transpile())
.collect::<Vec<_>>();
@ -46,5 +47,3 @@ impl Transpilable for PhpExpression<'_> {
}
}
}

View File

@ -56,18 +56,17 @@ fn multiline_impl(chars: &Vec<char>, start_pos: usize) -> Option<(Vec<char>, usi
loop {
match chars.get(current_position) {
Some('/') => {
match chars.get(current_position + 1) {
Some('*') => {
// Scan nested comment
let (mut nested, next_position) = match multiline_impl(chars, current_position + 2)
{
Some(v) => v,
None => {
// The nested comment is not closed.
return None;
}
};
let (mut nested, next_position) =
match multiline_impl(chars, current_position + 2) {
Some(v) => v,
None => {
// The nested comment is not closed.
return None;
}
};
result.push('/');
result.push('*');
result.append(&mut nested);

View File

@ -110,7 +110,7 @@ mod test {
match result {
Ok(_) => panic!("Expected an error"),
Err(_) => {},
Err(_) => {}
}
}
}

View File

@ -80,7 +80,10 @@ pub fn parse_token_type(
mod tests {
use crate::{
lexic::{get_tokens, token::TokenType},
syntax::{parseable::ParsingError, utils::{parse_token_type, Tokenizer}},
syntax::{
parseable::ParsingError,
utils::{parse_token_type, Tokenizer},
},
};
use super::try_operator;
@ -133,7 +136,7 @@ mod tests {
match tokens.get_significant(10) {
Some(_) => panic!("Expected a None"),
None => {},
None => {}
}
}
}