mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-06-25 04:01:51 +02:00
v1.0.1
This commit is contained in:
parent
6d3065a3e0
commit
1b0496ea67
@ -9,11 +9,11 @@ license = "MIT"
|
||||
name = "kalker"
|
||||
readme = "../README.md"
|
||||
repository = "https://github.com/PaddiM8/kalker"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
|
||||
[dependencies]
|
||||
ansi_term = "0.12.1"
|
||||
kalk = { path = "../kalk", version = "^2.1.0" }
|
||||
kalk = { path = "../kalk", version = "^2.1.2" }
|
||||
lazy_static = "1.4.0"
|
||||
regex = "1"
|
||||
rustyline = "7.1.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "kalk"
|
||||
version = "2.1.1"
|
||||
version = "2.1.2"
|
||||
authors = ["PaddiM8"]
|
||||
edition = "2018"
|
||||
readme = "README.md"
|
||||
|
@ -309,7 +309,7 @@ pub(crate) fn eval_fn_call_expr(
|
||||
|
||||
// Special functions
|
||||
match identifier.full_name.as_ref() {
|
||||
"sum" | "Σ" | "∑" | "prod" | "∏" => {
|
||||
"sum" | "prod" => {
|
||||
// Make sure exactly 3 arguments were supplied.
|
||||
if expressions.len() != 3 {
|
||||
return Err(CalcError::IncorrectAmountOfArguments(
|
||||
@ -323,10 +323,7 @@ pub(crate) fn eval_fn_call_expr(
|
||||
let end = eval_expr(context, &expressions[1], "")?.to_f64() as i128;
|
||||
let sum_else_prod = match identifier.full_name.as_ref() {
|
||||
"sum" => true,
|
||||
"Σ" => true,
|
||||
"∑" => true,
|
||||
"prod" => false,
|
||||
"∏" => false,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let mut sum = if sum_else_prod {
|
||||
@ -352,7 +349,7 @@ pub(crate) fn eval_fn_call_expr(
|
||||
|
||||
return Ok(sum);
|
||||
}
|
||||
"integrate" | "integral" | "∫" => {
|
||||
"integrate" => {
|
||||
// Make sure either 3 or 4 arguments were supplied.
|
||||
if expressions.len() < 3 || expressions.len() > 4 {}
|
||||
|
||||
|
@ -138,12 +138,12 @@ impl<'a> Lexer<'a> {
|
||||
'≤' => build(TokenKind::LessOrEquals, "", span),
|
||||
// Some of the special symbols will be lexed here,
|
||||
// so that they don't merge with other symbols.
|
||||
'π' => build(TokenKind::Identifier, "π", span),
|
||||
'√' => build(TokenKind::Identifier, "√", span),
|
||||
'τ' => build(TokenKind::Identifier, "τ", span),
|
||||
'ϕ' => build(TokenKind::Identifier, "ϕ", span),
|
||||
'Γ' => build(TokenKind::Identifier, "Γ", span),
|
||||
'∏' => build(TokenKind::Identifier, "Γ", span),
|
||||
'π' => build(TokenKind::Identifier, "pi", span),
|
||||
'√' => build(TokenKind::Identifier, "sqrt", span),
|
||||
'τ' => build(TokenKind::Identifier, "tau", span),
|
||||
'ϕ' => build(TokenKind::Identifier, "phi", span),
|
||||
'Γ' => build(TokenKind::Identifier, "gamma", span),
|
||||
'∏' => build(TokenKind::Identifier, "prod", span),
|
||||
_ => build(TokenKind::Unknown, "", span),
|
||||
};
|
||||
|
||||
@ -234,9 +234,12 @@ impl<'a> Lexer<'a> {
|
||||
_ => TokenKind::Identifier,
|
||||
};
|
||||
|
||||
if &value == "°" {
|
||||
value = String::from("deg");
|
||||
}
|
||||
let value = match value.as_ref() {
|
||||
"Σ" | "∑" => String::from("sum"),
|
||||
"∫" => String::from("integrate"),
|
||||
"°" => String::from("deg"),
|
||||
_ => value,
|
||||
};
|
||||
|
||||
build(kind, &value, (start, end))
|
||||
}
|
||||
|
@ -31,10 +31,6 @@ lazy_static! {
|
||||
"pi",
|
||||
3.1415926535897932384626433832795028841971693993751058209749445923,
|
||||
);
|
||||
m.insert(
|
||||
"π",
|
||||
3.1415926535897932384626433832795028841971693993751058209749445923,
|
||||
);
|
||||
m.insert(
|
||||
"e",
|
||||
2.7182818284590452353602874713526624977572470936999595749669676277,
|
||||
@ -43,18 +39,10 @@ lazy_static! {
|
||||
"tau",
|
||||
6.2831853071795864769252867665590057683943387987502116419498891846,
|
||||
);
|
||||
m.insert(
|
||||
"τ",
|
||||
6.2831853071795864769252867665590057683943387987502116419498891846,
|
||||
);
|
||||
m.insert(
|
||||
"phi",
|
||||
1.6180339887498948482045868343656381177203091798057628621354486227,
|
||||
);
|
||||
m.insert(
|
||||
"ϕ",
|
||||
1.6180339887498948482045868343656381177203091798057628621354486227,
|
||||
);
|
||||
m
|
||||
};
|
||||
pub static ref UNARY_FUNCS: HashMap<&'static str, (UnaryFuncInfo, &'static str)> = {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "kalk_mobile",
|
||||
"version": "1.0.1",
|
||||
"version": "1.0.2",
|
||||
"description": "kalk mobile",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
@ -16,7 +16,7 @@
|
||||
"@capacitor/android": "^2.4.5",
|
||||
"@capacitor/cli": "^2.4.5",
|
||||
"@capacitor/core": "^2.4.5",
|
||||
"@paddim8/kalk-component": "^1.3.0"
|
||||
"@paddim8/kalk-component": "^1.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@capacitor-community/electron": "^1.3.2",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@paddim8/kalk-component",
|
||||
"version": "1.3.1",
|
||||
"version": "1.3.2",
|
||||
"description": "A Svelte component for kalk, a calculator that supports user-defined functions and variables.",
|
||||
"svelte": "src/main.ts",
|
||||
"main": "public/build/bundle.js",
|
||||
@ -55,7 +55,7 @@
|
||||
"webpack-dev-server": "^3.11.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@paddim8/kalk": "^2.1.0",
|
||||
"@paddim8/kalk": "^2.1.2",
|
||||
"shadow-selection-polyfill": "^1.1.0"
|
||||
},
|
||||
"browserslist": [
|
||||
|
Loading…
x
Reference in New Issue
Block a user