From 8f120fa06f702c5538d34579d02811899fd0352a Mon Sep 17 00:00:00 2001 From: trivernis Date: Mon, 3 Aug 2020 09:21:26 +0200 Subject: [PATCH] Add operation symbols --- .gitignore | 2 ++ .idea/.gitignore | 8 ++++++++ .idea/asciimath.iml | 11 +++++++++++ .idea/discord.xml | 6 ++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ .idea/vcs.xml | 6 ++++++ Cargo.toml | 10 ++++++++++ src/elements/enclosing.rs | 0 src/elements/literal.rs | 0 src/elements/mod.rs | 2 ++ src/lib.rs | 10 ++++++++++ src/tokens/constants/mod.rs | 1 + src/tokens/constants/operations.rs | 26 ++++++++++++++++++++++++++ src/tokens/mod.rs | 1 + 15 files changed, 97 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/asciimath.iml create mode 100644 .idea/discord.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 Cargo.toml create mode 100644 src/elements/enclosing.rs create mode 100644 src/elements/literal.rs create mode 100644 src/elements/mod.rs create mode 100644 src/lib.rs create mode 100644 src/tokens/constants/mod.rs create mode 100644 src/tokens/constants/operations.rs create mode 100644 src/tokens/mod.rs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..96ef6c0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +/target +Cargo.lock diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/asciimath.iml b/.idea/asciimath.iml new file mode 100644 index 0000000..c254557 --- /dev/null +++ b/.idea/asciimath.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/discord.xml b/.idea/discord.xml new file mode 100644 index 0000000..cd711a0 --- /dev/null +++ b/.idea/discord.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..55e2fdd --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..c8558ab --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "asciimath" +version = "0.1.0" +authors = ["trivernis "] +edition = "2018" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +charred = "0.2.2" \ No newline at end of file diff --git a/src/elements/enclosing.rs b/src/elements/enclosing.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/elements/literal.rs b/src/elements/literal.rs new file mode 100644 index 0000000..e69de29 diff --git a/src/elements/mod.rs b/src/elements/mod.rs new file mode 100644 index 0000000..e069f46 --- /dev/null +++ b/src/elements/mod.rs @@ -0,0 +1,2 @@ +pub mod literal; +pub mod enclosing; \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..214a8ce --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,10 @@ +pub mod elements; +mod tokens; + +#[cfg(test)] +mod tests { + #[test] + fn it_works() { + assert_eq!(2 + 2, 4); + } +} diff --git a/src/tokens/constants/mod.rs b/src/tokens/constants/mod.rs new file mode 100644 index 0000000..6bb553b --- /dev/null +++ b/src/tokens/constants/mod.rs @@ -0,0 +1 @@ +pub mod operations; \ No newline at end of file diff --git a/src/tokens/constants/operations.rs b/src/tokens/constants/operations.rs new file mode 100644 index 0000000..dd0652b --- /dev/null +++ b/src/tokens/constants/operations.rs @@ -0,0 +1,26 @@ +pub const G_PLUS: &'static[&str] = &["+"]; +pub const G_MINUS: &'static[&str] = &["-"]; +pub const G_CDOT: &'static[&str] = &["*", "cdot"]; +pub const G_AST: &'static[&str] = &["**", "ast"]; +pub const G_STAR: &'static[&str] = &["***"; "star"]; +pub const G_SLASH: &'static[&str] = &["////"]; +pub const G_BACKSLASH: &'static[&str] = &["\\\\", "backslash", "setminus"]; +pub const G_TIMES: &'static[&str] = &["xx", "times"]; +pub const G_DIV: &'static[&str] = &["-:", "div"]; +pub const G_LTIMES: &'static[&str] = &["|><", "ltimes"]; +pub const G_RTIMES: &'static[&str] = &["><|", "rtimes"]; +pub const G_BOWTIE: &'static[&str] = &["|><|", "bowtie"]; +pub const G_CIRC: &'static[&str] = &["@", "circ"]; +pub const G_OPLUS: &'static[&str] = &["o+", "oplus"]; +pub const G_OTIMES: &'static[&str] = &["ox", "otimes"]; +pub const G_ODOT: &'static[&str] = &["o.", "odot"]; +pub const G_SUM: &'static[&str] = &["sum"]; +pub const G_PROD: &'static[&str] = &["prod"]; +pub const G_WEDGE: &'static[&str] = &["^^", "wedge"]; +pub const G_BIDWEDGE: &'static[&str] = &["^^^", "bidwedge"]; +pub const G_VEE: &'static[&str] = &["vv", "vee"]; +pub const G_BIGVEE: &'static[&str] = &["vvv", "bigvee"]; +pub const G_CAP: &'static[&str] = &["nn", "cap"]; +pub const G_BIGCAP: &'static[&str] = &["nnn", "bigcap"]; +pub const G_CUP: &'static[&str] = &["uu", "cup"]; +pub const G_BIGCUP: &'static[&str] = &["uuu", "bigcup"]; \ No newline at end of file diff --git a/src/tokens/mod.rs b/src/tokens/mod.rs new file mode 100644 index 0000000..987b09f --- /dev/null +++ b/src/tokens/mod.rs @@ -0,0 +1 @@ +pub mod constants; \ No newline at end of file