Result: partial Files: crates/nikaia-std/src/grammar.rs crates/nikaia-std/src/tools/emit_grammar.nika crates/nikaia-std/src/tools/emit_pattern.nika crates/nikaia-std/src/tools/emit_state.nika crates/nikaia-std/src/tools/lowered/emit_grammar.rs crates/nikaia-std/src/tools/lowered/emit_pattern.rs crates/nikaia-std/src/tools/lowered/emit_state.rs docs/specification/20-nikaia-advance.md tests/compiler/tests/grammar_text_binds_its_inner_parts.nika tests/compiler/tests/grammar_text_binds_its_inner_parts.stdout Commit: grammar: a binding inside a bound text(..) is kept (#1013 point 1) Body: winnow-grammar’s text(p) is a take() that drops what p binds, and its (a b) @ at scopes a multi-element sequence’s bindings too, so a bound s:text(p) whose p binds names is written as p without the text(..), its first and last element each with the range it covered ((a) @ _nikaia_s_from b (c) @ __nikaia_s_to; a nested bound text writes its own edges and the outer one reuses them); the action’s prelude reads the text from the first start to the last end with nikaia_std::grammar::covered (a view of the input; over Bytes covered_bytes checks UTF-8 and fails as the backend’s text(p) does). One pass, no second parse. Below a repeat, a choice or a built-in’s argument (EmitWalk.grammar_nested) and where p binds nothing, text(p) stays the backend’s own. Names start with __nikaia, the lowering’s convention for its own names. Part: #1013 Pushed: rejected (local commit 42c133be, needs the supervisor’s rebase) Tests: grammar_text_binds_its_inner_parts (new) fails on the unfixed compiler (Cannot find value ps/i/a/b/c) and passes now; tests/compiler –both-settings 367 passed 0 failed; packages/yaml 9 passed; gate filters (range_spelling shipped_ledger contracts::every_std_module dependency_ledger fmt::every_nika_file) 23 passed; nikaia-std –lib grammar:: none to run; clippy clean Gate: green Deviation: step 2 (#1013 point 2) and its test grammar_a_struct_named_s not built: the type parameter S is written by winnow-grammar’s macro (winnow-grammar-macros/src/codegen, 58 places, e.g. input_ty ParseInput<'a, S>), not by our emitter, so renaming it needs a change inside winnow-grammar; probe struct S { a: i64 } + entry rule top -> S = d:dec[i64](digit+) -> { S { a: d } } gives rustc “Expected struct, variant or union type, found type parameter S”. The same holds for a program type named E (the engine’s error parameter). Found: lowering defect: a function whose ref Vec[T] result points into a ref Vec[T] parameter lowers the parameter as &[T] and the result as &Vec<T>, so returning the parameter reaches rustc; probe enum P { Seq(Vec[P]), Leaf(i64) } fn inner(a: ref Vec[P]) -> ref Vec[P] { if a.len() == 1 { match a[0] { P::Seq(parts) => return parts, else => {} } } return a } -> “Mismatched types, expected &Vec<P>”. The emitter helpers here dispatch to a worker instead of returning the ref. Needs: owner decision on #1013 point 2: change winnow-grammar upstream to name its parameters (S, E) with a name a program cannot declare, or have our emitter write program types inside a grammar qualified (self::S); and an issue for the Found defect Changelog: A binding inside a bound text(..) in a grammar is kept: s:text(ps:P*) binds s to the covered text and ps as without the text(..), in one pass (Part II 10, #1013). Owner: Should a program type named S or E inside a grammar be fixed upstream in winnow-grammar (renamed engine parameters) or in our emitter (program types qualified as self::S)? Disk freed: 0 GB (removed my scratch binary copy, ~20 MB; target/nikaia-project-tests 5.8G, 11G free, no new entry over 100 MB) Rs2nika: none

This site is open source. Improve this page.