diff --git a/.github/workflows/clippy.yml b/.github/workflows/clippy.yml new file mode 100644 index 00000000..63678e48 --- /dev/null +++ b/.github/workflows/clippy.yml @@ -0,0 +1,19 @@ +name: Clippy +on: + push: + branches: + - main + pull_request: + branches: + - main +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Clippy (default) + run: | + cargo clippy -- -D warnings + - name: Clippy (all features) + run: | + cargo clippy --all-features -- -D warnings \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 33f648f8..6683c6d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v3 - name: Test (default features) run: | cd full-moon @@ -39,12 +39,6 @@ jobs: run: | cd full-moon cargo test --no-default-features --features serde - - name: Clippy (default) - run: | - cargo clippy -- -D warnings - - name: Clippy (all features) - run: | - cargo clippy --all-features -- -D warnings - name: Rustfmt run: | cargo fmt -- --check diff --git a/CHANGELOG.md b/CHANGELOG.md index 7735eb99..9143ffde 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased ### Added - `full_moon::Error` and `full_moon::ast::Ast` now implement Serialize and Deserialize. +- Added optional "stacker" feature which uses the [stacker](https://docs.rs/stacker/latest/stacker/index.html) crate to conditionally expand stack size to avoid stack overflows, a known problem with full-moon. ### Fixed - Support instantiated generics with no parameters, e.g. `Foo<>` diff --git a/full-moon/Cargo.toml b/full-moon/Cargo.toml index 476ea302..afe884ec 100644 --- a/full-moon/Cargo.toml +++ b/full-moon/Cargo.toml @@ -32,6 +32,7 @@ logos = "0.12.0" paste = "0.1" serde = { version = "1.0", features = ["derive", "rc"], optional = true } smol_str = { version = "0.1.17", features = ["serde"] } +stacker = { version = "0.1.15", optional = true } [dev-dependencies] criterion = "0.2" diff --git a/full-moon/src/ast/parser_util.rs b/full-moon/src/ast/parser_util.rs index e1e1c081..f8d32a06 100644 --- a/full-moon/src/ast/parser_util.rs +++ b/full-moon/src/ast/parser_util.rs @@ -109,6 +109,11 @@ macro_rules! define_parser { &self, state: ParserState<'a>, ) -> Result<(ParserState<'a>, $node), InternalAstError> { + #[cfg(feature = "stacker")] + if true { + return stacker::maybe_grow(32 * 1024, 1024 * 1024, || $body(self, state)); + } + $body(self, state) } }