fmt + clippy
This commit is contained in:
parent
d004955c4e
commit
a9fdff0663
|
@ -168,7 +168,7 @@ pub enum Expr {
|
|||
Variable(String),
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
|
||||
pub enum Literal {
|
||||
Char(char),
|
||||
Int(isize),
|
||||
|
@ -185,7 +185,7 @@ impl From<Literal> for Value {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Hash)]
|
||||
pub enum BinOpKind {
|
||||
Add,
|
||||
Subtract,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use logos::{Lexer, Logos};
|
||||
|
||||
#[derive(Logos, Debug, PartialEq, Clone)]
|
||||
#[derive(Logos, Debug, PartialEq, Eq, Clone)]
|
||||
pub enum Token {
|
||||
// Symbols
|
||||
#[token("(")]
|
||||
|
@ -104,7 +104,7 @@ pub enum Token {
|
|||
/// Run at the end of the program
|
||||
#[token("finally")]
|
||||
Finally,
|
||||
|
||||
|
||||
/// Crash with random error (see discussion #17)
|
||||
#[token("rlyeh")]
|
||||
Rlyeh,
|
||||
|
|
|
@ -2,6 +2,8 @@ use super::ValueRef;
|
|||
use crate::ast::Block;
|
||||
use std::{hash::Hash, rc::Rc};
|
||||
|
||||
type BuiltinRc = Rc<dyn Fn(&[ValueRef]) -> Result<(), crate::error::ErrorKind>>;
|
||||
|
||||
/// AbleScript Function
|
||||
#[derive(Debug, PartialEq, Clone, Hash)]
|
||||
pub enum Functio {
|
||||
|
@ -49,13 +51,13 @@ impl Functio {
|
|||
/// Built-in Rust functio
|
||||
#[derive(Clone)]
|
||||
pub struct BuiltinFunctio {
|
||||
pub(super) function: Rc<dyn Fn(&[ValueRef]) -> Result<(), crate::error::ErrorKind>>,
|
||||
pub(super) function: BuiltinRc,
|
||||
pub(super) arity: usize,
|
||||
}
|
||||
|
||||
impl BuiltinFunctio {
|
||||
/// Wrap a Rust function into AbleScript's built-in functio
|
||||
///
|
||||
///
|
||||
/// Arity used for functio chaining, recommend value for variadic
|
||||
/// functions is the accepted minimum.
|
||||
pub fn new<F>(f: F, arity: usize) -> Self
|
||||
|
@ -100,7 +102,7 @@ impl Hash for BuiltinFunctio {
|
|||
}
|
||||
|
||||
/// A method of distributting parameters across functio chain
|
||||
#[derive(Debug, PartialEq, Copy, Clone, Hash)]
|
||||
#[derive(Debug, PartialEq, Eq, Copy, Clone, Hash)]
|
||||
pub enum FunctioChainKind {
|
||||
/// All parameters are equally distributed
|
||||
Equal,
|
||||
|
|
|
@ -58,7 +58,7 @@ impl Value {
|
|||
}
|
||||
|
||||
/// Three-state logic value
|
||||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd)]
|
||||
pub enum Abool {
|
||||
Never = -1,
|
||||
Sometimes = 0,
|
||||
|
@ -163,7 +163,7 @@ impl Display for Value {
|
|||
}
|
||||
|
||||
/// Runtime borrow-checked, counted reference to a [Value]
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct ValueRef(Rc<RefCell<Value>>);
|
||||
|
||||
impl ValueRef {
|
||||
|
|
Loading…
Reference in a new issue