Skip to content

Commit

Permalink
Add editing mode to fungoid ide (#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshKarpel authored Jul 2, 2022
1 parent 5419cc4 commit f418de7
Show file tree
Hide file tree
Showing 20 changed files with 546 additions and 236 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
- master
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
pre-commit:
strategy:
Expand All @@ -16,12 +19,17 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.0.2
- uses: actions-rs/toolchain@v1.0.7
- name: Checkout repository
uses: actions/checkout@v3.0.2
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: ${{ matrix.toolchain }}
override: true
- uses: actions/setup-python@v4.0.0
components: rustfmt, clippy
- name: Set up Python
uses: actions/setup-python@v4.0.0
with:
python-version: "3.x"
- uses: pre-commit/action@v3.0.0
- name: Run pre-commit
uses: pre-commit/action@v3.0.0
12 changes: 9 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@ on:
release:
types: [ published ]

env:
CARGO_TERM_COLOR: always

jobs:
publish:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3.0.2
- uses: actions-rs/toolchain@v1.0.7
- name: Checkout repository
uses: actions/checkout@v3.0.2
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: stable
override: true
- uses: actions-rs/cargo@v1.0.3
- name: Publish crate
uses: actions-rs/cargo@v1.0.3
with:
command: publish
args: --token ${{ secrets.CRATES_TOKEN }}
19 changes: 12 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,26 @@ jobs:
fail-fast: false
matrix:
platform: [ ubuntu-latest, macos-latest, windows-latest ]
toolchain: [ stable ]
toolchain: [ stable, nightly ]

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/checkout@v3.0.2
- uses: actions-rs/toolchain@v1.0.7
- name: Checkout repository
uses: actions/checkout@v3.0.2
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1.0.7
with:
toolchain: ${{ matrix.toolchain }}
override: true
- uses: actions-rs/cargo@v1.0.3
components: rustfmt, clippy
- name: Build
uses: actions-rs/cargo@v1.0.3
with:
command: build
args: --verbose --release
- uses: actions-rs/cargo@v1.0.3
args: --verbose
- name: Test
uses: actions-rs/cargo@v1.0.3
with:
command: test
args: --verbose --release
args: --verbose --no-fail-fast
20 changes: 20 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Changelog

## 0.2.1

### Added

- IDE mode now allows editing of the program.
- A set of example programs is now bundled into the `fungoid` executable.
Run `fungoid examples` to see the `NAME`s of the examples,
and `fungoid run example:NAME` or `fungoid ide example:NAME` to execute them.

### Changed

- Errors during program execution now return `Result`s instead of panicking.

## 0.2.0

### Added

- Added IDE mode (`fungoid ide FILE`), with visual execution of programs.
39 changes: 23 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fungoid"
version = "0.2.0"
version = "0.2.1"
description = "A Befunge interpreter and IDE"
authors = ["Josh Karpel <josh.karpel@gmail.com>"]
edition = '2018'
Expand All @@ -19,3 +19,4 @@ rand = "0.8.5"
separator = "0.4.1"
tui = "0.18.0"
itertools = "0.10.3"
lazy_static = "1.4.0"
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@

![Tests](https://github.com/JoshKarpel/fungoid/workflows/tests/badge.svg)

A Befunge interpreter written in Rust
A Befunge interpreter written in Rust.

## Installation

`fungoid` can be installed using
[`cargo`, the Rust package manager](https://doc.rust-lang.org/cargo/):

```bash
$ cargo install fungoid
```
8 changes: 8 additions & 0 deletions rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
unstable_features = true

imports_granularity = "Crate"
group_imports = "StdExternalCrate"

combine_control_expr = false

reorder_impl_items = true
23 changes: 23 additions & 0 deletions src/examples.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use std::collections::HashMap;

pub const DNA: &str = include_str!("examples/dna.bf");
pub const ERATOSTHENES: &str = include_str!("examples/eratosthenes.bf");
pub const FACTORIAL: &str = include_str!("examples/factorial.bf");
pub const HELLO_WORLD: &str = include_str!("examples/hello_world.bf");
pub const INPUT: &str = include_str!("examples/input.bf");
pub const QUINE: &str = include_str!("examples/quine.bf");
pub const RNG: &str = include_str!("examples/rng.bf");

lazy_static! {
pub static ref EXAMPLES: HashMap<&'static str, &'static str> = {
let mut m = HashMap::new();
m.insert("dna", DNA);
m.insert("eratosthenes", ERATOSTHENES);
m.insert("factorial", FACTORIAL);
m.insert("hello_world", HELLO_WORLD);
m.insert("input", INPUT);
m.insert("quine", QUINE);
m.insert("rng", RNG);
m
};
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit f418de7

Please sign in to comment.