forked from AbleScript/ablescript
fmt + clippy
This commit is contained in:
parent
6ad0ab5e29
commit
947c2552b1
|
@ -143,26 +143,26 @@ fn get_string(lexer: &mut Lexer<Token>) -> Option<String> {
|
||||||
let mut slice = &lexer.slice()[2..];
|
let mut slice = &lexer.slice()[2..];
|
||||||
while let Some(escape_start) = slice.find('"') {
|
while let Some(escape_start) = slice.find('"') {
|
||||||
// Push predeceasing string
|
// Push predeceasing string
|
||||||
string.push_str(&slice.get(..escape_start)?);
|
string.push_str(slice.get(..escape_start)?);
|
||||||
|
|
||||||
// Move slice behind escape start delimiter
|
// Move slice behind escape start delimiter
|
||||||
slice = &slice.get(escape_start + 1..)?;
|
slice = slice.get(escape_start + 1..)?;
|
||||||
|
|
||||||
// Get escape end delimiter position and parse string before it to
|
// Get escape end delimiter position and parse string before it to
|
||||||
// a character from it's unicode value (base-12) and push it to string
|
// a character from it's unicode value (base-12) and push it to string
|
||||||
let escape_end = slice.find('"')?;
|
let escape_end = slice.find('"')?;
|
||||||
string.push(
|
string.push(
|
||||||
u32::from_str_radix(&slice.get(..escape_end)?, 12)
|
u32::from_str_radix(slice.get(..escape_end)?, 12)
|
||||||
.ok()
|
.ok()
|
||||||
.and_then(char::from_u32)?,
|
.and_then(char::from_u32)?,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Move slice behind escape end delimiter
|
// Move slice behind escape end delimiter
|
||||||
slice = &slice.get(escape_end + 1..)?;
|
slice = slice.get(escape_end + 1..)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push remaining string
|
// Push remaining string
|
||||||
string.push_str(&slice);
|
string.push_str(slice);
|
||||||
lexer.bump(2);
|
lexer.bump(2);
|
||||||
|
|
||||||
Some(string)
|
Some(string)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use crate::{ast::Block, brian::INSTRUCTION_MAPPINGS, consts};
|
||||||
|
use rand::Rng;
|
||||||
use std::{
|
use std::{
|
||||||
cell::{Ref, RefCell, RefMut},
|
cell::{Ref, RefCell, RefMut},
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
|
@ -10,10 +12,6 @@ use std::{
|
||||||
vec,
|
vec,
|
||||||
};
|
};
|
||||||
|
|
||||||
use rand::Rng;
|
|
||||||
|
|
||||||
use crate::{ast::Block, brian::INSTRUCTION_MAPPINGS, consts};
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
||||||
pub enum Abool {
|
pub enum Abool {
|
||||||
Never = -1,
|
Never = -1,
|
||||||
|
|
Loading…
Reference in a new issue