From ce8c7e9b164b760b11021e8ea2c727e828b51e8f Mon Sep 17 00:00:00 2001 From: Mark Date: Wed, 2 Aug 2023 08:49:20 -0700 Subject: [PATCH] Added more constants --- buildscript/constants.toml | 87 ++++++++++++++++++++++++++++++++++- src/parser/stage/find_subs.rs | 7 +++ 2 files changed, 93 insertions(+), 1 deletion(-) diff --git a/buildscript/constants.toml b/buildscript/constants.toml index 4da68cd..2fbed53 100644 --- a/buildscript/constants.toml +++ b/buildscript/constants.toml @@ -15,7 +15,7 @@ value = "3.141592653589793238462643383279502884197169399375105820974944592307816 [[constant]] enum_name = "Phi" -strings = ["φ", "phi"] +strings = ["φ", "phi", "goldenratio"] value = "1.618033988749894848204586834365638117720309179805762862135448622705260462818902449707207204189391137" [[constant]] @@ -23,6 +23,91 @@ enum_name = "Euler" strings = "e" value = "2.718281828459045235360287471352662497757247093699959574966967627724076630353547594571382178525166427" +[[constant]] +enum_name = "LightSpeed" +strings = "c" +value = "299792458 meter/second" + +[[constant]] +enum_name = "ElectricConstant" +strings = ["ε₀", "epsilon_zero", "eps_zero", "electricconstant"] +value = "8.8541878128e-12 F/m" + +[[constant]] +enum_name = "ElectronCharge" +strings = ["electroncharge", "elementarycharge"] +value = "1.602176634e-19 C" + +[[constant]] +enum_name = "ElectronMass" +strings = ["me", "m_e", "electronmass"] +value = "9.1093837015-31 kg" + +[[constant]] +enum_name = "ProtonMass" +strings = ["mp", "m_p", "protonmass"] +value = "1.67262192369e-27 kg" + +[[constant]] +enum_name = "GravityConstant" +strings = "G" +value = "6.67430e-11 (m^3)/(s^2 * kg)" + +[[constant]] +enum_name = "GravityEarth" +strings = ["g₀", "g_zero", "gravity"] +value = "9.80665 m/(s^2)" + +[[constant]] +enum_name = "BoltzmannConstant" +strings = ["k_B", "boltzmannconstant"] +value = "1.380649e-23 J/K" + +[[constant]] +enum_name = "FaradayConstant" +strings = ["faradayconstant"] +value = "9.64853321233100184e4 C/mol" + +[[constant]] +enum_name = "MagneticConstant" +strings = ["μ₀","mu_zero"] +value = "1.25663706212 N/(A*A)" + +[[constant]] +enum_name = "AvogadroConstant" +strings = ["N_A", "avogadroconstant"] +value = "6.02214076e23 mol^-1" + +[[constant]] +enum_name = "PlanckConstant" +strings = ["planckconstant"] +value = "6.62607015e-34 J/Hz" + +[[constant]] +enum_name = "Hbar" +strings = ["ℏ", "h_bar"] +value = "planckconstant / (2 pi)" + +[[constant]] +enum_name = "GasConstant" +strings = ["R", "gasconstant"] +value = "avogadroconstant * boltzmannconstant" + + + + + + + + + + + + + + + + [[constant]] enum_name = "MPG" strings = "mpg" diff --git a/src/parser/stage/find_subs.rs b/src/parser/stage/find_subs.rs index 086fceb..8e31bfc 100644 --- a/src/parser/stage/find_subs.rs +++ b/src/parser/stage/find_subs.rs @@ -67,6 +67,13 @@ pub fn find_subs( "chi" => {Some("χ")}, //"psi" => {Some("ψ")}, Conflict with pound / square inch "omega" => {Some("ω")}, + + // Constants + "epsilon_zero" => {Some("ε₀")}, + "eps_zero" => {Some("ε₀")}, + "g_zero" => {Some("g₀")}, + "mu_zero" => {Some("μ₀")}, + "h_bar" => {Some("ℏ")}, _ => {None} };