diff --git a/Cargo.lock b/Cargo.lock index a5245ed..3314988 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,6 +164,27 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" +[[package]] +name = "block-buffer" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" +dependencies = [ + "block-padding", + "byte-tools", + "byteorder", + "generic-array", +] + +[[package]] +name = "block-padding" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" +dependencies = [ + "byte-tools", +] + [[package]] name = "bstr" version = "0.2.17" @@ -182,6 +203,12 @@ version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37ccbd214614c6783386c1af30caf03192f17891059cecc394b4fb119e363de3" +[[package]] +name = "byte-tools" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" + [[package]] name = "bytemuck" version = "1.9.1" @@ -619,6 +646,15 @@ dependencies = [ "uuid", ] +[[package]] +name = "digest" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" +dependencies = [ + "generic-array", +] + [[package]] name = "dispatch" version = "0.2.0" @@ -757,6 +793,12 @@ dependencies = [ "smallvec", ] +[[package]] +name = "fake-simd" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" + [[package]] name = "fastrand" version = "1.7.0" @@ -819,6 +861,15 @@ dependencies = [ "rand", ] +[[package]] +name = "generic-array" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdf9f34f1447443d37393cc6c2b8313aebddcd96906caf34e54c68d8e57d7bd" +dependencies = [ + "typenum", +] + [[package]] name = "gethostname" version = "0.2.3" @@ -1099,6 +1150,17 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "json5" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96b0db21af676c1ce64250b5f40f3ce2cf27e4e47cb91ed91eb6fe9350b430c1" +dependencies = [ + "pest", + "pest_derive", + "serde", +] + [[package]] name = "khronos_api" version = "3.1.0" @@ -1179,6 +1241,12 @@ dependencies = [ "libc", ] +[[package]] +name = "maplit" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" + [[package]] name = "matches" version = "0.1.9" @@ -1554,6 +1622,12 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" +[[package]] +name = "opaque-debug" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" + [[package]] name = "osmesa-sys" version = "0.1.2" @@ -1635,6 +1709,49 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "pest" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10f4872ae94d7b90ae48754df22fd42ad52ce740b8f370b03da4835417403e53" +dependencies = [ + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "833d1ae558dc601e9a60366421196a8d94bc0ac980476d0b67e1d0988d72b2d0" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99b8db626e31e5b81787b9783425769681b347011cc59471e33ea46d2ea0cf55" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54be6e404f5317079812fc8f9f5279de376d8856929e21c184ecf6bbd692a11d" +dependencies = [ + "maplit", + "pest", + "sha-1", +] + [[package]] name = "phf" version = "0.10.1" @@ -1997,6 +2114,18 @@ dependencies = [ "serde", ] +[[package]] +name = "sha-1" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" +dependencies = [ + "block-buffer", + "digest", + "fake-simd", + "opaque-debug", +] + [[package]] name = "shadow-rs" version = "0.11.0" @@ -2324,6 +2453,18 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "typenum" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" + +[[package]] +name = "ucd-trie" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56dee185309b50d1f11bfedef0fe6d036842e3fb77413abef29f8f8d1c5d4c1c" + [[package]] name = "unicode-bidi" version = "0.3.8" @@ -2776,6 +2917,7 @@ dependencies = [ "getrandom", "instant", "itertools", + "json5", "parsing", "run_script", "ruzstd", diff --git a/Cargo.toml b/Cargo.toml index 9589f28..1858a60 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,7 @@ serde = "1" serde_json = "1" zstd = "0.11" run_script = "0.9" +json5 = "0.4" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] instant = "0.1" diff --git a/assets/text.json b/assets/text.json5 similarity index 81% rename from assets/text.json rename to assets/text.json5 index ac2dbfe..e559c07 100644 --- a/assets/text.json +++ b/assets/text.json5 @@ -1,28 +1,34 @@ { - "help_expr": [ + // help for supported expressions + help_expr: [ "abs, signum, sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, floor, round, ceil, trunc, fract, exp, sqrt, cbrt, ln, log2, log10, log" ], - "help_vars": [ + // help for supported variables + help_vars: [ "- Euler's number is supported via 'e' or 'E'", "- PI is available through 'pi' or 'π'" ], - "help_panel": [ + // help for buttons located on the top panel + help_panel: [ "- The 'Panel' button toggles if the side bar should be shown or not. This can also be accomplished by pressing the 'h' key.", "- The 'Add Function' button adds a new function to be graphed. You can then configure that function in the side panel.", "- The 'Help' button opens and closes this window!", "- The 'Info' button provides information on the build currently running." ], - "help_function": [ + // help for buttons located in the drop down of functions + help_function: [ "(From Left to Right)", "`✖` allows you to delete the selected function. Deleting a function is prevented if only 1 function exists.", "`∫` toggles integration.", "`d/dx` toggles the calculation of derivatives.", "`⚙` opens a window to tweak function options." ], - "help_other": [ + // help for other "misc" things + help_other: [ "- Extrema (local minimums and maximums) and Roots (intersections with the x-axis) are displayed though yellow and light blue points respectively located on the graph. These can be toggled in the side panel." ], - "welcome": [ + // welcome text + welcome: [ "Welcome to the (Yet-to-be-named) Graphing Software!", "", "This project aims to provide an intuitive experience graphing mathematical functions with features such as Integration, Differentiation, Extrema, Roots, and much more! (see the Help Window for more details)" diff --git a/build.rs b/build.rs index 2d3ff2b..83d163e 100644 --- a/build.rs +++ b/build.rs @@ -163,8 +163,7 @@ fn main() { ]), }; - let text_json: serde_json::Value = - serde_json::from_str(include_str!("assets/text.json")).unwrap(); + let text_json: serde_json::Value = json5::from_str(include_str!("assets/text.json5")).unwrap(); let mut json_file_array = text_json.as_object().unwrap().clone(); for value in json_file_array.iter_mut() { if let serde_json::Value::Array(values) = value.1 {