├── .gitattributes ├── .github ├── FUNDING.yml ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md └── workflows │ ├── Errors.yml │ ├── Release.yml │ ├── audit-check.yml │ ├── bloat.yml │ ├── broke.yml │ ├── build.yml │ ├── clippy.yml │ ├── code.yml │ ├── format.yml │ ├── rust-tarpaulin.yml │ ├── rust.yml │ ├── security-audit.yml │ ├── support.yml │ └── unused.yml ├── .gitignore ├── CONTRIBUTING.md ├── Cargo.lock ├── Cargo.toml ├── LICENSE ├── Logos ├── LogoNyson.png └── NysonLogo.png ├── README.md ├── examples ├── Calculator.nys ├── Coin Flip.nys ├── Get File Extension.nys ├── Loading Bar.nys ├── Music.nys ├── Neofetch.nys ├── Odd or Even.nys ├── Random Number.nys ├── Rock Paper Scissors.nys ├── Tic Tack Toe.nys └── test.nys ├── src ├── lexer.rs ├── main.rs ├── run.rs └── run │ └── functions.rs ├── startup.bat ├── startup.sh └── tests ├── main.nys └── test_code ├── cut.nys ├── exec.nys ├── loadingbar.nys ├── numberguess.nys ├── replace.nys └── whileloop.nys /.gitattributes: -------------------------------------------------------------------------------- 1 | *.nys diff=nyson 2 | *.rs diff=rust 3 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | custom: ["https://paypal.me/AMTitan", "https://paypal.me/nyelson"] 2 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: "[BUG]" 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Your code that shows the behavior: 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Other (please complete the following information):** 20 | - OS: [e.g. Windows, MacOS, Linux] 21 | - OS Type: [e.g. 10, Big Sur, Arch] 22 | - Nyson Version [e.g. 0.1] 23 | 24 | **Additional context** 25 | Add any other context about the problem here. 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: "[FEATURE]" 5 | labels: enhancement 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/workflows/Errors.yml: -------------------------------------------------------------------------------- 1 | name: Errors 2 | on: push 3 | jobs: 4 | Warnings: 5 | name: Rust project 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - uses: actions-rs/toolchain@v1 10 | with: 11 | toolchain: stable 12 | - run: cargo clippy --all 13 | Errors: 14 | name: Rust project 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v2 18 | - uses: actions-rs/toolchain@v1 19 | with: 20 | toolchain: stable 21 | - run: cargo clippy --all -- -W clippy::all -W clippy::pedantic -W clippy::restriction -W clippy::nursery -D warning 22 | -------------------------------------------------------------------------------- /.github/workflows/Release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-latest 8 | 9 | steps: 10 | - name: Checkout 11 | uses: actions/checkout@v1 12 | 13 | - name: Install latest rust toolchain 14 | uses: actions-rs/toolchain@v1 15 | with: 16 | toolchain: stable 17 | default: true 18 | override: true 19 | 20 | - name: Build 21 | run: cargo build --all --release && strip target/release/nyson && mv target/release/nyson target/release/nyson_amd64 22 | 23 | - name: Release 24 | uses: softprops/action-gh-release@v1 25 | if: startsWith(github.ref, 'refs/tags/') 26 | with: 27 | files: | 28 | target/release/nyson_amd64 29 | env: 30 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 31 | 32 | build-win: 33 | runs-on: windows-latest 34 | 35 | steps: 36 | - name: Checkout 37 | uses: actions/checkout@v1 38 | 39 | - name: Install latest rust toolchain 40 | uses: actions-rs/toolchain@v1 41 | with: 42 | toolchain: stable 43 | default: true 44 | override: true 45 | 46 | - name: Build 47 | run: cargo build --all --release 48 | 49 | - name: Release 50 | uses: softprops/action-gh-release@v1 51 | if: startsWith(github.ref, 'refs/tags/') 52 | with: 53 | files: target/release/nyson.exe 54 | env: 55 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 56 | 57 | build-mac: 58 | runs-on: macos-latest 59 | 60 | steps: 61 | - name: Checkout 62 | uses: actions/checkout@v1 63 | 64 | - name: Install latest rust toolchain 65 | uses: actions-rs/toolchain@v1 66 | with: 67 | toolchain: stable 68 | target: x86_64-apple-darwin 69 | default: true 70 | override: true 71 | 72 | - name: Build for mac 73 | run: cargo build --all --release && strip target/release/nyson && mv target/release/nyson target/release/nyson_darwin 74 | 75 | - name: Release 76 | uses: softprops/action-gh-release@v1 77 | if: startsWith(github.ref, 'refs/tags/') 78 | with: 79 | files: | 80 | target/release/nyson_darwin 81 | env: 82 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/audit-check.yml: -------------------------------------------------------------------------------- 1 | name: Security audit 2 | on: push 3 | jobs: 4 | security_audit: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v1 8 | - uses: actions-rs/audit-check@v1 9 | with: 10 | token: ${{ secrets.GITHUB_TOKEN }} 11 | -------------------------------------------------------------------------------- /.github/workflows/bloat.yml: -------------------------------------------------------------------------------- 1 | on: # rebuild any PRs and main branch changes 2 | pull_request: 3 | push: 4 | branches: 5 | - master 6 | 7 | name: bloat 8 | 9 | jobs: 10 | cargo_bloat: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@master 14 | - name: Install Rust 15 | uses: actions-rs/toolchain@v1 16 | with: 17 | toolchain: stable 18 | - name: Run cargo bloat 19 | uses: orf/cargo-bloat-action@v1 20 | with: 21 | token: ${{ secrets.GITHUB_TOKEN }} 22 | -------------------------------------------------------------------------------- /.github/workflows/broke.yml: -------------------------------------------------------------------------------- 1 | name: did-we-break-anything 2 | on: push 3 | jobs: 4 | build_and_test: 5 | name: Rust project 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - uses: actions-rs/toolchain@v1 10 | with: 11 | toolchain: stable 12 | - run: cargo run tests/main.nys 13 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | on: [push] 2 | name: build 3 | jobs: 4 | build: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v2 8 | - uses: actions-rs/toolchain@v1 9 | with: 10 | toolchain: stable 11 | - name: build 12 | uses: actions-rs/cargo@v1 13 | with: 14 | command: build 15 | - name: test 16 | uses: actions-rs/cargo@v1 17 | with: 18 | command: test 19 | - name: lint 20 | uses: actions-rs/clippy-check@v1 21 | with: 22 | token: ${{ secrets.GITHUB_TOKEN }} 23 | -------------------------------------------------------------------------------- /.github/workflows/clippy.yml: -------------------------------------------------------------------------------- 1 | name: fix 2 | on: push 3 | jobs: 4 | fix: 5 | name: Rust project 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - uses: actions-rs/toolchain@v1 10 | with: 11 | toolchain: nightly 12 | override: true 13 | components: rustfmt, clippy 14 | - run: git pull 15 | - run: cargo clippy --all --all-targets --all-features --fix -Z unstable-options 16 | - name: Commit files 17 | run: | 18 | git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" 19 | git config --local user.name "github-actions[bot]" 20 | git commit -m "Cargo Fix" -a 21 | - name: Push changes 22 | uses: ad-m/github-push-action@master 23 | with: 24 | github_token: ${{ secrets.GITHUB_TOKEN }} 25 | -------------------------------------------------------------------------------- /.github/workflows/code.yml: -------------------------------------------------------------------------------- 1 | on: [push] 2 | 3 | name: Code Coverage 4 | 5 | jobs: 6 | lint: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v1 10 | - uses: actions-rs/toolchain@v1 11 | with: 12 | toolchain: nightly 13 | override: true 14 | - uses: actions-rs/cargo@v1 15 | with: 16 | command: test 17 | args: --all-features --no-fail-fast 18 | env: 19 | CARGO_INCREMENTAL: '0' 20 | RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' 21 | RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests' 22 | - uses: actions-rs/grcov@v0.1 23 | -------------------------------------------------------------------------------- /.github/workflows/format.yml: -------------------------------------------------------------------------------- 1 | on: push 2 | 3 | name: Format 4 | 5 | jobs: 6 | format: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v2 10 | - uses: actions-rs/toolchain@v1 11 | with: 12 | toolchain: stable 13 | components: rustfmt 14 | override: true 15 | - uses: mbrobbel/rustfmt-check@master 16 | with: 17 | token: ${{ secrets.GITHUB_TOKEN }} 18 | -------------------------------------------------------------------------------- /.github/workflows/rust-tarpaulin.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | 3 | name: Continuous integration 4 | 5 | jobs: 6 | check: 7 | name: Check 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v2 11 | - uses: actions-rs/toolchain@v1 12 | with: 13 | profile: minimal 14 | toolchain: stable 15 | override: true 16 | - uses: actions-rs/cargo@v1 17 | with: 18 | command: check 19 | 20 | test: 21 | name: Test Suite 22 | runs-on: ubuntu-latest 23 | steps: 24 | - uses: actions/checkout@v2 25 | - uses: actions-rs/toolchain@v1 26 | with: 27 | profile: minimal 28 | toolchain: stable 29 | override: true 30 | - uses: actions-rs/cargo@v1 31 | with: 32 | command: test 33 | 34 | fmt: 35 | name: Rustfmt 36 | runs-on: ubuntu-latest 37 | steps: 38 | - uses: actions/checkout@v2 39 | - uses: actions-rs/toolchain@v1 40 | with: 41 | profile: minimal 42 | toolchain: stable 43 | override: true 44 | - run: rustup component add rustfmt 45 | - uses: actions-rs/cargo@v1 46 | with: 47 | command: fmt 48 | args: --all -- --check 49 | 50 | clippy: 51 | name: Clippy 52 | runs-on: ubuntu-latest 53 | steps: 54 | - uses: actions/checkout@v2 55 | - uses: actions-rs/toolchain@v1 56 | with: 57 | profile: minimal 58 | toolchain: stable 59 | override: true 60 | - run: rustup component add clippy 61 | - uses: actions-rs/cargo@v1 62 | with: 63 | command: clippy 64 | args: -- -D warnings 65 | -------------------------------------------------------------------------------- /.github/workflows/rust.yml: -------------------------------------------------------------------------------- 1 | name: Rust 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | branches: [ main ] 8 | 9 | env: 10 | CARGO_TERM_COLOR: always 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | 17 | steps: 18 | - uses: actions/checkout@v2 19 | - name: Build 20 | run: cargo build --verbose 21 | - name: Run tests 22 | run: cargo test --verbose 23 | -------------------------------------------------------------------------------- /.github/workflows/security-audit.yml: -------------------------------------------------------------------------------- 1 | name: Security audit 2 | on: 3 | workflow_dispatch: 4 | schedule: 5 | - cron: "0 8 * * *" 6 | push: 7 | paths: 8 | - "**/Cargo.*" 9 | pull_request: 10 | branches: 11 | - master 12 | jobs: 13 | security_audit: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v1 17 | - uses: actions-rs/audit-check@v1 18 | with: 19 | token: ${{ secrets.GITHUB_TOKEN }} 20 | -------------------------------------------------------------------------------- /.github/workflows/support.yml: -------------------------------------------------------------------------------- 1 | name: Support 2 | 3 | on: 4 | push: 5 | 6 | env: 7 | CARGO_TERM_COLOR: always 8 | 9 | jobs: 10 | Linux: 11 | 12 | runs-on: ubuntu-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v2 16 | - name: Build 17 | run: cargo build --verbose 18 | - name: Run tests 19 | run: cargo test --verbose 20 | - name: Cargo run tests 21 | run: cargo run tests/main.nys 22 | Windows: 23 | 24 | runs-on: windows-latest 25 | 26 | steps: 27 | - uses: actions/checkout@v2 28 | - name: Build 29 | run: cargo build --verbose 30 | - name: Run tests 31 | run: cargo test --verbose 32 | - name: Cargo run tests 33 | run: cargo run tests/main.nys 34 | Mac: 35 | 36 | runs-on: macos-latest 37 | 38 | steps: 39 | - uses: actions/checkout@v2 40 | - name: Build 41 | run: cargo build --verbose 42 | - name: Run tests 43 | run: cargo test --verbose 44 | - name: Cargo run tests 45 | run: cargo run tests/main.nys 46 | 47 | -------------------------------------------------------------------------------- /.github/workflows/unused.yml: -------------------------------------------------------------------------------- 1 | name: unused 2 | on: push 3 | jobs: 4 | unused: 5 | name: Rust project 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - uses: actions-rs/toolchain@v1 10 | with: 11 | toolchain: nightly 12 | override: true 13 | components: rustfmt, clippy 14 | - run: git pull 15 | - run: cargo install cargo-udeps && cargo +nightly udeps 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | 5 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 6 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 7 | Cargo.lock 8 | 9 | # These are backup files generated by rustfmt 10 | **/*.rs.bk 11 | 12 | # jet brains 13 | .idea 14 | 15 | # vs code smh 16 | .vscode 17 | 18 | #nyson 19 | dep 20 | Nyson.json 21 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Nyson 2 | Contribution Contents: 3 | 4 | - Reporting a bug 5 | - Discussing the current state of the code 6 | - Submitting a fix 7 | - Proposing new features 8 | - Becoming a maintainer 9 | 10 | ## We Develop with Github 11 | We use github to host code, to track issues and feature requests, as well as accept pull requests. 12 | 13 | ## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests 14 | Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests: 15 | 16 | 1. Fork the repo and create your branch from `master`. 17 | 2. If you've added code that should be tested, add tests. 18 | 3. If you've changed APIs, update the documentation. 19 | 4. Ensure the test suite passes. 20 | 5. Make sure your code lints. 21 | 6. Issue that pull request! 22 | 23 | ## Any contributions you make will be under the MIT Software License 24 | In short, when you submit code changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. 25 | 26 | ## Report bugs using Github's [issues](https://github.com/briandk/transcriptase-atom/issues) 27 | We use GitHub issues to track public bugs. Report a bug by [opening a new issue](); it's that easy! 28 | 29 | ## Write bug reports with detail, background, and sample code 30 | [This is an example](http://stackoverflow.com/q/12488905/180626) of a bug report I wrote, and I think it's not a bad model. Here's [another example from Craig Hockenberry](http://www.openradar.me/11905408), an app developer whom I greatly respect. 31 | 32 | **Great Bug Reports** tend to have: 33 | 34 | - A quick summary and/or background 35 | - Steps to reproduce 36 | - Be specific! 37 | - Give sample code if you can. [My stackoverflow question](http://stackoverflow.com/q/12488905/180626) includes sample code that *anyone* with a base R setup can run to reproduce what I was seeing 38 | - What you expected would happen 39 | - What actually happens 40 | - Notes (possibly including why you think this might be happening, or stuff you tried that didn't work) 41 | 42 | People *love* thorough bug reports. I'm not even kidding. 43 | 44 | ## Use a Consistent Coding Style 45 | * 2 spaces for indentation rather than tabs 46 | * You can try running `npm run lint` for style unification 47 | 48 | ## License 49 | By contributing, you agree that your contributions will be licensed under its MIT License. 50 | 51 | ## References 52 | This document was adapted from the open-source contribution guidelines for [Facebook's Draft](https://github.com/facebook/draft-js/blob/a9316a723f9e918afde44dea68b5f9f39b7d9b00/CONTRIBUTING.md) 53 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | # This file is automatically @generated by Cargo. 2 | # It is not intended for manual editing. 3 | version = 3 4 | 5 | [[package]] 6 | name = "ansi_term" 7 | version = "0.12.1" 8 | source = "registry+https://github.com/rust-lang/crates.io-index" 9 | checksum = "d52a9bb7ec0cf484c551830a7ce27bd20d67eac647e1befb56b0be4ee39a55d2" 10 | dependencies = [ 11 | "winapi", 12 | ] 13 | 14 | [[package]] 15 | name = "arrayref" 16 | version = "0.3.6" 17 | source = "registry+https://github.com/rust-lang/crates.io-index" 18 | checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" 19 | 20 | [[package]] 21 | name = "arrayvec" 22 | version = "0.5.2" 23 | source = "registry+https://github.com/rust-lang/crates.io-index" 24 | checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" 25 | 26 | [[package]] 27 | name = "atty" 28 | version = "0.2.14" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" 31 | dependencies = [ 32 | "hermit-abi", 33 | "libc", 34 | "winapi", 35 | ] 36 | 37 | [[package]] 38 | name = "autocfg" 39 | version = "1.1.0" 40 | source = "registry+https://github.com/rust-lang/crates.io-index" 41 | checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" 42 | 43 | [[package]] 44 | name = "base64" 45 | version = "0.13.0" 46 | source = "registry+https://github.com/rust-lang/crates.io-index" 47 | checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" 48 | 49 | [[package]] 50 | name = "bitflags" 51 | version = "1.3.2" 52 | source = "registry+https://github.com/rust-lang/crates.io-index" 53 | checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" 54 | 55 | [[package]] 56 | name = "blake2b_simd" 57 | version = "0.5.11" 58 | source = "registry+https://github.com/rust-lang/crates.io-index" 59 | checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587" 60 | dependencies = [ 61 | "arrayref", 62 | "arrayvec", 63 | "constant_time_eq", 64 | ] 65 | 66 | [[package]] 67 | name = "byteorder" 68 | version = "1.4.3" 69 | source = "registry+https://github.com/rust-lang/crates.io-index" 70 | checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" 71 | 72 | [[package]] 73 | name = "cc" 74 | version = "1.0.72" 75 | source = "registry+https://github.com/rust-lang/crates.io-index" 76 | checksum = "22a9137b95ea06864e018375b72adfb7db6e6f68cfc8df5a04d00288050485ee" 77 | dependencies = [ 78 | "jobserver", 79 | ] 80 | 81 | [[package]] 82 | name = "cfg-if" 83 | version = "1.0.0" 84 | source = "registry+https://github.com/rust-lang/crates.io-index" 85 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" 86 | 87 | [[package]] 88 | name = "chrono" 89 | version = "0.4.19" 90 | source = "registry+https://github.com/rust-lang/crates.io-index" 91 | checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" 92 | dependencies = [ 93 | "libc", 94 | "num-integer", 95 | "num-traits", 96 | "time", 97 | "winapi", 98 | ] 99 | 100 | [[package]] 101 | name = "clap" 102 | version = "2.34.0" 103 | source = "registry+https://github.com/rust-lang/crates.io-index" 104 | checksum = "a0610544180c38b88101fecf2dd634b174a62eef6946f84dfc6a7127512b381c" 105 | dependencies = [ 106 | "ansi_term", 107 | "atty", 108 | "bitflags", 109 | "strsim", 110 | "textwrap", 111 | "unicode-width", 112 | "vec_map", 113 | ] 114 | 115 | [[package]] 116 | name = "clippy" 117 | version = "0.0.302" 118 | source = "registry+https://github.com/rust-lang/crates.io-index" 119 | checksum = "d911ee15579a3f50880d8c1d59ef6e79f9533127a3bd342462f5d584f5e8c294" 120 | dependencies = [ 121 | "term", 122 | ] 123 | 124 | [[package]] 125 | name = "constant_time_eq" 126 | version = "0.1.5" 127 | source = "registry+https://github.com/rust-lang/crates.io-index" 128 | checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" 129 | 130 | [[package]] 131 | name = "core-foundation-sys" 132 | version = "0.8.3" 133 | source = "registry+https://github.com/rust-lang/crates.io-index" 134 | checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" 135 | 136 | [[package]] 137 | name = "crossbeam-channel" 138 | version = "0.5.2" 139 | source = "registry+https://github.com/rust-lang/crates.io-index" 140 | checksum = "e54ea8bc3fb1ee042f5aace6e3c6e025d3874866da222930f70ce62aceba0bfa" 141 | dependencies = [ 142 | "cfg-if", 143 | "crossbeam-utils", 144 | ] 145 | 146 | [[package]] 147 | name = "crossbeam-deque" 148 | version = "0.8.1" 149 | source = "registry+https://github.com/rust-lang/crates.io-index" 150 | checksum = "6455c0ca19f0d2fbf751b908d5c55c1f5cbc65e03c4225427254b46890bdde1e" 151 | dependencies = [ 152 | "cfg-if", 153 | "crossbeam-epoch", 154 | "crossbeam-utils", 155 | ] 156 | 157 | [[package]] 158 | name = "crossbeam-epoch" 159 | version = "0.9.7" 160 | source = "registry+https://github.com/rust-lang/crates.io-index" 161 | checksum = "c00d6d2ea26e8b151d99093005cb442fb9a37aeaca582a03ec70946f49ab5ed9" 162 | dependencies = [ 163 | "cfg-if", 164 | "crossbeam-utils", 165 | "lazy_static", 166 | "memoffset", 167 | "scopeguard", 168 | ] 169 | 170 | [[package]] 171 | name = "crossbeam-utils" 172 | version = "0.8.7" 173 | source = "registry+https://github.com/rust-lang/crates.io-index" 174 | checksum = "b5e5bed1f1c269533fa816a0a5492b3545209a205ca1a54842be180eb63a16a6" 175 | dependencies = [ 176 | "cfg-if", 177 | "lazy_static", 178 | ] 179 | 180 | [[package]] 181 | name = "curl" 182 | version = "0.4.42" 183 | source = "registry+https://github.com/rust-lang/crates.io-index" 184 | checksum = "7de97b894edd5b5bcceef8b78d7da9b75b1d2f2f9a910569d0bde3dd31d84939" 185 | dependencies = [ 186 | "curl-sys", 187 | "libc", 188 | "openssl-probe", 189 | "openssl-sys", 190 | "schannel", 191 | "socket2", 192 | "winapi", 193 | ] 194 | 195 | [[package]] 196 | name = "curl-sys" 197 | version = "0.4.52+curl-7.81.0" 198 | source = "registry+https://github.com/rust-lang/crates.io-index" 199 | checksum = "14b8c2d1023ea5fded5b7b892e4b8e95f70038a421126a056761a84246a28971" 200 | dependencies = [ 201 | "cc", 202 | "libc", 203 | "libz-sys", 204 | "openssl-sys", 205 | "pkg-config", 206 | "vcpkg", 207 | "winapi", 208 | ] 209 | 210 | [[package]] 211 | name = "dirs" 212 | version = "1.0.5" 213 | source = "registry+https://github.com/rust-lang/crates.io-index" 214 | checksum = "3fd78930633bd1c6e35c4b42b1df7b0cbc6bc191146e512bb3bedf243fcc3901" 215 | dependencies = [ 216 | "libc", 217 | "redox_users", 218 | "winapi", 219 | ] 220 | 221 | [[package]] 222 | name = "duct" 223 | version = "0.13.5" 224 | source = "registry+https://github.com/rust-lang/crates.io-index" 225 | checksum = "0fc6a0a59ed0888e0041cf708e66357b7ae1a82f1c67247e1f93b5e0818f7d8d" 226 | dependencies = [ 227 | "libc", 228 | "once_cell", 229 | "os_pipe", 230 | "shared_child", 231 | ] 232 | 233 | [[package]] 234 | name = "either" 235 | version = "1.6.1" 236 | source = "registry+https://github.com/rust-lang/crates.io-index" 237 | checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" 238 | 239 | [[package]] 240 | name = "fnv" 241 | version = "1.0.7" 242 | source = "registry+https://github.com/rust-lang/crates.io-index" 243 | checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" 244 | 245 | [[package]] 246 | name = "foreign-types" 247 | version = "0.3.2" 248 | source = "registry+https://github.com/rust-lang/crates.io-index" 249 | checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" 250 | dependencies = [ 251 | "foreign-types-shared", 252 | ] 253 | 254 | [[package]] 255 | name = "foreign-types-shared" 256 | version = "0.1.1" 257 | source = "registry+https://github.com/rust-lang/crates.io-index" 258 | checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" 259 | 260 | [[package]] 261 | name = "form_urlencoded" 262 | version = "1.0.1" 263 | source = "registry+https://github.com/rust-lang/crates.io-index" 264 | checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" 265 | dependencies = [ 266 | "matches", 267 | "percent-encoding", 268 | ] 269 | 270 | [[package]] 271 | name = "getrandom" 272 | version = "0.1.16" 273 | source = "registry+https://github.com/rust-lang/crates.io-index" 274 | checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" 275 | dependencies = [ 276 | "cfg-if", 277 | "libc", 278 | "wasi 0.9.0+wasi-snapshot-preview1", 279 | ] 280 | 281 | [[package]] 282 | name = "getrandom" 283 | version = "0.2.4" 284 | source = "registry+https://github.com/rust-lang/crates.io-index" 285 | checksum = "418d37c8b1d42553c93648be529cb70f920d3baf8ef469b74b9638df426e0b4c" 286 | dependencies = [ 287 | "cfg-if", 288 | "libc", 289 | "wasi 0.10.0+wasi-snapshot-preview1", 290 | ] 291 | 292 | [[package]] 293 | name = "git2" 294 | version = "0.13.25" 295 | source = "registry+https://github.com/rust-lang/crates.io-index" 296 | checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6" 297 | dependencies = [ 298 | "bitflags", 299 | "libc", 300 | "libgit2-sys", 301 | "log", 302 | "openssl-probe", 303 | "openssl-sys", 304 | "url", 305 | ] 306 | 307 | [[package]] 308 | name = "hermit-abi" 309 | version = "0.1.19" 310 | source = "registry+https://github.com/rust-lang/crates.io-index" 311 | checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" 312 | dependencies = [ 313 | "libc", 314 | ] 315 | 316 | [[package]] 317 | name = "humantime" 318 | version = "2.1.0" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" 321 | 322 | [[package]] 323 | name = "idna" 324 | version = "0.2.3" 325 | source = "registry+https://github.com/rust-lang/crates.io-index" 326 | checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" 327 | dependencies = [ 328 | "matches", 329 | "unicode-bidi", 330 | "unicode-normalization", 331 | ] 332 | 333 | [[package]] 334 | name = "itoa" 335 | version = "1.0.1" 336 | source = "registry+https://github.com/rust-lang/crates.io-index" 337 | checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35" 338 | 339 | [[package]] 340 | name = "jobserver" 341 | version = "0.1.24" 342 | source = "registry+https://github.com/rust-lang/crates.io-index" 343 | checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" 344 | dependencies = [ 345 | "libc", 346 | ] 347 | 348 | [[package]] 349 | name = "lazy_static" 350 | version = "1.4.0" 351 | source = "registry+https://github.com/rust-lang/crates.io-index" 352 | checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" 353 | 354 | [[package]] 355 | name = "libc" 356 | version = "0.2.117" 357 | source = "registry+https://github.com/rust-lang/crates.io-index" 358 | checksum = "e74d72e0f9b65b5b4ca49a346af3976df0f9c61d550727f349ecd559f251a26c" 359 | 360 | [[package]] 361 | name = "libgit2-sys" 362 | version = "0.12.26+1.3.0" 363 | source = "registry+https://github.com/rust-lang/crates.io-index" 364 | checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494" 365 | dependencies = [ 366 | "cc", 367 | "libc", 368 | "libssh2-sys", 369 | "libz-sys", 370 | "openssl-sys", 371 | "pkg-config", 372 | ] 373 | 374 | [[package]] 375 | name = "libssh2-sys" 376 | version = "0.2.23" 377 | source = "registry+https://github.com/rust-lang/crates.io-index" 378 | checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" 379 | dependencies = [ 380 | "cc", 381 | "libc", 382 | "libz-sys", 383 | "openssl-sys", 384 | "pkg-config", 385 | "vcpkg", 386 | ] 387 | 388 | [[package]] 389 | name = "libz-sys" 390 | version = "1.1.3" 391 | source = "registry+https://github.com/rust-lang/crates.io-index" 392 | checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" 393 | dependencies = [ 394 | "cc", 395 | "libc", 396 | "pkg-config", 397 | "vcpkg", 398 | ] 399 | 400 | [[package]] 401 | name = "log" 402 | version = "0.4.14" 403 | source = "registry+https://github.com/rust-lang/crates.io-index" 404 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" 405 | dependencies = [ 406 | "cfg-if", 407 | ] 408 | 409 | [[package]] 410 | name = "matches" 411 | version = "0.1.9" 412 | source = "registry+https://github.com/rust-lang/crates.io-index" 413 | checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" 414 | 415 | [[package]] 416 | name = "memoffset" 417 | version = "0.6.5" 418 | source = "registry+https://github.com/rust-lang/crates.io-index" 419 | checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" 420 | dependencies = [ 421 | "autocfg", 422 | ] 423 | 424 | [[package]] 425 | name = "meval" 426 | version = "0.2.0" 427 | source = "registry+https://github.com/rust-lang/crates.io-index" 428 | checksum = "f79496a5651c8d57cd033c5add8ca7ee4e3d5f7587a4777484640d9cb60392d9" 429 | dependencies = [ 430 | "fnv", 431 | "nom", 432 | ] 433 | 434 | [[package]] 435 | name = "nom" 436 | version = "1.2.4" 437 | source = "registry+https://github.com/rust-lang/crates.io-index" 438 | checksum = "a5b8c256fd9471521bcb84c3cdba98921497f1a331cbc15b8030fc63b82050ce" 439 | 440 | [[package]] 441 | name = "ntapi" 442 | version = "0.3.6" 443 | source = "registry+https://github.com/rust-lang/crates.io-index" 444 | checksum = "3f6bb902e437b6d86e03cce10a7e2af662292c5dfef23b65899ea3ac9354ad44" 445 | dependencies = [ 446 | "winapi", 447 | ] 448 | 449 | [[package]] 450 | name = "num-integer" 451 | version = "0.1.44" 452 | source = "registry+https://github.com/rust-lang/crates.io-index" 453 | checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" 454 | dependencies = [ 455 | "autocfg", 456 | "num-traits", 457 | ] 458 | 459 | [[package]] 460 | name = "num-traits" 461 | version = "0.2.14" 462 | source = "registry+https://github.com/rust-lang/crates.io-index" 463 | checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" 464 | dependencies = [ 465 | "autocfg", 466 | ] 467 | 468 | [[package]] 469 | name = "num_cpus" 470 | version = "1.13.1" 471 | source = "registry+https://github.com/rust-lang/crates.io-index" 472 | checksum = "19e64526ebdee182341572e50e9ad03965aa510cd94427a4549448f285e957a1" 473 | dependencies = [ 474 | "hermit-abi", 475 | "libc", 476 | ] 477 | 478 | [[package]] 479 | name = "nyson" 480 | version = "0.1.19" 481 | dependencies = [ 482 | "chrono", 483 | "clap", 484 | "clippy", 485 | "curl", 486 | "duct", 487 | "git2", 488 | "humantime", 489 | "meval", 490 | "openssl", 491 | "pbr", 492 | "rand", 493 | "rustc-serialize", 494 | "serde_json", 495 | "sysinfo", 496 | ] 497 | 498 | [[package]] 499 | name = "once_cell" 500 | version = "1.9.0" 501 | source = "registry+https://github.com/rust-lang/crates.io-index" 502 | checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5" 503 | 504 | [[package]] 505 | name = "openssl" 506 | version = "0.10.38" 507 | source = "registry+https://github.com/rust-lang/crates.io-index" 508 | checksum = "0c7ae222234c30df141154f159066c5093ff73b63204dcda7121eb082fc56a95" 509 | dependencies = [ 510 | "bitflags", 511 | "cfg-if", 512 | "foreign-types", 513 | "libc", 514 | "once_cell", 515 | "openssl-sys", 516 | ] 517 | 518 | [[package]] 519 | name = "openssl-probe" 520 | version = "0.1.5" 521 | source = "registry+https://github.com/rust-lang/crates.io-index" 522 | checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" 523 | 524 | [[package]] 525 | name = "openssl-src" 526 | version = "111.17.0+1.1.1m" 527 | source = "registry+https://github.com/rust-lang/crates.io-index" 528 | checksum = "05d6a336abd10814198f66e2a91ccd7336611f30334119ca8ce300536666fcf4" 529 | dependencies = [ 530 | "cc", 531 | ] 532 | 533 | [[package]] 534 | name = "openssl-sys" 535 | version = "0.9.72" 536 | source = "registry+https://github.com/rust-lang/crates.io-index" 537 | checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" 538 | dependencies = [ 539 | "autocfg", 540 | "cc", 541 | "libc", 542 | "openssl-src", 543 | "pkg-config", 544 | "vcpkg", 545 | ] 546 | 547 | [[package]] 548 | name = "os_pipe" 549 | version = "0.9.2" 550 | source = "registry+https://github.com/rust-lang/crates.io-index" 551 | checksum = "fb233f06c2307e1f5ce2ecad9f8121cffbbee2c95428f44ea85222e460d0d213" 552 | dependencies = [ 553 | "libc", 554 | "winapi", 555 | ] 556 | 557 | [[package]] 558 | name = "pbr" 559 | version = "1.0.4" 560 | source = "registry+https://github.com/rust-lang/crates.io-index" 561 | checksum = "ff5751d87f7c00ae6403eb1fcbba229b9c76c9a30de8c1cf87182177b168cea2" 562 | dependencies = [ 563 | "crossbeam-channel", 564 | "libc", 565 | "time", 566 | "winapi", 567 | ] 568 | 569 | [[package]] 570 | name = "percent-encoding" 571 | version = "2.1.0" 572 | source = "registry+https://github.com/rust-lang/crates.io-index" 573 | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" 574 | 575 | [[package]] 576 | name = "pkg-config" 577 | version = "0.3.24" 578 | source = "registry+https://github.com/rust-lang/crates.io-index" 579 | checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" 580 | 581 | [[package]] 582 | name = "ppv-lite86" 583 | version = "0.2.16" 584 | source = "registry+https://github.com/rust-lang/crates.io-index" 585 | checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872" 586 | 587 | [[package]] 588 | name = "rand" 589 | version = "0.8.4" 590 | source = "registry+https://github.com/rust-lang/crates.io-index" 591 | checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8" 592 | dependencies = [ 593 | "libc", 594 | "rand_chacha", 595 | "rand_core", 596 | "rand_hc", 597 | ] 598 | 599 | [[package]] 600 | name = "rand_chacha" 601 | version = "0.3.1" 602 | source = "registry+https://github.com/rust-lang/crates.io-index" 603 | checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" 604 | dependencies = [ 605 | "ppv-lite86", 606 | "rand_core", 607 | ] 608 | 609 | [[package]] 610 | name = "rand_core" 611 | version = "0.6.3" 612 | source = "registry+https://github.com/rust-lang/crates.io-index" 613 | checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7" 614 | dependencies = [ 615 | "getrandom 0.2.4", 616 | ] 617 | 618 | [[package]] 619 | name = "rand_hc" 620 | version = "0.3.1" 621 | source = "registry+https://github.com/rust-lang/crates.io-index" 622 | checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7" 623 | dependencies = [ 624 | "rand_core", 625 | ] 626 | 627 | [[package]] 628 | name = "rayon" 629 | version = "1.5.1" 630 | source = "registry+https://github.com/rust-lang/crates.io-index" 631 | checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90" 632 | dependencies = [ 633 | "autocfg", 634 | "crossbeam-deque", 635 | "either", 636 | "rayon-core", 637 | ] 638 | 639 | [[package]] 640 | name = "rayon-core" 641 | version = "1.9.1" 642 | source = "registry+https://github.com/rust-lang/crates.io-index" 643 | checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e" 644 | dependencies = [ 645 | "crossbeam-channel", 646 | "crossbeam-deque", 647 | "crossbeam-utils", 648 | "lazy_static", 649 | "num_cpus", 650 | ] 651 | 652 | [[package]] 653 | name = "redox_syscall" 654 | version = "0.1.57" 655 | source = "registry+https://github.com/rust-lang/crates.io-index" 656 | checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" 657 | 658 | [[package]] 659 | name = "redox_users" 660 | version = "0.3.5" 661 | source = "registry+https://github.com/rust-lang/crates.io-index" 662 | checksum = "de0737333e7a9502c789a36d7c7fa6092a49895d4faa31ca5df163857ded2e9d" 663 | dependencies = [ 664 | "getrandom 0.1.16", 665 | "redox_syscall", 666 | "rust-argon2", 667 | ] 668 | 669 | [[package]] 670 | name = "rust-argon2" 671 | version = "0.8.3" 672 | source = "registry+https://github.com/rust-lang/crates.io-index" 673 | checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb" 674 | dependencies = [ 675 | "base64", 676 | "blake2b_simd", 677 | "constant_time_eq", 678 | "crossbeam-utils", 679 | ] 680 | 681 | [[package]] 682 | name = "rustc-serialize" 683 | version = "0.3.24" 684 | source = "registry+https://github.com/rust-lang/crates.io-index" 685 | checksum = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" 686 | 687 | [[package]] 688 | name = "ryu" 689 | version = "1.0.9" 690 | source = "registry+https://github.com/rust-lang/crates.io-index" 691 | checksum = "73b4b750c782965c211b42f022f59af1fbceabdd026623714f104152f1ec149f" 692 | 693 | [[package]] 694 | name = "schannel" 695 | version = "0.1.19" 696 | source = "registry+https://github.com/rust-lang/crates.io-index" 697 | checksum = "8f05ba609c234e60bee0d547fe94a4c7e9da733d1c962cf6e59efa4cd9c8bc75" 698 | dependencies = [ 699 | "lazy_static", 700 | "winapi", 701 | ] 702 | 703 | [[package]] 704 | name = "scopeguard" 705 | version = "1.1.0" 706 | source = "registry+https://github.com/rust-lang/crates.io-index" 707 | checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" 708 | 709 | [[package]] 710 | name = "serde" 711 | version = "1.0.136" 712 | source = "registry+https://github.com/rust-lang/crates.io-index" 713 | checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789" 714 | 715 | [[package]] 716 | name = "serde_json" 717 | version = "1.0.78" 718 | source = "registry+https://github.com/rust-lang/crates.io-index" 719 | checksum = "d23c1ba4cf0efd44be32017709280b32d1cea5c3f1275c3b6d9e8bc54f758085" 720 | dependencies = [ 721 | "itoa", 722 | "ryu", 723 | "serde", 724 | ] 725 | 726 | [[package]] 727 | name = "shared_child" 728 | version = "0.3.5" 729 | source = "registry+https://github.com/rust-lang/crates.io-index" 730 | checksum = "6be9f7d5565b1483af3e72975e2dee33879b3b86bd48c0929fccf6585d79e65a" 731 | dependencies = [ 732 | "libc", 733 | "winapi", 734 | ] 735 | 736 | [[package]] 737 | name = "socket2" 738 | version = "0.4.4" 739 | source = "registry+https://github.com/rust-lang/crates.io-index" 740 | checksum = "66d72b759436ae32898a2af0a14218dbf55efde3feeb170eb623637db85ee1e0" 741 | dependencies = [ 742 | "libc", 743 | "winapi", 744 | ] 745 | 746 | [[package]] 747 | name = "strsim" 748 | version = "0.8.0" 749 | source = "registry+https://github.com/rust-lang/crates.io-index" 750 | checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" 751 | 752 | [[package]] 753 | name = "sysinfo" 754 | version = "0.20.5" 755 | source = "registry+https://github.com/rust-lang/crates.io-index" 756 | checksum = "e223c65cd36b485a34c2ce6e38efa40777d31c4166d9076030c74cdcf971679f" 757 | dependencies = [ 758 | "cfg-if", 759 | "core-foundation-sys", 760 | "libc", 761 | "ntapi", 762 | "once_cell", 763 | "rayon", 764 | "winapi", 765 | ] 766 | 767 | [[package]] 768 | name = "term" 769 | version = "0.5.2" 770 | source = "registry+https://github.com/rust-lang/crates.io-index" 771 | checksum = "edd106a334b7657c10b7c540a0106114feadeb4dc314513e97df481d5d966f42" 772 | dependencies = [ 773 | "byteorder", 774 | "dirs", 775 | "winapi", 776 | ] 777 | 778 | [[package]] 779 | name = "textwrap" 780 | version = "0.11.0" 781 | source = "registry+https://github.com/rust-lang/crates.io-index" 782 | checksum = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060" 783 | dependencies = [ 784 | "unicode-width", 785 | ] 786 | 787 | [[package]] 788 | name = "time" 789 | version = "0.1.44" 790 | source = "registry+https://github.com/rust-lang/crates.io-index" 791 | checksum = "6db9e6914ab8b1ae1c260a4ae7a49b6c5611b40328a735b21862567685e73255" 792 | dependencies = [ 793 | "libc", 794 | "wasi 0.10.0+wasi-snapshot-preview1", 795 | "winapi", 796 | ] 797 | 798 | [[package]] 799 | name = "tinyvec" 800 | version = "1.5.1" 801 | source = "registry+https://github.com/rust-lang/crates.io-index" 802 | checksum = "2c1c1d5a42b6245520c249549ec267180beaffcc0615401ac8e31853d4b6d8d2" 803 | dependencies = [ 804 | "tinyvec_macros", 805 | ] 806 | 807 | [[package]] 808 | name = "tinyvec_macros" 809 | version = "0.1.0" 810 | source = "registry+https://github.com/rust-lang/crates.io-index" 811 | checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" 812 | 813 | [[package]] 814 | name = "unicode-bidi" 815 | version = "0.3.7" 816 | source = "registry+https://github.com/rust-lang/crates.io-index" 817 | checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" 818 | 819 | [[package]] 820 | name = "unicode-normalization" 821 | version = "0.1.19" 822 | source = "registry+https://github.com/rust-lang/crates.io-index" 823 | checksum = "d54590932941a9e9266f0832deed84ebe1bf2e4c9e4a3554d393d18f5e854bf9" 824 | dependencies = [ 825 | "tinyvec", 826 | ] 827 | 828 | [[package]] 829 | name = "unicode-width" 830 | version = "0.1.9" 831 | source = "registry+https://github.com/rust-lang/crates.io-index" 832 | checksum = "3ed742d4ea2bd1176e236172c8429aaf54486e7ac098db29ffe6529e0ce50973" 833 | 834 | [[package]] 835 | name = "url" 836 | version = "2.2.2" 837 | source = "registry+https://github.com/rust-lang/crates.io-index" 838 | checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" 839 | dependencies = [ 840 | "form_urlencoded", 841 | "idna", 842 | "matches", 843 | "percent-encoding", 844 | ] 845 | 846 | [[package]] 847 | name = "vcpkg" 848 | version = "0.2.15" 849 | source = "registry+https://github.com/rust-lang/crates.io-index" 850 | checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" 851 | 852 | [[package]] 853 | name = "vec_map" 854 | version = "0.8.2" 855 | source = "registry+https://github.com/rust-lang/crates.io-index" 856 | checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" 857 | 858 | [[package]] 859 | name = "wasi" 860 | version = "0.9.0+wasi-snapshot-preview1" 861 | source = "registry+https://github.com/rust-lang/crates.io-index" 862 | checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" 863 | 864 | [[package]] 865 | name = "wasi" 866 | version = "0.10.0+wasi-snapshot-preview1" 867 | source = "registry+https://github.com/rust-lang/crates.io-index" 868 | checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" 869 | 870 | [[package]] 871 | name = "winapi" 872 | version = "0.3.9" 873 | source = "registry+https://github.com/rust-lang/crates.io-index" 874 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" 875 | dependencies = [ 876 | "winapi-i686-pc-windows-gnu", 877 | "winapi-x86_64-pc-windows-gnu", 878 | ] 879 | 880 | [[package]] 881 | name = "winapi-i686-pc-windows-gnu" 882 | version = "0.4.0" 883 | source = "registry+https://github.com/rust-lang/crates.io-index" 884 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" 885 | 886 | [[package]] 887 | name = "winapi-x86_64-pc-windows-gnu" 888 | version = "0.4.0" 889 | source = "registry+https://github.com/rust-lang/crates.io-index" 890 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" 891 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "nyson" 3 | version = "0.1.19" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | chrono = "0.4.19" 10 | clippy = "0.0.302" 11 | curl = "0.4.38" 12 | git2 = "0.13.20" 13 | pbr = "1.0.4" 14 | rand = "0.8.4" 15 | serde_json = "1.0.66" 16 | meval = "0.2.0" 17 | rustc-serialize = "0.3.24" 18 | openssl = { version = "0.10", features = ["vendored"] } 19 | sysinfo = "0.20.0" 20 | humantime = "2.1.0" 21 | clap = "2.33.3" 22 | duct = "0.13.5" 23 | 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 nyson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Logos/LogoNyson.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nyson-Programing-Language/nyson/215dc1337eba1170ef1f6a40f5c169b6660fbb09/Logos/LogoNyson.png -------------------------------------------------------------------------------- /Logos/NysonLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Nyson-Programing-Language/nyson/215dc1337eba1170ef1f6a40f5c169b6660fbb09/Logos/NysonLogo.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Nyson Programming Language 2 | The official home of the Nyson Programming Language, built off Rust. 3 | (created by Nyelsonon and AMTitan, 2021) 4 | 5 | ![Logo](https://github.com/Nyelsonon/nyson-programming-language/blob/main/Logos/NysonLogo.png) 6 | 7 | ## Advertisement 8 | 9 | I cant believe we spent 7 dollars to buy a voice actor to say this stuff... 10 | 11 | https://user-images.githubusercontent.com/29708070/128087291-a6e4f541-d84f-4b28-9d02-ed5558e60878.mp4 12 | 13 | 14 | ## Contributors: 15 | 16 | #### List of users who contributed to this project! 👍 17 | 18 | ##### Neal-Kotval: https://github.com/Neal-Kotval [![wakatime](https://wakatime.com/badge/github/Nyson-Programing-Language/nyson.svg)](https://wakatime.com/badge/github/Nyson-Programing-Language/nyson) 19 | 20 | ##### AMTitan: https://github.com/AMTitan [![wakatime](https://wakatime.com/badge/github/AMTitan/nyson-programming-language.svg)](https://wakatime.com/badge/github/AMTitan/nyson-programming-language) 21 | 22 | 23 | contributors 24 | 25 | 26 | ## Stargazers (if you want to see your self star the repo and refresh the page) 27 | 28 | [![Stargazers repo roster for @Nyson-Programing-Language/nyson](https://reporoster.com/stars/Nyson-Programing-Language/nyson)](https://github.com/Nyson-Programing-Language/nyson/stargazers) 29 | 30 | ## Documentation: 31 | 32 | https://nyson-programing-language.github.io/ 33 | 34 | ## Discord 35 | 36 | https://discord.gg/qDznKHuM 37 | 38 | ## Repo: 39 | 40 | https://github.com/Nyelsonon/nyson-programming-language 41 | 42 | ## Support Us ❤️: 43 | 44 | Nyelsonon (Neal-Kotval): https://venmo.com/code?user_id=3150553001492480241&created=1626114671.90623&printed=1 45 | 46 | AMTitan: https://paypal.me/AMTitan 47 | 48 | ## Other Repos: 49 | 50 | Setup Code: https://github.com/Nyson-Programing-Language/nyson-setup 51 | 52 | Docs Code: https://github.com/Nyson-Programing-Language/nyson-programing-language.github.io 53 | 54 | IDE Code: https://github.com/Nyson-Programing-Language/Nyson-IDE 55 | 56 | VS Code Syntax Code: https://github.com/Nyson-Programing-Language/VS-Code-Nyson-Syntax 57 | 58 | 59 | ## License: 60 | ``` 61 | MIT License 62 | 63 | Copyright (c) 2021 nyson 64 | 65 | Permission is hereby granted, free of charge, to any person obtaining a copy 66 | of this software and associated documentation files (the "Software"), to deal 67 | in the Software without restriction, including without limitation the rights 68 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 69 | copies of the Software, and to permit persons to whom the Software is 70 | furnished to do so, subject to the following conditions: 71 | 72 | The above copyright notice and this permission notice shall be included in all 73 | copies or substantial portions of the Software. 74 | 75 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 76 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 77 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 78 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 79 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 80 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 81 | SOFTWARE. 82 | ``` 83 | 84 | ## To Do List: 85 | 86 | Variables :white_check_mark: 87 | 88 | If Statements :white_check_mark: 89 | 90 | Loops :white_check_mark: 91 | 92 | Math :white_check_mark: 93 | 94 | Documentation :white_check_mark: 95 | 96 | IDE :x: 97 | 98 | VS Code :x: 99 | 100 | Classes :white_check_mark: 101 | 102 | Print/Log :white_check_mark: 103 | 104 | Dependencies :white_check_mark: 105 | 106 | GUI Installer :x: 107 | -------------------------------------------------------------------------------- /examples/Calculator.nys: -------------------------------------------------------------------------------- 1 | log("This is a calculator type an equation, or type \"stop\" to stop"); 2 | dec str equation: input(); 3 | while(equation != "stop") { 4 | log(equation"="math(equation)); 5 | equation: input(); 6 | } -------------------------------------------------------------------------------- /examples/Coin Flip.nys: -------------------------------------------------------------------------------- 1 | if (math(random*2) > 1) { 2 | log("Heads"); 3 | } 4 | else { 5 | log("Tails"); 6 | } -------------------------------------------------------------------------------- /examples/Get File Extension.nys: -------------------------------------------------------------------------------- 1 | log(last(split(last(arg()), "."))) -------------------------------------------------------------------------------- /examples/Loading Bar.nys: -------------------------------------------------------------------------------- 1 | dec int number: 0; 2 | dec str loading: ""; 3 | loop(6) { 4 | loading: ""; 5 | loop(number) { 6 | loading: loading "#"; 7 | } 8 | loop(5-number) { 9 | loading: loading "-"; 10 | } 11 | log(loading); 12 | sleep(1000); 13 | number = math(number+1); 14 | } -------------------------------------------------------------------------------- /examples/Music.nys: -------------------------------------------------------------------------------- 1 | use audio; 2 | 3 | log("What do you want to play (file location)"); 4 | dec str play: input(); 5 | log("What do you want to loop the music (y or n)"); 6 | dec str loops: input(); 7 | dec str loopss: "--no-repeat"; 8 | if(loops == "y") { 9 | loopss = "-L"; 10 | } 11 | log("How loud do you want the music the music (0 being silent 1 being normal and 2 being 2x loudness)"); 12 | dec str loud: input(); 13 | dec str louds: "--gain " loud; 14 | audio(play " " loopss " " louds); -------------------------------------------------------------------------------- /examples/Neofetch.nys: -------------------------------------------------------------------------------- 1 | use os; 2 | 3 | log(" 4 | 5 | ``````````````````````` 6 | `:///////////////////-` 7 | `://///////////////-` 8 | `:///////////////:. OS: "os.name()" 9 | `://////-........ 10 | `://////` Hostname: "os.host_name()" 11 | `://////` ...` `.. `.` 12 | `://////` ....` `.. ...` Version: "os.os_version()" 13 | `://///:` ..... `.. `.--.` 14 | `:////-` ..` .. `.. `.----.` Kernel: "os.kernel_version()" 15 | `://-` ..` ..... .------.` 16 | `::. ..` `.... .------.` Uptime: "timeh(" ", math(os.uptime()*1000))" 17 | `. ..` `... .------.` 18 | .------.` Ram: "round(math(os.used_memory()/1000))"MB / "round(math(os.total_memory()/1000))"MB 19 | ````````.------.` 20 | `.---------------.` Swap: "math(os.used_swap()/1000)"MB / "math(os.total_swap()/1000)"MB 21 | `.-----------------.` 22 | `.-------------------.` 23 | ``````````````````````` 24 | 25 | ") -------------------------------------------------------------------------------- /examples/Odd or Even.nys: -------------------------------------------------------------------------------- 1 | log("Hi this is the odd or even example type a number"); 2 | dec int number: input(); 3 | if (math(number%2) == "0") { 4 | log("even"); 5 | } 6 | else { 7 | log("odd"); 8 | } -------------------------------------------------------------------------------- /examples/Random Number.nys: -------------------------------------------------------------------------------- 1 | log("This is the random number game please pick a number between 0 and 100"); 2 | dec int random_number: round(math(random*100)); 3 | dec int number_picked: input(); 4 | while(number_picked != random_number) { 5 | if (number_picked > random_number) { 6 | log("You need to pick a smaller number"); 7 | } 8 | else { 9 | log("You need to pick a bigger number"); 10 | } 11 | number_picked: input(); 12 | } 13 | log("You got it right! (it was " random_number ")"); -------------------------------------------------------------------------------- /examples/Rock Paper Scissors.nys: -------------------------------------------------------------------------------- 1 | log("This is rock paper scissors pick one (R/P/S)"); 2 | dec int picked: round(math(random*2)); 3 | dec str picked_player: input(); 4 | if (picked == "0") { 5 | log("it was a draw"); 6 | } 7 | if (picked == "1") { 8 | log("you lost"); 9 | } 10 | if (picked == "2") { 11 | log("you won"); 12 | } -------------------------------------------------------------------------------- /examples/Tic Tack Toe.nys: -------------------------------------------------------------------------------- 1 | dec arr places: "1", "2", "3", "4", "5", "6", "7", "8", "9"; 2 | dec str who_first: "x"; 3 | loop(9) { 4 | log(" 5 | "places(0)" | "places(1)" | "places(2)" 6 | --------- 7 | "places(3)" | "places(4)" | "places(5)" 8 | --------- 9 | "places(6)" | "places(7)" | "places(8)" 10 | "); 11 | log("Player "who_first" pick a space where you want to go") 12 | dec int player_pick: input(); 13 | if(places(player_pick-1) != "x" && places(player_pick-1) != "o") { 14 | places(player_pick-1): who_first; 15 | } 16 | else { 17 | log("Sorry that place is already taken"); 18 | exit(); 19 | } 20 | if(places(0) == places(1) && places(0) == places(2)) { 21 | log("player "places(0)" you won!"); 22 | exit(); 23 | } 24 | if(places(6) == places(7) && places(6) == places(8)) { 25 | log("player "places(6)" you won!"); 26 | exit(); 27 | } 28 | if(places(0) == places(3) && places(0) == places(6)) { 29 | log("player "places(0)" you won!"); 30 | exit(); 31 | } 32 | if(places(2) == places(5) && places(2) == places(8)) { 33 | log("player "places(2)" you won!"); 34 | exit(); 35 | } 36 | if(places(1) == places(4) && places(1) == places(7)) { 37 | log("player "places(1)" you won!"); 38 | exit(); 39 | } 40 | if(places(0) == places(4) && places(0) == places(8)) { 41 | log("player "places(0)" you won!"); 42 | exit(); 43 | } 44 | if(places(2) == places(4) && places(2) == places(6)) { 45 | log("player "places(2)" you won!"); 46 | exit(); 47 | } 48 | if(who_first == "x") { 49 | who_first: "o"; 50 | } 51 | else { 52 | who_first: "x"; 53 | } 54 | } 55 | log("It was a tie!"); -------------------------------------------------------------------------------- /examples/test.nys: -------------------------------------------------------------------------------- 1 | use term; 2 | log(cyan"Hello"); -------------------------------------------------------------------------------- /src/lexer.rs: -------------------------------------------------------------------------------- 1 | pub fn lexer(contents: String, dev: bool) -> Vec { 2 | let contents_literal = split(contents); 3 | let mut outputs: Vec = Vec::new(); 4 | for x in contents_literal { 5 | outputs.push(x); 6 | } 7 | outputs.remove(0); 8 | outputs = no_extra_whitespace(outputs, dev); 9 | outputs 10 | } 11 | 12 | pub fn no_extra_whitespace(mut input: Vec, dev: bool) -> Vec { 13 | if dev { 14 | println!("input: {:?}", input); 15 | } 16 | let mut quotes = 0; 17 | let mut delete = Vec::new(); 18 | let mut deleted = 0; 19 | for i in 0..input.len() { 20 | if (input[i] == "\"" || input[i] == "\'" || input[i] == r"\`") && input[i - 1] != "\\" { 21 | quotes += 1; 22 | } 23 | if quotes % 2 == 0 && input[i].trim() == "" { 24 | delete.push(i); 25 | } 26 | } 27 | 28 | for i in delete { 29 | input.remove(i - deleted); 30 | deleted += 1; 31 | } 32 | 33 | if dev { 34 | println!("input: {:?}", input); 35 | } 36 | 37 | input 38 | } 39 | 40 | pub fn split(text: String) -> Vec { 41 | let mut result = Vec::new(); 42 | let mut last = 0; 43 | for (index, matched) in text.match_indices(|c: char| !(c.is_ascii())) { 44 | if last != index { 45 | result.push(&text[last..index]); 46 | } 47 | result.push(matched); 48 | last = index + matched.len(); 49 | } 50 | if last < text.len() { 51 | result.push(&text[last..]); 52 | } 53 | 54 | let mut need_split = Vec::new(); 55 | 56 | for n in 0..result.len() { 57 | if result[n].contains(' ') { 58 | let mut number_of_string_selectors = 0; 59 | for x in 0..n { 60 | if (result[x].contains('\"') 61 | || result[x].contains('\'') 62 | || result[x].contains(r"\`")) 63 | && !(x > 0 && (result[x - 1].contains('\\'))) 64 | { 65 | number_of_string_selectors += 1; 66 | } 67 | } 68 | if number_of_string_selectors % 2 == 0 { 69 | need_split.push(n); 70 | } 71 | } 72 | } 73 | 74 | let mut output: Vec<&str> = Vec::new(); 75 | let mut inc = 0; 76 | 77 | for n in need_split { 78 | for x in output.len()..n - inc { 79 | if output.len() < n { 80 | output.push(result[x]); 81 | } 82 | } 83 | let text = result[n + inc]; 84 | let mut vec = Vec::new(); 85 | let mut last = 0; 86 | for (index, matched) in text.match_indices(|c: char| { 87 | !(c.is_alphanumeric() 88 | || c == '\'' 89 | || c == ".".chars().next().unwrap() 90 | || c == "_".chars().next().unwrap()) 91 | }) { 92 | if last != index { 93 | vec.push(&text[last..index]); 94 | } 95 | vec.push(matched); 96 | last = index + matched.len(); 97 | } 98 | if last < text.len() { 99 | vec.push(&text[last..]); 100 | } 101 | inc = inc + vec.len() - 1; 102 | 103 | for x in vec { 104 | output.push(x); 105 | } 106 | } 107 | 108 | let mut outputs: Vec = Vec::new(); 109 | 110 | let mut if_commented_out = false; 111 | let mut if_commented_out1 = false; 112 | let mut number_of_string_selectors = 0; 113 | 114 | for x in 0..output.len() { 115 | if (output[x].contains('\"') || output[x].contains('\'') || output[x].contains(r"\`")) 116 | && !(x > 0 && (output[x - 1].contains('\\'))) 117 | { 118 | number_of_string_selectors += 1; 119 | } 120 | if x < output.len() 121 | && output[x] == "/" 122 | && output[x + 1] == "/" 123 | && number_of_string_selectors % 2 == 0 124 | { 125 | if_commented_out = true; 126 | } else if output[x] == "\n" && if_commented_out { 127 | if_commented_out = false; 128 | } else if x < output.len() 129 | && output[x] == "*" 130 | && output[x + 1] == "/" 131 | && if_commented_out1 132 | && number_of_string_selectors % 2 == 0 133 | { 134 | if_commented_out1 = false; 135 | } else if x < output.len() 136 | && output[x] == "/" 137 | && output[x + 1] == "*" 138 | && number_of_string_selectors % 2 == 0 139 | { 140 | if_commented_out1 = true; 141 | } 142 | if !if_commented_out && !if_commented_out1 { 143 | outputs.push(String::from(output[x])); 144 | } 145 | } 146 | 147 | outputs 148 | } 149 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | mod lexer; 2 | mod run; 3 | 4 | use std::fs; 5 | use std::fs::File; 6 | use std::io::Write; 7 | use std::process::Command; 8 | 9 | extern crate pbr; 10 | extern crate serde_json; 11 | use clap::*; 12 | use std::collections::HashMap; 13 | 14 | use git2::Repository; 15 | use pbr::ProgressBar; 16 | use std::path::Path; 17 | 18 | use duct::cmd; 19 | 20 | fn main() { 21 | if !Path::new("dep").exists() { 22 | let r = fs::create_dir("dep"); 23 | if r.is_err() { 24 | run::error("Could not create dir.".to_string()); 25 | } 26 | } 27 | let uses: Vec = vec![ 28 | "false".to_string(), 29 | "false".to_string(), 30 | "false".to_string(), 31 | ]; 32 | let matches = App::new("Nyson") 33 | .version(env!("CARGO_PKG_VERSION")) 34 | .about("a programing language made in rust") 35 | .arg( 36 | Arg::with_name("INPUT") 37 | .help("the file to run") 38 | .required(false) 39 | .index(1), 40 | ) 41 | .arg( 42 | Arg::with_name("dev") 43 | .short("v") 44 | .long("verbose") 45 | .help("Gives you dev debug tools") 46 | .takes_value(false), 47 | ) 48 | .arg( 49 | Arg::with_name("compile") 50 | .short("c") 51 | .long("compile") 52 | .help("Compiles your program") 53 | .takes_value(false), 54 | ) 55 | .arg( 56 | Arg::with_name("run") 57 | .short("r") 58 | .long("run") 59 | .help("Runs the program") 60 | .takes_value(false), 61 | ) 62 | .arg( 63 | Arg::with_name("install") 64 | .short("i") 65 | .long("install") 66 | .help("installs all the dependencies") 67 | .takes_value(false), 68 | ) 69 | .arg( 70 | Arg::with_name("init") 71 | .long("init") 72 | .help("makes a new project") 73 | .takes_value(false), 74 | ) 75 | .arg( 76 | Arg::with_name("output") 77 | .long("output") 78 | .short("o") 79 | .help("sets the output file name") 80 | .takes_value(true), 81 | ) 82 | .get_matches(); 83 | let compile = matches.is_present("compile"); 84 | let run = matches.is_present("run"); 85 | let dev = matches.is_present("dev"); 86 | let file; 87 | if matches.is_present("INPUT") || run { 88 | file = matches.value_of("INPUT").unwrap().to_string(); 89 | } else { 90 | loop { 91 | println!(">> (type quit to quit)"); 92 | let mut line = String::new(); 93 | std::io::stdin().read_line(&mut line).unwrap(); 94 | line = line.trim().parse().unwrap(); 95 | if line == "exit" || line == "quit" { 96 | std::process::exit(1); 97 | } else { 98 | let mut space: String = " ".parse().unwrap(); 99 | space.push_str(&line); 100 | let contents = space; 101 | if dev { 102 | println!("contents: {:?}", contents); 103 | } 104 | let to_parse = lexer::lexer(contents, dev); 105 | let _output = run::run( 106 | to_parse, 107 | dev, 108 | uses.clone(), 109 | Vec::new(), 110 | Vec::new(), 111 | Vec::new(), 112 | Vec::new(), 113 | Vec::new(), 114 | Vec::new(), 115 | ); 116 | 117 | //run and delete 118 | } 119 | } 120 | }; 121 | let maybe_contents; 122 | if run { 123 | maybe_contents = fs::read_to_string("src/main.nys") 124 | } else { 125 | maybe_contents = fs::read_to_string(file) 126 | } 127 | let mut contents = if maybe_contents.is_ok() { 128 | maybe_contents.unwrap() 129 | } else { 130 | run::error("Could not open file for reading.".to_string()); 131 | "".to_string() 132 | }; 133 | let mut space: String = " ".to_string(); 134 | space.push_str(contents.as_str()); 135 | contents = space; 136 | if dev { 137 | println!("contents: {:?}", contents); 138 | } 139 | if !compile { 140 | let to_parse = lexer::lexer(contents, dev); 141 | run_code( 142 | run::run( 143 | to_parse, 144 | dev, 145 | uses, 146 | Vec::new(), 147 | Vec::new(), 148 | Vec::new(), 149 | Vec::new(), 150 | Vec::new(), 151 | Vec::new(), 152 | ), 153 | dev, 154 | ) 155 | .unwrap(); 156 | if Path::new("./nyson").exists() { 157 | cmd!("./nyson").run(); 158 | fs::remove_file("./nyson"); 159 | } else if Path::new("./nyson.exe").exists() { 160 | cmd!("./nyson.exe").run(); 161 | fs::remove_file("./nyson.exe"); 162 | } 163 | } else { 164 | let to_parse = lexer::lexer(contents, dev); 165 | run_code( 166 | run::run( 167 | to_parse, 168 | dev, 169 | uses, 170 | Vec::new(), 171 | Vec::new(), 172 | Vec::new(), 173 | Vec::new(), 174 | Vec::new(), 175 | Vec::new(), 176 | ), 177 | dev, 178 | ) 179 | .unwrap(); 180 | if matches.is_present("output") { 181 | if Path::new("./nyson").exists() { 182 | fs::rename("nyson", matches.value_of("output").unwrap()).unwrap(); 183 | } else if Path::new("./nyson.exe").exists() { 184 | fs::rename("nyson.exe", matches.value_of("output").unwrap()).unwrap(); 185 | } 186 | } 187 | } 188 | } 189 | 190 | fn set_cont(loc: String, cont: String) -> std::io::Result<()> { 191 | let mut file = File::create(loc)?; 192 | file.write_all(cont.as_bytes())?; 193 | Ok(()) 194 | } 195 | 196 | fn copy(path1: String, path2: String) -> std::io::Result<()> { 197 | fs::copy(path1, path2)?; 198 | Ok(()) 199 | } 200 | 201 | fn delete(path: String) -> std::io::Result<()> { 202 | fs::remove_dir_all(path)?; 203 | Ok(()) 204 | } 205 | 206 | fn loop_throught_dir(dir: &Path) { 207 | if dir.is_dir() { 208 | let folder = fs::read_dir(dir).unwrap(); 209 | let mut pb = ProgressBar::new(fs::read_dir(dir).unwrap().count() as u64); 210 | for item in folder { 211 | let path = item.unwrap().path(); 212 | if path.is_dir() { 213 | make_path(path.as_path().to_string_lossy().to_string()); 214 | pb.inc(); 215 | } 216 | } 217 | } 218 | } 219 | 220 | fn make_path(path: String) { 221 | let mut path_made = path.clone(); 222 | if !path.is_empty() { 223 | path_made.push_str("/dep"); 224 | } else { 225 | path_made.push_str("dep") 226 | } 227 | let r = fs::remove_dir_all(path_made.clone()); 228 | if r.is_err() { 229 | run::error("Could not delete dir.".to_string()); 230 | } 231 | let r = fs::create_dir(path_made); 232 | if r.is_err() { 233 | run::error("Could not create dir.".to_string()); 234 | } 235 | let mut path_made = path.clone(); 236 | if !path.is_empty() { 237 | path_made.push_str("/Nyson.json"); 238 | } else { 239 | path_made.push_str("Nyson.json") 240 | } 241 | let json: serde_json::Value = serde_json::from_str( 242 | String::from_utf8_lossy(fs::read_to_string(path_made).unwrap().as_ref()) 243 | .to_string() 244 | .as_str(), 245 | ) 246 | .expect("file should be proper JSON"); 247 | let json: HashMap = 248 | serde_json::from_str(json["dep"].to_string().as_str()).unwrap(); 249 | let mut pb = ProgressBar::new(json.len() as u64); 250 | for item in json { 251 | let mut new_path = path.clone(); 252 | if !path.is_empty() { 253 | new_path.push_str("/dep/"); 254 | } else { 255 | new_path.push_str("dep/"); 256 | } 257 | new_path.push_str(item.0.as_str()); 258 | let url = item.1; 259 | let _repo = match Repository::clone(url.as_str(), new_path.clone()) { 260 | Ok(repo) => repo, 261 | Err(e) => { 262 | run::error(["failed to clone: ", e.to_string().as_str()].join("")); 263 | Repository::clone(url.as_str(), new_path.clone()).unwrap() 264 | } 265 | }; 266 | pb.inc(); 267 | } 268 | let mut new_path = path.clone(); 269 | if !path.is_empty() { 270 | new_path.push_str("/dep/"); 271 | } else { 272 | new_path.push_str("dep/"); 273 | } 274 | loop_throught_dir(new_path.as_ref()); 275 | } 276 | 277 | fn run_code(input: String, dev: bool) -> std::io::Result<()> { 278 | let mut nyson_rs = std::env::temp_dir(); 279 | nyson_rs.push("nyson.rs"); 280 | let mut file = File::create(nyson_rs.to_str().unwrap())?; 281 | file.write_all(input.as_bytes())?; 282 | let output = Command::new("rustc") 283 | .arg("-O") 284 | .arg("-A") 285 | .arg("dead_code") 286 | .arg(nyson_rs.to_str().unwrap()) 287 | .output() 288 | .expect("command failed to start"); 289 | if !output.status.success() || dev { 290 | println!("code: {}", input); 291 | println!("version: {}", env!("CARGO_PKG_VERSION")); 292 | println!("stderr: {}", String::from_utf8_lossy(&output.stderr)); 293 | } 294 | if !output.status.success() { 295 | println!("\x1b[0;31mI GOT AN ERROR (please make an issue on the github page with this output :) its https://github.com/Nyson-Programing-Language/nyson)\x1b[0m"); 296 | } 297 | fs::remove_file(nyson_rs.to_str().unwrap())?; 298 | Ok(()) 299 | } 300 | -------------------------------------------------------------------------------- /src/run.rs: -------------------------------------------------------------------------------- 1 | mod functions; 2 | use crate::lexer; 3 | use std::env; 4 | use std::process::Command; 5 | use std::thread; 6 | 7 | extern crate chrono; 8 | extern crate meval; 9 | 10 | pub fn run( 11 | mut contents: Vec, 12 | dev: bool, 13 | mut uses: Vec, 14 | mut memory_names: Vec, 15 | mut memory_values: Vec, 16 | mut memory_types: Vec, 17 | mut func_names: Vec, 18 | mut func_par: Vec, 19 | mut func_code: Vec, 20 | ) -> String { 21 | let mut returns = " 22 | use std::io::Read; 23 | use std::net::TcpStream; 24 | use std::time::{SystemTime, UNIX_EPOCH}; 25 | use std::io::Write; 26 | use std::fs::File; 27 | use std::process::Command; 28 | fn internet_time() -> f64 { 29 | let mut stream = TcpStream::connect(\"time.nist.gov:13\").unwrap(); 30 | let mut buffer = String::new(); 31 | stream.read_to_string(&mut buffer).unwrap(); 32 | buffer = buffer.trim().to_string(); 33 | let days = buffer.split(\" \").nth(0).unwrap().parse::().unwrap() - 40587; 34 | let hours = buffer 35 | .split(\" \") 36 | .nth(2) 37 | .unwrap() 38 | .split(\":\") 39 | .nth(0) 40 | .unwrap() 41 | .parse::() 42 | .unwrap(); 43 | let mins = buffer 44 | .split(\" \") 45 | .nth(2) 46 | .unwrap() 47 | .split(\":\") 48 | .nth(1) 49 | .unwrap() 50 | .parse::() 51 | .unwrap(); 52 | let seconds = buffer 53 | .split(\" \") 54 | .nth(2) 55 | .unwrap() 56 | .split(\":\") 57 | .nth(2) 58 | .unwrap() 59 | .parse::() 60 | .unwrap(); 61 | let milliseconds = buffer 62 | .replace(\" \", \" \") 63 | .replace(\" \", \" \") // for if there is a single digit millisecond 64 | .split(\" \") 65 | .nth(6) 66 | .unwrap() 67 | .parse::() 68 | .unwrap() 69 | .floor() as usize; 70 | let unix_time_stamp = days * 24 * 60 * 60 * 1000 71 | + hours * 60 * 60 * 1000 72 | + mins * 60 * 1000 73 | + seconds * 1000 74 | + milliseconds; 75 | return unix_time_stamp as f64; 76 | } 77 | fn time() -> f64 { 78 | let start = SystemTime::now(); 79 | start 80 | .duration_since(UNIX_EPOCH) 81 | .expect(\"Time went backwards\") 82 | .as_millis() as f64 83 | } 84 | fn input() -> String { 85 | let mut line = String::new(); 86 | std::io::stdin().read_line(&mut line).unwrap(); 87 | return line.trim().to_string(); 88 | } 89 | fn exec(input:String) -> String { 90 | let output = if cfg!(target_os = \"windows\") { 91 | Command::new(\"cmd\") 92 | .args([\"/C\", &input]) 93 | .output() 94 | .expect(\"failed to execute process\") 95 | } else { 96 | Command::new(\"sh\") 97 | .arg(\"-c\") 98 | .arg(&input) 99 | .output() 100 | .expect(\"failed to execute process\") 101 | }; 102 | 103 | String::from_utf8_lossy(&output.stdout).to_string() 104 | } 105 | fn set_contents(file_s:String,text_s:String) -> std::io::Result<()> { 106 | let mut file = File::create(file_s)?; 107 | file.write_all(text_s.as_ref())?; 108 | Ok(()) 109 | } 110 | fn split_k(text:String, spliter:String) -> Vec { 111 | let mut result = Vec::new(); 112 | let mut last = 0; 113 | for i in text.split(&spliter.clone()) { 114 | result.push(i.to_string()); 115 | result.push(spliter.clone()); 116 | } 117 | result.pop(); 118 | result 119 | } 120 | fn request(input:Vec) -> String { 121 | let url = input.get(1).unwrap().trim().to_string(); 122 | let mut tcpstream_url = \"\"; 123 | let mut tcpstream_url_path = \"\"; 124 | let mut split = url.split('/').collect::>(); 125 | let mut right_part; 126 | let mut right_part1; 127 | if url.starts_with(\"http\") { 128 | tcpstream_url = url.split('/').nth(2).unwrap(); 129 | if url.split('/').count() > 3 { 130 | right_part = &split[3..]; 131 | right_part1 = right_part.join(\"/\"); 132 | tcpstream_url_path = &right_part1; 133 | } 134 | } 135 | else { 136 | tcpstream_url = url.split('/').nth(0).unwrap(); 137 | if url.split('/').count() > 1 { 138 | right_part = &split[1..]; 139 | right_part1 = right_part.join(\"/\"); 140 | tcpstream_url_path = &right_part1; 141 | } 142 | } 143 | let mut stream = TcpStream::connect(format!(\"{}:80\", tcpstream_url.trim())).unwrap(); 144 | let mut headers = \"\".to_string(); 145 | if input.len() > 3 { 146 | headers = format!(\"\\r\\nHost: {}\\r\\nAccept: */*\\r\\nContent-Length: {}\\r\\n{}\", tcpstream_url.trim(), input.get(2).unwrap().trim().len(), input[3..].join(\"\\r\\n\")); 147 | } 148 | else { 149 | headers = format!(\"\\r\\nHost: {}\\r\\nAccept: */*\\r\\nContent-Length: {}\", tcpstream_url.trim(), input.get(2).unwrap().trim().len()); 150 | } 151 | let mut cont = \"\"; 152 | if input.len() > 2 { 153 | cont = input.get(2).unwrap(); 154 | } 155 | stream.write(format!(\"{} /{} HTTP/1.1{}\\r\\n\\r\\n{}\", input.get(0).unwrap().trim().to_string(), tcpstream_url_path, headers, cont.trim()).as_bytes()); 156 | let mut buffer = [0; 4096]; 157 | let mut total = \"\".to_string(); 158 | stream.read(&mut buffer).unwrap(); 159 | let response: String = String::from_utf8_lossy(&buffer).to_string(); 160 | let mut read_rest = 0; 161 | for i in response.to_lowercase().lines() { 162 | if i.starts_with(\"Content-Type\") { 163 | read_rest = i.split(\": \").nth(1).unwrap().parse::().unwrap(); 164 | } 165 | } 166 | read_rest+=response.split(\"\\r\\n\\r\\n\").nth(0).unwrap().len()+4; 167 | total.push_str(&response); 168 | while total.len() < read_rest { 169 | stream.read(&mut buffer).unwrap(); 170 | total.push_str(&String::from_utf8_lossy(&buffer).to_string()); 171 | } 172 | response.trim().to_string().split(\"\\r\\n\\r\\n\").nth(1).unwrap().to_string() 173 | } 174 | fn main() {" 175 | .to_string(); 176 | let mut newcont: Vec = vec![" ".to_string()]; 177 | for i in lexer::lexer(code_to_add(), dev) { 178 | newcont.push(i); 179 | } 180 | for i in contents { 181 | newcont.push(i); 182 | } 183 | contents = newcont.clone(); 184 | if dev { 185 | println!("contents: {:?}", contents); 186 | } 187 | let mut quotes = 0; 188 | let mut squigle = 0; 189 | let mut readfrom = 0; 190 | let mut read = true; 191 | let mut group_memory: Vec = Vec::new(); 192 | while read { 193 | read = false; 194 | let mut skiperwiper = false; 195 | for x in readfrom..contents.len() { 196 | if !skiperwiper { 197 | if (contents[x] == "\"" || contents[x] == "\'" || contents[x] == r"\`") 198 | && contents[x - 1] != "\\" 199 | { 200 | quotes += 1; 201 | } 202 | if (contents[x] == "{" || contents[x] == "[" || contents[x] == "(") 203 | && quotes % 2 == 0 204 | { 205 | squigle += 1; 206 | } 207 | if (contents[x] == "}" || contents[x] == "]" || contents[x] == ")") 208 | && quotes % 2 == 0 209 | { 210 | squigle -= 1; 211 | } 212 | 213 | if dev { 214 | println!("contents[x]: {}", contents[x]); 215 | println!("x: {}", x); 216 | println!("quotes: {}", quotes); 217 | println!("squigle: {}", squigle); 218 | } 219 | 220 | if quotes % 2 == 0 && squigle == 0 { 221 | if "log" == contents[x].as_str() { 222 | returns = format!( 223 | "{}{}", 224 | returns, 225 | functions::log( 226 | x, 227 | contents.clone(), 228 | memory_names.clone(), 229 | memory_values.clone(), 230 | memory_types.clone(), 231 | func_names.clone(), 232 | func_par.clone(), 233 | func_code.clone(), 234 | dev, 235 | uses.clone(), 236 | ) 237 | ); 238 | } else if "ret" == contents[x].as_str() { 239 | returns = format!( 240 | "{}return {};", 241 | returns, 242 | functions::getstring( 243 | x, 244 | contents.clone(), 245 | memory_names.clone(), 246 | memory_values.clone(), 247 | memory_types.clone(), 248 | func_names.clone(), 249 | func_par.clone(), 250 | func_code.clone(), 251 | dev, 252 | uses.clone(), 253 | 0 254 | ) 255 | .first() 256 | .unwrap() 257 | ); 258 | } else if "use" == contents[x].as_str() { 259 | if contents[x + 1].as_str() == "os" { 260 | uses[0] = "true".to_string(); 261 | } else if contents[x + 1].as_str() == "audio" { 262 | uses[1] = "true".to_string(); 263 | } else if contents[x + 1].as_str() == "term" { 264 | uses[2] = "true".to_string(); 265 | returns = format!( 266 | "{} 267 | let reset=\"\\x1b[0m\"; 268 | let bold=\"\\x1b[1m\"; 269 | let dim=\"\\x1b[2m\"; 270 | let italic=\"\\x1b[3m\"; 271 | let underline=\"\\x1b[4m\"; 272 | let blinking=\"\\x1b[5m\"; 273 | let reverse=\"\\x1b[7m\"; 274 | let invisible=\"\\x1b[8m\"; 275 | let strikethrough=\"\\x1b[9m\"; 276 | let black=\"\\x1b[30m\"; 277 | let red=\"\\x1b[31m\"; 278 | let green=\"\\x1b[32m\"; 279 | let yellow=\"\\x1b[33m\"; 280 | let blue=\"\\x1b[34m\"; 281 | let magenta=\"\\x1b[35m\"; 282 | let cyan=\"\\x1b[36m\"; 283 | let white=\"\\x1b[37m\"; 284 | let default=\"\\x1b[39m\"; 285 | let background_black=\"\\x1b[40m\"; 286 | let background_red=\"\\x1b[41m\"; 287 | let background_green=\"\\x1b[42m\"; 288 | let background_yellow=\"\\x1b[43m\"; 289 | let background_blue=\"\\x1b[44m\"; 290 | let background_magenta=\"\\x1b[45m\"; 291 | let background_cyan=\"\\x1b[46m\"; 292 | let background_white=\"\\x1b[47m\"; 293 | let background_default=\"\\x1b[49m\"; 294 | let bright_black=\"\\x1b[90m\"; 295 | let bright_red=\"\\x1b[91m\"; 296 | let bright_green=\"\\x1b[92m\"; 297 | let bright_yellow=\"\\x1b[93m\"; 298 | let bright_blue=\"\\x1b[94m\"; 299 | let bright_magenta=\"\\x1b[95m\"; 300 | let bright_cyan=\"\\x1b[96m\"; 301 | let bright_white=\"\\x1b[97m\"; 302 | let bright_background_black=\"\\x1b[100m\"; 303 | let bright_background_red=\"\\x1b[101m\"; 304 | let bright_background_green=\"\\x1b[102m\"; 305 | let bright_background_yellow=\"\\x1b[103m\"; 306 | let bright_background_blue=\"\\x1b[104m\"; 307 | let bright_background_magenta=\"\\x1b[105m\"; 308 | let bright_background_cyan=\"\\x1b[106m\"; 309 | let bright_background_white=\"\\x1b[107m\";", 310 | // need to add the rest from https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797 311 | returns 312 | ); 313 | } 314 | } else if "request" == contents[x].as_str() { 315 | returns = format!( 316 | "{}{};", 317 | returns, 318 | functions::request( 319 | x, 320 | contents.clone(), 321 | memory_names.clone(), 322 | memory_values.clone(), 323 | memory_types.clone(), 324 | func_names.clone(), 325 | func_par.clone(), 326 | func_code.clone(), 327 | dev, 328 | uses.clone(), 329 | ) 330 | ); 331 | } else if "exit" == contents[x].as_str() { 332 | returns = format!("{}std::process::exit(1);", returns); 333 | } else if "audio" == contents[x].as_str() 334 | && uses[1] == *"true" 335 | && "use" != contents[x - 1].as_str() 336 | { 337 | let contents_save = contents.clone(); 338 | let memory_types_save = memory_types.clone(); 339 | let memory_values_save = memory_values.clone(); 340 | let memory_names_save = memory_names.clone(); 341 | let func_names_save = func_names.clone(); 342 | let func_par_save = func_par.clone(); 343 | let func_code_save = func_code.clone(); 344 | let uses_save = uses.clone(); 345 | let _handle = thread::spawn(move || { 346 | let stringreturn = functions::getstring( 347 | x, 348 | contents_save.clone(), 349 | memory_names_save.clone(), 350 | memory_values_save.clone(), 351 | memory_types_save.clone(), 352 | func_names_save.clone(), 353 | func_par_save.clone(), 354 | func_code_save.clone(), 355 | dev, 356 | uses_save, 357 | 0, 358 | ) 359 | .first() 360 | .unwrap() 361 | .to_string(); 362 | if env::consts::OS == "linux" { 363 | let mut vecs = stringreturn.replace('\n', " "); 364 | vecs = vecs.replace('\t', " "); 365 | let endvec: Vec<&str> = vecs.split(' ').collect(); 366 | Command::new("cvlc") 367 | .args(endvec) 368 | .output() 369 | .expect("failed to execute process"); 370 | } else if env::consts::OS == "windows" { 371 | let mut endvec: Vec<&str> = Vec::new(); 372 | endvec.push("/C"); 373 | let mut endstirng: String = r"'%PROGRAMFILES%\VideoLAN\VLC\vlc.exe' -I dummy --dummy-quiet ".to_string(); 374 | endstirng.push_str(&stringreturn); 375 | println!("{:?}", endstirng); 376 | endvec.push(&endstirng); 377 | endvec.push("-I"); 378 | endvec.push("dummy"); 379 | endvec.push("--dummy-quiet"); 380 | endvec.push(&stringreturn); 381 | println!("{:?}", endvec); 382 | Command::new("cmd") 383 | .args(endvec) 384 | .output() 385 | .expect("failed to execute process"); 386 | } else if env::consts::OS == "macos" { 387 | let mut vecs = stringreturn.replace('\n', " "); 388 | vecs = vecs.replace('\t', " "); 389 | let mut endvec: Vec<&str> = vec!["-I", "rc"]; 390 | for q in vecs.split(' ') { 391 | endvec.push(q); 392 | } 393 | Command::new("/Applications/VLC.app/Contents/MacOS/VLC") 394 | .args(endvec) 395 | .output() 396 | .expect("failed to execute process"); 397 | } 398 | }); 399 | //threads.push(handle); 400 | } else if "loop" == contents[x].as_str() { 401 | readfrom = x + 1; 402 | skiperwiper = true; 403 | read = true; 404 | let mut vec: Vec = Vec::new(); 405 | let mut skip = false; 406 | let number_of_times = functions::math( 407 | x, 408 | contents.clone(), 409 | memory_names.clone(), 410 | memory_values.clone(), 411 | func_names.clone(), 412 | func_par.clone(), 413 | func_code.clone(), 414 | uses.clone(), 415 | ); 416 | if number_of_times > 0 as f64 { 417 | let mut n = 0; 418 | let mut reached = false; 419 | let mut loc1 = 0; 420 | let mut loc2 = 0; 421 | for y in x + 1..contents.len() { 422 | if !skip { 423 | if contents[y] == "{" { 424 | n += 1; 425 | reached = true; 426 | if n == 1 { 427 | loc1 = y; 428 | } 429 | } else if contents[y] == "}" { 430 | n -= 1; 431 | } 432 | if n > 0 { 433 | vec.push(contents[y].parse().unwrap()); 434 | } else if reached { 435 | skip = true; 436 | loc2 = y; 437 | } 438 | } 439 | } 440 | vec.remove(0); 441 | returns = format!( 442 | "{}for _ in 0..{}{{{}}};", 443 | number_of_times, 444 | returns, 445 | run( 446 | vec, 447 | dev, 448 | uses.clone(), 449 | Vec::new(), 450 | Vec::new(), 451 | Vec::new(), 452 | Vec::new(), 453 | Vec::new(), 454 | Vec::new(), 455 | ) 456 | ); 457 | } 458 | } else if "while" == contents[x].as_str() { 459 | readfrom = x; 460 | skiperwiper = true; 461 | read = true; 462 | let mut vec: Vec = Vec::new(); 463 | let mut skip = false; 464 | let mut n = 0; 465 | let mut reached = false; 466 | let mut loc2 = 0; 467 | for y in x + 1..contents.len() { 468 | if !skip { 469 | if contents[y] == "{" { 470 | n += 1; 471 | reached = true; 472 | } else if contents[y] == "}" { 473 | n -= 1; 474 | } 475 | if n > 0 { 476 | vec.push(contents[y].parse().unwrap()); 477 | } else if reached { 478 | skip = true; 479 | loc2 = y; 480 | } 481 | } 482 | } 483 | returns = format!( 484 | "{}while {{{}}}", 485 | returns, 486 | run( 487 | vec, 488 | dev, 489 | uses.clone(), 490 | Vec::new(), 491 | Vec::new(), 492 | Vec::new(), 493 | Vec::new(), 494 | Vec::new(), 495 | Vec::new(), 496 | ) 497 | ); 498 | } else if "sleep" == contents[x].as_str() { 499 | let number_of_times = functions::math( 500 | x, 501 | contents.clone(), 502 | memory_names.clone(), 503 | memory_values.clone(), 504 | func_names.clone(), 505 | func_par.clone(), 506 | func_code.clone(), 507 | uses.clone(), 508 | ); 509 | returns = format!( 510 | "{}thread::sleep(time::Duration::from_millis({}));", 511 | returns, number_of_times as u64 512 | ); 513 | } else if "exec" == contents[x].as_str() { 514 | returns = format!( 515 | "{}{};", 516 | returns, 517 | functions::exec( 518 | x, 519 | contents.clone(), 520 | memory_names.clone(), 521 | memory_values.clone(), 522 | memory_types.clone(), 523 | func_names.clone(), 524 | func_par.clone(), 525 | func_code.clone(), 526 | dev, 527 | uses.clone(), 528 | ) 529 | ); 530 | } else if "setcont" == contents[x].as_str() { 531 | let function = functions::set_contents( 532 | x, 533 | contents.clone(), 534 | memory_names.clone(), 535 | memory_values.clone(), 536 | memory_types.clone(), 537 | func_names.clone(), 538 | func_par.clone(), 539 | func_code.clone(), 540 | dev, 541 | uses.clone(), 542 | ); 543 | returns = format!("{}{}", returns, function); 544 | } else if "eval" == contents[x].as_str() { 545 | let imp = functions::eval_eval( 546 | x, 547 | contents.clone(), 548 | memory_names.clone(), 549 | memory_values.clone(), 550 | memory_types.clone(), 551 | func_names.clone(), 552 | func_par.clone(), 553 | func_code.clone(), 554 | dev, 555 | uses.clone(), 556 | ); 557 | readfrom = x; 558 | skiperwiper = true; 559 | read = true; 560 | let mut delete = Vec::new(); 561 | let mut deleted = 0; 562 | let mut pass = false; 563 | let mut n3 = 0; 564 | delete.push(x); 565 | for y1 in x + 1..contents.len() { 566 | if !pass { 567 | if contents[y1] == "(" { 568 | n3 += 1; 569 | } 570 | if n3 == 0 { 571 | pass = true; 572 | } 573 | if contents[y1] == ")" { 574 | n3 -= 1; 575 | } 576 | delete.push(y1); 577 | } 578 | } 579 | for item in delete { 580 | contents.remove(item - deleted); 581 | deleted += 1; 582 | } 583 | let mut new_vec = Vec::new(); 584 | for itom in 0..contents.len() { 585 | if itom == x - 1 { 586 | new_vec.push(contents[itom].clone()); 587 | for item in imp.clone() { 588 | new_vec.push(item); 589 | } 590 | } else { 591 | new_vec.push(contents[itom].clone()); 592 | } 593 | } 594 | contents = new_vec; 595 | } else if "imp" == contents[x].as_str() { 596 | let imp = functions::imp( 597 | x, 598 | contents.clone(), 599 | memory_names.clone(), 600 | memory_values.clone(), 601 | memory_types.clone(), 602 | func_names.clone(), 603 | func_par.clone(), 604 | func_code.clone(), 605 | dev, 606 | uses.clone(), 607 | "".to_string(), 608 | ); 609 | readfrom = x; 610 | skiperwiper = true; 611 | read = true; 612 | let mut delete = Vec::new(); 613 | let mut deleted = 0; 614 | let mut pass = false; 615 | let mut n3 = 0; 616 | delete.push(x); 617 | for y1 in x + 1..contents.len() { 618 | if !pass { 619 | if contents[y1] == "(" { 620 | n3 += 1; 621 | } 622 | if n3 == 0 { 623 | pass = true; 624 | } 625 | if contents[y1] == ")" { 626 | n3 -= 1; 627 | } 628 | delete.push(y1); 629 | } 630 | } 631 | for item in delete { 632 | contents.remove(item - deleted); 633 | deleted += 1; 634 | } 635 | let mut new_vec = Vec::new(); 636 | for itom in 0..contents.len() { 637 | if itom == x - 1 { 638 | new_vec.push(contents[itom].clone()); 639 | for item in imp.clone() { 640 | new_vec.push(item); 641 | } 642 | } else { 643 | new_vec.push(contents[itom].clone()); 644 | } 645 | } 646 | contents = new_vec; 647 | } else if "dec" == contents[x].as_str() { 648 | let _memory_names1 = memory_names.clone(); 649 | let _memory_values1 = memory_values.clone(); 650 | let _memory_types1 = memory_types.clone(); 651 | let _func_names1 = func_names.clone(); 652 | let _func_par1 = func_par.clone(); 653 | let _func_code1 = func_code.clone(); 654 | let _memory_names_save = memory_names.clone(); 655 | let _memory_values_save = memory_values.clone(); 656 | let mut types = false; 657 | let mut position = x + 1; 658 | let _square_brackets = 0; 659 | let mut exists = memory_names.len(); 660 | 661 | if memory_names.contains(&contents[position + 1]) { 662 | for item in 0..memory_names.len() { 663 | if memory_names[item] == contents[position + 1] { 664 | exists = item; 665 | } 666 | } 667 | } 668 | 669 | // get type 670 | if contents[position] == "int" 671 | || contents[position] == "str" 672 | || contents[position] == "arr" 673 | || contents[position] == "grp" 674 | || contents[position] == "inf" 675 | { 676 | if exists != memory_names.len() { 677 | memory_types[exists] = contents[position].to_string(); 678 | memory_names[exists] = contents[position + 1].clone(); 679 | } else { 680 | memory_types.push(contents[position].to_string()); 681 | memory_names.push(contents[position + 1].clone()); 682 | } 683 | position += 1; 684 | } else if contents[position] == "anon" { 685 | types = true; 686 | if exists != memory_names.len() { 687 | memory_types[exists] = "anon".to_string(); 688 | } else { 689 | memory_types.push(String::from("anon")); 690 | } 691 | } 692 | 693 | //more vars 694 | let clone_class = String::from(""); 695 | let _value = String::new(); 696 | let value_array: Vec = Vec::new(); 697 | let mut value_group = Vec::new(); 698 | 699 | //more vars 700 | let _n = 0; 701 | let _quote = 0; 702 | let _squig = 0; // brace/squiggly bracket checker 703 | let _brackets = 0; 704 | 705 | //more vars 706 | position += 2; 707 | let _group = false; 708 | 709 | let mut pass_vec: Vec = Vec::new(); 710 | pass_vec.push("a".to_string()); 711 | pass_vec.push("(".to_string()); 712 | if contents[x + 1] == "int" { 713 | pass_vec.push("math".to_string()); 714 | pass_vec.push("(".to_string()); 715 | } 716 | loop { 717 | if contents[position] == "\n" || contents[position] == ";" { 718 | break; 719 | } 720 | pass_vec.push(contents[position].clone().to_string()); 721 | position += 1; 722 | } 723 | pass_vec.push(")".to_string()); 724 | if contents[x + 1] == "int" { 725 | pass_vec.push(")".to_string()); 726 | } 727 | let value = functions::getstring( 728 | 0, 729 | pass_vec.clone(), 730 | memory_names.clone(), 731 | memory_values.clone(), 732 | memory_types.clone(), 733 | func_names.clone(), 734 | func_par.clone(), 735 | func_code.clone(), 736 | dev, 737 | uses.clone(), 738 | 0, 739 | ) 740 | .join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 741 | .to_string(); 742 | if value_array.join("") != "" { 743 | memory_values.push( 744 | value_array 745 | .join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 746 | .clone(), 747 | ); 748 | } else if value_group.join("") != "" { 749 | value_group.push(clone_class.clone()); 750 | memory_values.push( 751 | value_group 752 | .join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 753 | .clone(), 754 | ); 755 | let name_of_item = memory_names[memory_names.len() - 1].clone(); 756 | for d in 0..value_group.len() - 1 { 757 | let mut name: String = name_of_item.to_string(); 758 | name.push('.'); 759 | let mut location = 0; 760 | for items in 0..group_memory.len() { 761 | if items < group_memory.len() - 1 762 | && group_memory[items + 1].parse::().is_ok() 763 | && group_memory[items] == clone_class.clone() 764 | { 765 | location = items + (d * 2) + 3; 766 | } 767 | } 768 | name.push_str(&group_memory[location]); 769 | if exists != memory_names.len() { 770 | memory_names[exists] = name.clone(); 771 | memory_values[exists] = value_group[d].clone(); 772 | memory_types[exists] = "str".parse().unwrap(); 773 | } else { 774 | memory_names.push(name.clone()); 775 | memory_values.push(value_group[d].clone()); 776 | memory_types.push("str".parse().unwrap()); 777 | } 778 | } 779 | } else if memory_types[memory_types.len() - 1] == "int" { 780 | let number = meval::eval_str(value.clone().as_str()); 781 | if number.is_ok() { 782 | if exists != memory_values.len() { 783 | memory_values[exists] = number.unwrap().to_string(); 784 | } else { 785 | memory_values.push(number.unwrap().to_string()); 786 | } 787 | } else if exists != memory_values.len() { 788 | memory_values[exists] = value.clone(); 789 | } else { 790 | memory_values.push(value.clone()); 791 | } 792 | } else if exists != memory_values.len() { 793 | memory_values[exists] = value.clone(); 794 | } else { 795 | memory_values.push(value.clone()); 796 | } 797 | 798 | if types { 799 | if exists != memory_names.len() { 800 | memory_names[exists] = value.clone(); 801 | } else { 802 | memory_names.push(value.clone()); 803 | } 804 | } 805 | if dev { 806 | println!("memory_names: {:?}", memory_names); 807 | println!("memory_types: {:?}", memory_types); 808 | println!("memory_values: {:?}", memory_values); 809 | } 810 | } else if "group" == contents[x].as_str() { 811 | let build_name = contents[x + 1].clone(); 812 | let mut objects: Vec = Vec::new(); 813 | for j in x + 2..contents.len() { 814 | if contents[j] == "}" { 815 | break; 816 | } 817 | objects.push(contents[j].clone()) 818 | } 819 | let mut objects_object: Vec = Vec::new(); 820 | for y in 0..objects.len() { 821 | if objects[y] != "," 822 | && objects[y] != " " 823 | && objects[y] != "\r" 824 | && objects[y] != "\n" 825 | && objects[y] != "\"" 826 | && objects[y] != "{" 827 | && objects[y] != "}" 828 | { 829 | objects_object.push(objects[y].clone().to_string()) 830 | } 831 | } 832 | String::new(); 833 | group_memory.push(build_name.clone()); 834 | group_memory.push(objects_object.len().to_string()); 835 | for d in 0..objects_object.len() { 836 | group_memory.push(build_name.clone()); 837 | group_memory.push(objects_object[d].clone()); 838 | } 839 | } else if "append" == contents[x].as_str() { 840 | let mut params: Vec = Vec::new(); 841 | for item in x..contents.len() { 842 | if contents[item].is_empty() 843 | || contents[item] == "," 844 | || contents[item] == "(" 845 | || contents[item] == "append" 846 | || contents[item] == "\"" 847 | { 848 | } else if contents[item] == ")" { 849 | break; 850 | } else { 851 | params.push(contents[item].clone()); 852 | } 853 | } 854 | for object in 0..memory_names.len() { 855 | if memory_names[object] == params[0] { 856 | // zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v 857 | memory_values[object] = memory_values[object].clone() 858 | + "zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v" 859 | + params[1].as_str(); 860 | break; 861 | } 862 | } 863 | } else if "cut" == contents[x].as_str() { 864 | let mut parameters: Vec = Vec::new(); 865 | for item in x..contents.len() { 866 | if contents[item].is_empty() 867 | || contents[item] == "," 868 | || contents[item] == "(" 869 | || contents[item] == "cut" 870 | || contents[item] == "\"" 871 | { 872 | } else if contents[item] == ")" { 873 | break; 874 | } else { 875 | parameters.push(contents[item].clone()); 876 | } 877 | } 878 | let mut change = String::new(); 879 | let mut count = 0; 880 | for object in 0..memory_names.len() { 881 | if memory_names[object] == parameters[0] { 882 | // identify.replace("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v", ""); 883 | let identify_split = memory_values[object] 884 | .split("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v"); 885 | let id_vec: Vec<&str> = identify_split.collect(); 886 | let id_save = id_vec; 887 | let mut id_save_string: Vec = Vec::new(); 888 | for thing in 0..id_save.len() { 889 | id_save_string.push(id_save[thing].to_string()); 890 | } 891 | id_save_string.remove(parameters[1].parse().unwrap()); 892 | let mut temp = String::new(); 893 | for elem in 0..id_save_string.len() { 894 | temp.push_str(id_save_string[elem].as_str()); 895 | temp.push_str("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v"); 896 | } 897 | change = temp; 898 | count = object; 899 | } 900 | } 901 | memory_values[count] = change; 902 | } else if "func" == contents[x].as_str() { 903 | let mut skip = false; 904 | let mut n = 1; 905 | let mut reached = false; 906 | let mut name: String = "".parse().unwrap(); 907 | for y in x + 2..contents.len() { 908 | if !skip { 909 | if contents[y] == "(" { 910 | n -= 1; 911 | reached = true; 912 | } else if contents[y] == ")" { 913 | n -= 1; 914 | } 915 | if n > 0 { 916 | name.push_str(&contents[y]); 917 | } else if reached { 918 | skip = true; 919 | } 920 | } 921 | } 922 | let mut code = Vec::new(); 923 | skip = false; 924 | n = 0; 925 | reached = false; 926 | for y in x + 1..contents.len() { 927 | if !skip { 928 | if contents[y] == "}" { 929 | n -= 1; 930 | } 931 | if n > 0 { 932 | code.push(&contents[y]); 933 | } else if reached { 934 | skip = true; 935 | } 936 | if contents[y] == "{" { 937 | n += 1; 938 | reached = true; 939 | } 940 | } 941 | } 942 | let par = functions::getstring( 943 | x + 2, 944 | contents.clone(), 945 | memory_names.clone(), 946 | memory_values.clone(), 947 | memory_types.clone(), 948 | func_names.clone(), 949 | func_par.clone(), 950 | func_code.clone(), 951 | dev, 952 | uses.clone(), 953 | 3, 954 | ) 955 | .join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v"); 956 | if dev { 957 | println!("par: {}", par); 958 | println!("code: {:?}", code); 959 | println!("name: {}", name); 960 | } 961 | let mut strinogeuroheu = "".to_string(); 962 | for x in 0..code.len() { 963 | strinogeuroheu.push_str(code[x]); 964 | if x != code.len() { 965 | strinogeuroheu.push_str("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v"); 966 | } 967 | } 968 | func_par.push(par); 969 | func_code.push(strinogeuroheu); 970 | func_names.push(name); 971 | if dev { 972 | println!("func_par: {:?}", func_par); 973 | println!("func_code: {:?}", func_code); 974 | println!("func_names: {:?}", func_names); 975 | } 976 | } else if "if" == contents[x].as_str() { 977 | let mut loc1 = 0; 978 | let mut loc2 = 0; 979 | let mut vec: Vec = Vec::new(); 980 | let mut skip = false; 981 | let mut n = 0; 982 | for y in x + 1..contents.len() { 983 | if !skip { 984 | if contents[y] == "{" { 985 | if n == 0 { 986 | loc1 = y; 987 | } 988 | n += 1; 989 | } else if contents[y] == "}" { 990 | n -= 1; 991 | if n == 0 { 992 | skip = true; 993 | loc2 = y; 994 | } 995 | } 996 | if n > 0 { 997 | vec.push(contents[y].parse().unwrap()); 998 | } 999 | } 1000 | } 1001 | vec.remove(0); 1002 | let code = vec.clone(); 1003 | let mut vec: Vec = Vec::new(); 1004 | let mut skip = false; 1005 | let mut n = 0; 1006 | for y in x + 1..contents.len() { 1007 | if !skip { 1008 | if contents[x + 1] != "(" { 1009 | println!("You have to put a parentheses after a log"); 1010 | std::process::exit(1); 1011 | } 1012 | if contents[y] == "(" { 1013 | n += 1; 1014 | } else if contents[y] == ")" { 1015 | n -= 1; 1016 | } 1017 | if n == 0 { 1018 | skip = true; 1019 | for z in x + 1..y + 1 { 1020 | vec.push(contents[z].parse().unwrap()); 1021 | } 1022 | } 1023 | } 1024 | } 1025 | if dev { 1026 | println!("vec: {:?}", vec); 1027 | } 1028 | let string: String = functions::getstring( 1029 | x, 1030 | contents.clone(), 1031 | memory_names.clone(), 1032 | memory_values.clone(), 1033 | memory_types.clone(), 1034 | func_names.clone(), 1035 | func_par.clone(), 1036 | func_code.clone(), 1037 | dev, 1038 | uses.clone(), 1039 | 2, 1040 | ) 1041 | .first() 1042 | .unwrap() 1043 | .to_string(); 1044 | let mut result: Vec = Vec::new(); 1045 | let mut last = 0; 1046 | for (index, matched) in string.match_indices(|c: char| { 1047 | c == "=".chars().next().unwrap() 1048 | || c == "!".chars().next().unwrap() 1049 | || c == ">".chars().next().unwrap() 1050 | || c == "<".chars().next().unwrap() 1051 | || c == "|".chars().next().unwrap() 1052 | || c == "&".chars().next().unwrap() 1053 | }) { 1054 | if last != index { 1055 | result.push(string[last..index].parse().unwrap()); 1056 | } 1057 | result.push(matched.parse().unwrap()); 1058 | last = index + matched.len(); 1059 | } 1060 | if last < string.len() { 1061 | result.push(string[last..].parse().unwrap()); 1062 | } 1063 | let mut output = Vec::new(); 1064 | for item in 0..result.len() { 1065 | if result[item] == "=" && 0 < item { 1066 | if result[item - 1] == "=" 1067 | || result[item - 1] == "!" 1068 | || result[item - 1] == ">" 1069 | || result[item - 1] == "<" 1070 | { 1071 | output.push(result[item - 1].to_owned() + &*"=".to_string()); 1072 | } 1073 | } else if result[item] == "|" && 0 < item { 1074 | if result[item + 1] == "|" { 1075 | output.push("||".parse().unwrap()); 1076 | } 1077 | } else if result[item] == "&" && 0 < item { 1078 | if result[item + 1] == "&" { 1079 | output.push("&&".parse().unwrap()); 1080 | } 1081 | } else if (result[item] == ">" || result[item] == "<") && 0 < item { 1082 | if result[item + 1] != "=" { 1083 | output.push(result[item].to_owned()); 1084 | } 1085 | } else if result[item] != "!" 1086 | && result[item] != "<" 1087 | && result[item] != ">" 1088 | { 1089 | output.push(result[item].parse().unwrap()); 1090 | } 1091 | } 1092 | for item in 0..output.len() { 1093 | let if_number = output[item].chars(); 1094 | let mut if_number_bool = true; 1095 | for c in if_number { 1096 | if (char::is_numeric(c) || c == '.') && if_number_bool { 1097 | if_number_bool = true; 1098 | } else { 1099 | if_number_bool = false; 1100 | } 1101 | } 1102 | if !if_number_bool { 1103 | let mut postion1 = memory_names.len(); 1104 | let mut skip = false; 1105 | for pos in 0..memory_names.len() { 1106 | if !skip && memory_names[pos] == output[item] { 1107 | postion1 = pos; 1108 | skip = true; 1109 | } 1110 | } 1111 | if postion1 != memory_names.len() { 1112 | output[item] = memory_values[postion1].to_string(); 1113 | } 1114 | } 1115 | } 1116 | for item in 0..output.len() { 1117 | if (output[item] == "==" && output[item - 1] == output[item + 1]) 1118 | || (output[item] == "!=" && output[item - 1] != output[item + 1]) 1119 | || (output[item] == ">=" 1120 | && output[item - 1].parse::().unwrap() 1121 | >= output[item + 1].parse::().unwrap()) 1122 | || (output[item] == "<=" 1123 | && output[item - 1].parse::().unwrap() 1124 | <= output[item + 1].parse::().unwrap()) 1125 | || (output[item] == "<" 1126 | && output[item - 1].parse::().unwrap() 1127 | < output[item + 1].parse::().unwrap()) 1128 | || (output[item] == ">" 1129 | && output[item - 1].parse::().unwrap() 1130 | > output[item + 1].parse::().unwrap()) 1131 | { 1132 | output[item] = "true".to_string(); 1133 | output[item - 1] = "".to_string(); 1134 | output[item + 1] = "".to_string(); 1135 | } else if (output[item] == "==" && output[item - 1] != output[item + 1]) 1136 | || (output[item] == "!=" && output[item - 1] == output[item + 1]) 1137 | || (output[item] == ">=" 1138 | && !(output[item - 1].parse::().unwrap() 1139 | >= output[item + 1].parse::().unwrap())) 1140 | || (output[item] == "<=" 1141 | && !(output[item - 1].parse::().unwrap() 1142 | <= output[item + 1].parse::().unwrap())) 1143 | || (output[item] == "<" 1144 | && !(output[item - 1].parse::().unwrap() 1145 | < output[item + 1].parse::().unwrap())) 1146 | || (output[item] == ">" 1147 | && !(output[item - 1].parse::().unwrap() 1148 | > output[item + 1].parse::().unwrap())) 1149 | { 1150 | output[item] = "false".to_string(); 1151 | output[item - 1] = "".to_string(); 1152 | output[item + 1] = "".to_string(); 1153 | } 1154 | } 1155 | output = lexer::no_extra_whitespace(output, dev); 1156 | let mut new_out = Vec::new(); 1157 | for item in 0..output.len() { 1158 | if !output[item].is_empty() { 1159 | new_out.push(output[item].clone()); 1160 | } 1161 | } 1162 | output = new_out; 1163 | while output.len() > 1 { 1164 | for item in 0..output.len() { 1165 | if item > 0 && item < output.len() { 1166 | if (output[item] == "&&" 1167 | && output[item - 1] == "true" 1168 | && output[item + 1] == "true") 1169 | || (output[item] == "||" 1170 | && (output[item - 1] == "true" 1171 | || output[item + 1] == "true")) 1172 | { 1173 | output[item] = "true".to_string(); 1174 | output[item - 1] = "".to_string(); 1175 | output[item + 1] = "".to_string(); 1176 | } else if output[item] == "&&" || output[item] == "||" { 1177 | for _i in 0..output.len() { 1178 | output.pop(); 1179 | } 1180 | output.push("false".to_string()); 1181 | } 1182 | } 1183 | output = lexer::no_extra_whitespace(output, dev); 1184 | let mut new_out = Vec::new(); 1185 | for item in 0..output.len() { 1186 | if !output[item].is_empty() { 1187 | new_out.push(output[item].clone()); 1188 | } 1189 | } 1190 | output = new_out; 1191 | } 1192 | } 1193 | if output[0] == "true" { 1194 | contents[loc1] = " ".parse().unwrap(); 1195 | contents[loc2] = " ".parse().unwrap(); 1196 | readfrom = loc1; 1197 | skiperwiper = true; 1198 | read = true; 1199 | } else if loc2 + 2 < contents.len() { 1200 | if contents[loc2 + 1] == "while" { 1201 | contents[loc2 + 1] = " ".parse().unwrap(); 1202 | } else if contents[loc2 + 2] == "while" { 1203 | contents[loc2 + 2] = " ".parse().unwrap(); 1204 | } else if contents[loc2 + 1] == "else" || contents[loc2 + 2] == "else" { 1205 | let mut skip = false; 1206 | let mut n = 0; 1207 | for y in loc2 + 1..contents.len() { 1208 | if !skip { 1209 | if contents[y] == "{" { 1210 | if n == 0 { 1211 | contents[y] = "".to_string(); 1212 | } 1213 | n += 1; 1214 | } else if contents[y] == "}" { 1215 | n -= 1; 1216 | if n == 0 { 1217 | skip = true; 1218 | contents[y] = "".to_string(); 1219 | } 1220 | } 1221 | } 1222 | } 1223 | } 1224 | } 1225 | if dev { 1226 | println!("output: {:?}", output); 1227 | println!("code: {:?}", code); 1228 | println!("contents[loc1]: {:?}", contents[loc1]); 1229 | println!("contents[loc2]: {:?}", contents[loc2]); 1230 | println!("contents: {:?}", contents); 1231 | } 1232 | } else { 1233 | //function names 1234 | if x > 2 && contents[x - 2] != "func" { 1235 | let mut postion = func_names.len(); 1236 | let mut skip = false; 1237 | for pos in 0..func_names.len() { 1238 | if !skip && func_names[pos] == contents[x] { 1239 | postion = pos; 1240 | skip = true; 1241 | } 1242 | } 1243 | if postion != func_names.len() { 1244 | let mut contetntstr: Vec = Vec::new(); 1245 | for t in 1246 | func_code[postion].split("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 1247 | { 1248 | contetntstr.push(t.to_string()); 1249 | } 1250 | let mut contetntstr1: Vec = Vec::new(); 1251 | let mut contetntstr3: Vec = Vec::new(); 1252 | let contetntstr2: Vec = functions::getstring( 1253 | x, 1254 | contents.clone(), 1255 | memory_names.clone(), 1256 | memory_values.clone(), 1257 | memory_types.clone(), 1258 | func_names.clone(), 1259 | func_par.clone(), 1260 | func_code.clone(), 1261 | dev, 1262 | uses.clone(), 1263 | 0, 1264 | ); 1265 | for t in 1266 | func_par[postion].split("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 1267 | { 1268 | contetntstr1.push(t.to_string()); 1269 | contetntstr3.push("str".to_string()); 1270 | } 1271 | if dev { 1272 | println!("contetntstr1: {:?}", contetntstr1); 1273 | println!("contetntstr2: {:?}", contetntstr2); 1274 | println!("contetntstr3: {:?}", contetntstr3); 1275 | } 1276 | let _output = run( 1277 | contetntstr, 1278 | dev, 1279 | uses.clone(), 1280 | contetntstr1.clone(), 1281 | contetntstr2.clone(), 1282 | contetntstr3.clone(), 1283 | func_names.clone(), 1284 | func_par.clone(), 1285 | func_code.clone(), 1286 | ) 1287 | .as_str(); 1288 | } else { 1289 | let mut postion = memory_names.len(); 1290 | let mut skip = false; 1291 | for pos in 0..memory_names.len() { 1292 | if !skip && memory_names[pos] == contents[x] { 1293 | postion = pos; 1294 | skip = true; 1295 | } 1296 | } 1297 | if postion != memory_names.len() 1298 | && (contents[x + 1].trim() == ":" 1299 | || contents[x + 1].trim() == "=") 1300 | && contents[x - 2].trim() != "dec" 1301 | { 1302 | let mut position = x + 2; 1303 | let _value = String::new(); 1304 | let _n = 0; 1305 | let _quote = 0; 1306 | let _memory_names_save = memory_names.clone(); 1307 | let _memory_values_save = memory_values.clone(); 1308 | let _memmory_types_save = memory_types.clone(); 1309 | let _func_names_save = func_names.clone(); 1310 | let _func_code_save = func_code.clone(); 1311 | let _func_par_save = func_par.clone(); 1312 | let mut pass_vec: Vec = 1313 | vec!["a".to_string(), "(".to_string()]; 1314 | loop { 1315 | if contents[position] == "\n" || contents[position] == ";" { 1316 | break; 1317 | } 1318 | pass_vec.push(contents[position].clone().to_string()); 1319 | position += 1; 1320 | } 1321 | pass_vec.push(")".to_string()); 1322 | let value = functions::getstring( 1323 | 0, 1324 | pass_vec.clone(), 1325 | memory_names.clone(), 1326 | memory_values.clone(), 1327 | memory_types.clone(), 1328 | func_names.clone(), 1329 | func_par.clone(), 1330 | func_code.clone(), 1331 | dev, 1332 | uses.clone(), 1333 | 0, 1334 | ) 1335 | .join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 1336 | .to_string(); 1337 | memory_values[postion] = value; 1338 | } else if postion != memory_names.len() 1339 | && contents[x + 1].trim() == "(" 1340 | && contents[x - 2].trim() != "dec" 1341 | { 1342 | let id = functions::math( 1343 | x, 1344 | contents.clone(), 1345 | memory_names.clone(), 1346 | memory_values.clone(), 1347 | func_names.clone(), 1348 | func_par.clone(), 1349 | func_code.clone(), 1350 | uses.clone(), 1351 | ); 1352 | let mut skipz = false; 1353 | let mut nigro = 0; 1354 | let mut pos = x; 1355 | for nx in x + 1..contents.len() { 1356 | if !skipz { 1357 | if contents[nx] == "(" { 1358 | nigro += 1; 1359 | } else if contents[nx] == ")" { 1360 | nigro -= 1; 1361 | } 1362 | if nigro == 0 { 1363 | pos = nx; 1364 | skipz = true; 1365 | } 1366 | } 1367 | } 1368 | let mut position = pos + 2; 1369 | let _value = String::new(); 1370 | let _n = 0; 1371 | let _quote = 0; 1372 | let _memory_names_save = memory_names.clone(); 1373 | let _memory_values_save = memory_values.clone(); 1374 | let _memmory_types_save = memory_types.clone(); 1375 | let _func_names_save = func_names.clone(); 1376 | let _func_code_save = func_code.clone(); 1377 | let _func_par_save = func_par.clone(); 1378 | let mut pass_vec: Vec = 1379 | vec!["a".to_string(), "(".to_string()]; 1380 | loop { 1381 | if contents[position] == "\n" || contents[position] == ";" { 1382 | break; 1383 | } 1384 | pass_vec.push(contents[position].clone().to_string()); 1385 | position += 1; 1386 | } 1387 | pass_vec.push(")".to_string()); 1388 | let value = functions::getstring( 1389 | 0, 1390 | pass_vec.clone(), 1391 | memory_names.clone(), 1392 | memory_values.clone(), 1393 | memory_types.clone(), 1394 | func_names.clone(), 1395 | func_par.clone(), 1396 | func_code.clone(), 1397 | dev, 1398 | uses.clone(), 1399 | 0, 1400 | ) 1401 | .join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 1402 | .to_string(); 1403 | let mut new_value = memory_values[postion] 1404 | .split("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v") 1405 | .collect::>(); 1406 | new_value[id as usize] = &value; 1407 | memory_values[postion] = 1408 | new_value.join("zzGVgfHaNtPMe7H9RRyx3rWC9JyyZdMkc2v"); 1409 | } 1410 | } 1411 | } 1412 | } 1413 | } 1414 | } 1415 | } 1416 | } 1417 | format!("{}}}", returns) 1418 | } 1419 | 1420 | fn code_to_add() -> String { 1421 | //Put code here to add it everywhere 1422 | " 1423 | 1424 | " 1425 | .to_string() 1426 | } 1427 | 1428 | pub fn error(error: String) { 1429 | println!("{}", error); 1430 | std::process::exit(1); 1431 | } 1432 | -------------------------------------------------------------------------------- /startup.bat: -------------------------------------------------------------------------------- 1 | set "curpath=%cd%" 2 | cd C:\Users\%username% 3 | git clone https://github.com/Nyelsonon/nyson-programming-language.git 4 | cd nyson-programming-language 5 | cargo build --release 6 | SET "PATH=%PATH%;C:\Users\%username%\nyson-programming-language\target\release" 7 | setx /M PATH "%PATH%;C:\Users\%username%\nyson-programming-language\target\release" 8 | cd %curpath% 9 | -------------------------------------------------------------------------------- /startup.sh: -------------------------------------------------------------------------------- 1 | LOC="$(pwd)" 2 | cd ~ 3 | git clone https://github.com/Nyelsonon/nyson-programming-language.git 4 | cd nyson-programming-language 5 | cargo build --release 6 | cd $LOC 7 | sudo cp ~/nyson-programming-language/target/release/nyson /usr/bin -------------------------------------------------------------------------------- /tests/main.nys: -------------------------------------------------------------------------------- 1 | // tests whileloop 2 | log("<---whileloop.nys--->") 3 | imp("tests/test_code/whileloop.nys"); 4 | // tests whileloop, ifstatements, variables 5 | log("<---numberguess.nys--->") 6 | imp("tests/test_code/numberguess.nys"); 7 | // tests command line 8 | log("<---exec.nys--->") 9 | imp("tests/test_code/exec.nys"); 10 | // tests sleeping and concatenation 11 | log("<---loadingbar.nys--->") 12 | imp("tests/test_code/loadingbar.nys"); 13 | // tests cutting arrays 14 | log("<---cut.nys--->") 15 | imp("tests/test_code/cut.nys"); 16 | // tests replacing arrays 17 | log("<---replace.nys--->") 18 | imp("tests/test_code/replace.nys"); 19 | log("<---DONE--->") -------------------------------------------------------------------------------- /tests/test_code/cut.nys: -------------------------------------------------------------------------------- 1 | dec arr testing : ["test", "is", "best"]; 2 | cut(testing, 1); 3 | log(testing(1)); -------------------------------------------------------------------------------- /tests/test_code/exec.nys: -------------------------------------------------------------------------------- 1 | use os; 2 | if (os() != "macos") { 3 | log(exec("dir")); 4 | } 5 | else { 6 | log(exec("ls")); 7 | } -------------------------------------------------------------------------------- /tests/test_code/loadingbar.nys: -------------------------------------------------------------------------------- 1 | number: math(0); 2 | dec str loading: ""; 3 | loop(6) { 4 | loading: ""; 5 | loop(number) { 6 | loading: loading "#"; 7 | } 8 | loop(5-number) { 9 | loading: loading "-"; 10 | } 11 | log(loading); 12 | sleep(1000); 13 | number : math(number+1); 14 | } -------------------------------------------------------------------------------- /tests/test_code/numberguess.nys: -------------------------------------------------------------------------------- 1 | dec int random_number: round(math(random*100)); 2 | dec int number_picked: 50; 3 | while(number_picked != random_number) { 4 | if (number_picked > random_number) { 5 | log("You need to pick a smaller number"); 6 | number_picked: math(number_picked-1); 7 | } 8 | if (number_picked < random_number) { 9 | log("You need to pick a bigger number"); 10 | number_picked: math(number_picked+1); 11 | } 12 | log(number_picked); 13 | } 14 | log("You got it right! (it was " random_number ")"); -------------------------------------------------------------------------------- /tests/test_code/replace.nys: -------------------------------------------------------------------------------- 1 | log(replace("I am really bad", "bad", "good")); -------------------------------------------------------------------------------- /tests/test_code/whileloop.nys: -------------------------------------------------------------------------------- 1 | dec int number : math(1); 2 | while(number < "10") { 3 | log("Hi number is at: " number); 4 | number : math(number+1); 5 | } --------------------------------------------------------------------------------