refactor: formatting
This commit is contained in:
parent
9b75323dc9
commit
23b3ece588
@ -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
|
||||
|
@ -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<'_> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
@ -110,7 +110,7 @@ mod test {
|
||||
|
||||
match result {
|
||||
Ok(_) => panic!("Expected an error"),
|
||||
Err(_) => {},
|
||||
Err(_) => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user