From 6476caae2bcaa27f26cc9abba9785934a417a83b Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 9 Nov 2023 06:10:48 -0500 Subject: [PATCH 1/3] test all the things --- .github/workflows/ci.yaml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4bc1cacb..b778be12 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -15,8 +15,14 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v2 - - name: Run cargo test + - name: Run cargo test --all uses: actions-rs/cargo@v1 with: command: test args: --all + - name: Run cargo test --all-targets + uses: actions-rs/cargo@v1 + with: + command: test + args: --all-targets + From 2078e1748722f7e8e87fbcffee2df9188258bc82 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 9 Nov 2023 06:10:55 -0500 Subject: [PATCH 2/3] restrict visibility for enter/recurse For some reason, I sometimes get compilation errors related to this and sometimes do not (?). --- crates/formality-core/src/parse/parser/left_recursion.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/formality-core/src/parse/parser/left_recursion.rs b/crates/formality-core/src/parse/parser/left_recursion.rs index 862f77f4..367f726d 100644 --- a/crates/formality-core/src/parse/parser/left_recursion.rs +++ b/crates/formality-core/src/parse/parser/left_recursion.rs @@ -180,7 +180,7 @@ impl StackEntry { } } -pub fn enter<'s, 't, L, T>( +pub(super) fn enter<'s, 't, L, T>( scope: &'s Scope, text: &'t str, mut op: impl FnMut(usize) -> ParseResult<'t, T>, @@ -439,7 +439,7 @@ where } } -pub fn recurse<'s, 't, R>(current_state: CurrentState, op: impl FnOnce() -> R) -> R { +pub(super) fn recurse<'s, 't, R>(current_state: CurrentState, op: impl FnOnce() -> R) -> R { STACK.with_borrow_mut(|stack| { let top = stack.last_mut().unwrap(); assert!( From fab9e5fade59cc6b0dd62847784400f55f69b034 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 9 Nov 2023 06:12:21 -0500 Subject: [PATCH 3/3] fix links in book docs --- book/src/formality_core/parse.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/book/src/formality_core/parse.md b/book/src/formality_core/parse.md index f728ff82..13fbb3f2 100644 --- a/book/src/formality_core/parse.md +++ b/book/src/formality_core/parse.md @@ -31,14 +31,14 @@ When parsing an enum there will be multiple possibilities. We will attempt to pa We support left-recursive grammars like this one from the `parse-torture-tests`: ```rust -{{#include ../../../tests/parser-torture-tests/src/path.rs:path}} +{{#include ../../../tests/parser-torture-tests/path.rs:path}} ``` We also support ambiguous grammars. For example, you can code up arithmetic expressions like this: ```rust -{{#include ../../../tests/parser-torture-tests/src/left_associative.rs:Expr}} +{{#include ../../../tests/parser-torture-tests/left_associative.rs:Expr}} ``` When specifying the `#[precedence]` of a variant, the default is left-associativity, which can be written more explicitly as `#[precedence(L, left)]`. If you prefer, you can specify right-associativity (`#[precedence(L, right)]`) or non-associativity `#[precedence(L, none)]`. This affects how things of the same level are parsed: @@ -71,7 +71,7 @@ A grammar consists of a series of *symbols*. Each symbol matches some text in th * `$[?field]` -- parse `[E1, E2, E3]`, where `field: Vec`, but accept empty string as empty vector * `${field}` -- parse `{E1, E2, E3}`, where `field: Vec` * `${?field}` -- parse `{E1, E2, E3}`, where `field: Vec`, but accept empty string as empty vector - * `$:guard ` -- parses `` but only if the keyword `guard` is present. For example, `$:where $,where_clauses` would parse `where WhereClause1, WhereClause2, WhereClause3` + * `$:guard ` -- parses `` but only if the keyword `guard` is present. For example, `$:where $,where_clauses` would parse `where WhereClause1, WhereClause2, WhereClause3` but would also accept nothing (in which case, you would get an empty vector). ### Greediness