Skip to content

feat(codegen): add lex-only generated helpers - #316

Merged
tinovyatkin merged 4 commits into
mainfrom
feat/issue-242-lex-only
Aug 7, 2026
Merged

feat(codegen): add lex-only generated helpers#316
tinovyatkin merged 4 commits into
mainfrom
feat/issue-242-lex-only

Conversation

@tinovyatkin

@tinovyatkin tinovyatkin commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #242.

Summary

  • generate lex(input, constructor) and lex_stream(stream, constructor) in every lexer module
  • return an eagerly filled CommonTokenStream so token views retain their canonical store, source diagnostics, hidden/custom channels, and EOF
  • document a token dump with vocabulary-resolved type names and explicit channels in generated rustdoc and the repository README
  • cover UTF-8 text, ByteStream, default/hidden/custom channels, EOF, and skipped-token behavior
  • regenerate the checked-in ANTLRv4, Rust, TOML, and XPath recognizers
  • seed the nested offline build-dependency fixture from the repository lockfile so yanked locked dependencies remain reproducible

Compatibility

The generated helpers use InputStream, CharStream, TokenSource, and
CommonTokenStream::new, all already present in generated-code API revision 6.
This is an additive generated surface and does not change the generated-source
runtime contract, so the API revision remains 6.

An owned iterator cannot yield borrowing TokenView values from its own token
store. Returning CommonTokenStream keeps ownership explicit while preserving
the concise call:

use antlr4_runtime::Token as _;

let tokens = json_lexer::lex(source, JsonLexer::new);
let vocabulary = json_lexer::metadata().vocabulary();
for token in tokens.tokens() {
    println!(
        "type={} channel={} text={:?}",
        vocabulary.display_name(token.token_type()),
        token.channel(),
        token.text(),
    );
}

The checked-in regeneration also advances stale 0.28.0/0.30.0 generator
banners to the workspace's current 0.31.0; their generated-code API revision
remains 6.

Validation

  • cargo fmt --all -- --check
  • cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
  • cargo test --locked --workspace --all-features
  • cargo +1.95 check --locked --workspace --all-targets --all-features
  • RUSTDOCFLAGS='-D warnings -A rustdoc::private-intra-doc-links' cargo doc --locked --workspace --all-features --no-deps
  • tools/rust-syntax/update-generated.sh --check
  • tools/toml-syntax/update-generated.sh --check
  • tools/grammar-frontend/update-stage0.sh --update (Stage 1 and Stage 2 byte-identical; frontend corpus tests passed)
  • shasum -a 256 -c third_party/antlr-v4-grammar/self-hosted.sha256

Summary by CodeRabbit

  • New Features

    • Generated lexers now provide convenient lex and lex_stream helpers for eagerly buffering tokens.
    • Lexer workflows support token channels, skipped tokens, Unicode spans, columns, diagnostics, and arbitrary character streams.
    • Added documentation covering token-only lexer usage and error-handling options.
  • Tests

    • Added coverage for standalone lexer generation and convenience helper behavior.
    • Improved workspace fixture reliability and updated generated grammar checksums.

Generate lex and lex_stream conveniences in every lexer module so callers can inspect token text, type, and channel without constructing a parser or wiring a TokenSink.

Return the eagerly buffered CommonTokenStream to preserve token ownership, source diagnostics, hidden and custom channels, and EOF. The generated source uses existing revision-6 runtime APIs, so the compatibility revision remains unchanged.

Document the token-dump workflow, cover custom streams and channels, and refresh all checked-in recognizers.
Seed the nested build-dependency workspace from the repository Cargo.lock before running it offline. This keeps its dependency graph identical to the tested workspace and allows Cargo to reuse locked packages whose versions are subsequently yanked, including wide 1.6.0.
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

Copy/Paste Detection

Found 7 duplication(s) across 5 changed non-generated Rust file(s) (threshold: 100 tokens).

Show duplications

Found a 26 line (142 tokens) duplication in the following files:

  • Starting at line 4086 of crates/antlr-rust-codegen/src/generator/tests.rs
  • Starting at line 4309 of crates/antlr-rust-codegen/src/generator/tests.rs
    atn.set_end_state(1, 4).expect("block end state");
    atn.add_transition(0, ParserTransitionSpec::Epsilon { target: 1 })
        .expect("transition");
    atn.add_transition(1, ParserTransitionSpec::Epsilon { target: 2 })
        .expect("transition");
    atn.add_transition(1, ParserTransitionSpec::Epsilon { target: 3 })
        .expect("transition");
    atn.add_transition(
        2,
        ParserTransitionSpec::Atom {
            target: 4,
            label: 1,
        },
    )
    .expect("transition");
    atn.add_transition(
        3,
        ParserTransitionSpec::Atom {
            target: 4,
            label: 2,
        },
    )
    .expect("transition");
    atn.add_transition(4, ParserTransitionSpec::Epsilon { target: 5 })
        .expect("transition");
    atn.add_decision_state(1).expect("decision state");
```rust

---

Found a 25 line (115 tokens) duplication in the following files:
* Starting at line 4057 of crates/antlr-rust-codegen/src/generator/tests.rs
* Starting at line 4267 of crates/antlr-rust-codegen/src/generator/tests.rs

```rust
        atn.add_state(AtnStateKind::BlockStart, Some(0))
            .expect("state")
            .index(),
        1
    );
    assert_eq!(
        atn.add_state(AtnStateKind::Basic, Some(0))
            .expect("state")
            .index(),
        2
    );
    assert_eq!(
        atn.add_state(AtnStateKind::Basic, Some(0))
            .expect("state")
            .index(),
        3
    );
    assert_eq!(
        atn.add_state(AtnStateKind::BlockEnd, Some(0))
            .expect("state")
            .index(),
        4
    );
    assert_eq!(
        atn.add_state(AtnStateKind::RuleStop, Some(0))

Found a 22 line (112 tokens) duplication in the following files:

  • Starting at line 4184 of crates/antlr-rust-codegen/src/generator/tests.rs
  • Starting at line 4258 of crates/antlr-rust-codegen/src/generator/tests.rs
fn plus_loop_atn() -> ParserAtn {
    let mut atn = ParserAtnBuilder::new(2);
    assert_eq!(
        atn.add_state(AtnStateKind::RuleStart, Some(0))
            .expect("state")
            .index(),
        0
    );
    assert_eq!(
        atn.add_state(AtnStateKind::PlusBlockStart, Some(0))
            .expect("state")
            .index(),
        1
    );
    assert_eq!(
        atn.add_state(AtnStateKind::Basic, Some(0))
            .expect("state")
            .index(),
        2
    );
    assert_eq!(
        atn.add_state(AtnStateKind::BlockEnd, Some(0))
```rust

---

Found a 27 line (110 tokens) duplication in the following files:
* Starting at line 3411 of crates/antlr-rust-codegen/src/generator/tests.rs
* Starting at line 3523 of crates/antlr-rust-codegen/src/generator/tests.rs

```rust
            decision: 0,
            alts: (1, 2),
            track_alt_number: false,
            allow_semantic_context: true,
            force_context: false,
            plus_loop: false,
            fast_path: None,
            body: &body,
        },
        0,
        GeneratedStepRenderContext {
            current_rule_index: 0,
            embedded: None,
            portable_locals: None,
            decision_routing: DecisionRoutingRender::default(),
            inline_action_statements: &BTreeMap::new(),
            track_alt_numbers: false,
            track_context_alt_numbers: false,
            direct_generated_rule_calls: &[],
            atn_preferred_rule_calls: &[],
            adaptive_atn_preferred_rule_slots: &[],
            adaptive_atn_probe_rule_slots: &[],
        },
    );

    // The whole rendered star-loop captures the leading-predicate-to-exit-alt filtering.
    insta::assert_snapshot!(

Found a 25 line (104 tokens) duplication in the following files:

  • Starting at line 3151 of crates/antlr-rust-codegen/src/generator/tests.rs
  • Starting at line 3318 of crates/antlr-rust-codegen/src/generator/tests.rs
            state: 1,
            decision: 0,
            track_alt_number: false,
            allow_semantic_context: false,
            force_context: false,
            fast_path: None,
            alts: &alts,
        },
        0,
        GeneratedStepRenderContext {
            current_rule_index: 0,
            embedded: None,
            portable_locals: None,
            decision_routing: DecisionRoutingRender::default(),
            inline_action_statements: &BTreeMap::new(),
            track_alt_numbers: false,
            track_context_alt_numbers: false,
            direct_generated_rule_calls: &[],
            atn_preferred_rule_calls: &[],
            adaptive_atn_preferred_rule_slots: &[],
            adaptive_atn_probe_rule_slots: &[],
        },
    );

    assert!(rendered.contains("ll1_decision_prediction(atn(), 1)"));
```rust

---

Found a 28 line (102 tokens) duplication in the following files:
* Starting at line 3204 of crates/antlr-rust-codegen/src/generator/tests.rs
* Starting at line 3364 of crates/antlr-rust-codegen/src/generator/tests.rs

```rust
            state: 1,
            decision: 0,
            track_alt_number: false,
            allow_semantic_context: true,
            force_context: false,
            fast_path: None,
            alts: &alts,
        },
        0,
        GeneratedStepRenderContext {
            current_rule_index: 0,
            embedded: None,
            portable_locals: None,
            decision_routing: DecisionRoutingRender::default(),
            inline_action_statements: &BTreeMap::new(),
            track_alt_numbers: false,
            track_context_alt_numbers: false,
            direct_generated_rule_calls: &[],
            atn_preferred_rule_calls: &[],
            adaptive_atn_preferred_rule_slots: &[],
            adaptive_atn_probe_rule_slots: &[],
        },
    );

    // One decision renders into a fresh String; snapshot the whole emitted control flow (the
    // semantic-context gate, both predicate probes, the alt rewrite, the no-viable fallback)
    // instead of six positive probes plus one negative guard.
    insta::assert_snapshot!(

Found a 16 line (101 tokens) duplication in the following files:

  • Starting at line 4157 of crates/antlr-rust-codegen/src/generator/tests.rs
  • Starting at line 4309 of crates/antlr-rust-codegen/src/generator/tests.rs
    atn.set_loop_back_state(3, 4).expect("loop back state");
    atn.add_transition(0, ParserTransitionSpec::Epsilon { target: 1 })
        .expect("transition");
    atn.add_transition(1, ParserTransitionSpec::Epsilon { target: 2 })
        .expect("transition");
    atn.add_transition(1, ParserTransitionSpec::Epsilon { target: 3 })
        .expect("transition");
    atn.add_transition(
        2,
        ParserTransitionSpec::Atom {
            target: 4,
            label: 1,
        },
    )
    .expect("transition");
    atn.add_transition(4, ParserTransitionSpec::Epsilon { target: 1 })
```rust

@claude

claude Bot commented Aug 7, 2026

Copy link
Copy Markdown

Claude finished @tinovyatkin's task in 18m 50s —— View job


Code Review — PR #316 feat(codegen): add lex-only generated helpers

  • Gather context (diff, changed files, related runtime APIs)
  • Review generated helper shape & doc comments (render_model.rs, render.rs)
  • Review tests (unit snapshot + CLI generated-project tests)
  • Review regenerated recognizers & README changes
  • Verify candidate findings against the code
  • Post consolidated review

No blocking issues found. Checked for bugs and CLAUDE.md compliance across 4 independent review passes (2× CLAUDE.md compliance, 2× bug/logic), then validated every candidate finding against the runtime source. All candidates were refuted.


What I verified

format! template correctnessrender_lexer_lex_convenience emits Rust from a r#"..."# template with brace doubling. Every literal brace is correctly {{/}} and {type_name} is the only interpolation; confirmed by diffing the emitted text against the new snapshot and all four regenerated lexers. The doc example is a single-backtick inline span, not a fenced block, so rustdoc will not doctest it.

The doc claims match actual runtime behavior — this was the highest-risk area, since the rustdoc makes four behavioral promises:

  • "eagerly filled"try_newtry_with_channelbuffer_token_source loops until EOF is pushed (token_stream.rs#L31-L69). ✅
  • "retains EOF and hidden/custom channels"tokens() returns store.iter_prefix(source_token_count) with no channel filter; only lt_id/la/consume filter to DEFAULT_CHANNEL. ✅
  • "After iterating tokens(), drain_source_errors() retrieves those diagnostics" — non-obvious but correct: tokens() calls note_requested_count(self.source_token_count), which is exactly the watermark drain_source_errors partitions on. Nice catch by the author to document that ordering dependency. ✅
  • "Panics if buffering returns TokenStoreError"new is try_new(..).unwrap_or_else(|e| panic!(..)). ✅

No borrowck problem in lexInputStream::new(input.as_ref()) looked like it might borrow the local input parameter, which would make the CommonTokenStream<L> return non-compilable. It doesn't: InputStream owns its data (Rc<str> + Vec<char>, no lifetime parameter, char_stream.rs#L95-L102).

No dead_code break in the runtime's own XPath lexer — the new pub fns land inside #[allow(warnings, ...)] mod __antlr4_rust_generated, and source attributes override CLI -D warnings, so the unused helpers in x_path_lexer.rs don't trip strict clippy.

Codegen API revision correctly stays at 6 — every referenced item (InputStream, CharStream, TokenSource, CommonTokenStream::{new,try_new,tokens,get,number_of_source_errors,drain_source_errors}, TokenStoreError, ByteStream) was already a public root re-export before this PR. Purely additive; per CLAUDE.md no bump is required.

Generated files were genuinely regenerated, not hand-edited — the toml_lexer.rs / antlr_v4_lexer.rs / rust_lexer.rs / x_path_lexer.rs diffs match render_lexer_lex_convenience output character-for-character modulo the type name, the #[rustfmt::skip] blocks are preserved, the *_parser.rs files correctly received only the banner bump, and third_party/antlr-v4-grammar/self-hosted.sha256 checks clean against the regenerated sources.

Test wiring & snapshot house style — the new unit test uses a named external snapshot (house style), and generator/tests.rs already carries the file-level #![allow(clippy::disallowed_methods)] that both the insta macros and the newly-added str::replace need. The inline @r### snapshot in the CLI test is a documented deviation, but it follows an established precedent in the same suite for temp crates that are deleted after the run (parser.rs#L1081-L1089), and the snapshot correctly captures the explicit tuple because TokenView's Debug omits byte_span. The byte spans (0..5, 5..6, 7..9, 9..14, 14..14) and columns (0/5/7/8/13) are self-consistent with alpha ~é#note under ~ -> skip.

Relaxed CommonToken guard is sound!module.replace("CommonTokenStream", "").contains("CommonToken") still catches a bare CommonToken; every new occurrence is the full CommonTokenStream.

Lockfile fixture seeding is safe — the fixture crates depend only on the two workspace path crates already in the repo lock, so cargo can rewrite only the temp-dir copy under --offline; the repository Cargo.lock is never touched.


One minor, non-blocking doc nit

README.md#L385-L408 binds the stream immutably:

let tokens = json_lexer::lex(r#"{"a":1}"#, JsonLexer::new);

and the prose two paragraphs later says "after iterating tokens(), call drain_source_errors() to retrieve them." — but drain_source_errors takes &mut self (token_stream.rs#L423-L426), so a reader who copies the snippet and follows the prose hits E0596. let mut tokens in the example would close the gap. The README isn't wired into any doctest (no doc = include_str! anywhere), so nothing fails in CI — purely a copy-paste ergonomics thing. Your call whether it's worth a commit.

Fix this →


CI

All required checks are green on 1947c6ef — Clippy and Unit Tests, Rust 1.95, Runtime Testsuite, Kotlin/TypeScript/JavaScript parity, benchmarks, commitlint, codecov patch. CodeRabbit has moved to Review approved.
· branch feat/issue-242-lex-only

@codspeed-hq

codspeed-hq Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 16 untouched benchmarks


Comparing feat/issue-242-lex-only (1947c6e) with main (681fd78)

Open in CodSpeed

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown

📊 Source Code Metrics (this PR vs main)

File Cyclomatic Cognitive Functions LLOC MI
crates/antlr-rust-codegen/src/generator/tests.rs 289 (main: 288) 🔴 48 ⚪ 202 (main: 201) 🔴 1341 (main: 1337) 🔴 0 ⚪
crates/antlr-rust-codegen/src/lexer/render.rs 90 ⚪ 77 ⚪ 9 ⚪ 145 (main: 144) 🔴 0 ⚪
crates/antlr-rust-codegen/src/lexer/render_model.rs 24 (main: 23) 🔴 9 ⚪ 9 (main: 8) 🔴 35 (main: 34) 🔴 21.86 (main: 25.05) 🔴

Generated by mehen v1.8.1 — the code quality watcher.

Document vocabulary-resolved token names, always-visible numeric channels, buffered lexer diagnostics, and the CommonTokenStream construction panic. Move the README section outside the parser setup narrative.

Exercise skipped rules and UTF-8 byte/column positions end to end, strengthen the legacy CommonToken guard, and let the lexer convenience snapshot own its rendered value.

Regenerated recognizers retain generated-code API revision 6 while their stale generator banners now reflect the workspace's current 0.31.0 release.
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@tinovyatkin, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 53 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: e40d6ccf-a273-4139-af40-a030b7f3a157

📥 Commits

Reviewing files that changed from the base of the PR and between 3abf94d and 1947c6e.

📒 Files selected for processing (1)
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/lexer.rs
📝 Walkthrough

Walkthrough

Generated lexers now provide lex and lex_stream helpers for buffered token inspection. Tests cover channels, skipped tokens, Unicode spans, streams, and diagnostics. Documentation describes the APIs and fallible stream construction.

Changes

Lexer convenience workflow

Layer / File(s) Summary
Generate and wire lexer helpers
crates/antlr-rust-codegen/src/lexer/render_model.rs, crates/antlr-rust-codegen/src/lexer/render.rs, README.md
Generated lexers now expose lex for UTF-8 text and lex_stream for arbitrary CharStream inputs. Both buffer tokens in CommonTokenStream, with documented panic behavior for buffering failures.
Validate generated lexer behavior
crates/antlr-rust-codegen/src/generator/tests.rs, crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/lexer.rs
Tests verify parser-independent generation, token channels, skipped tokens, Unicode metadata, byte-stream input, EOF, and source errors.
Update fixture integrity support
crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/multi_recognizer.rs, third_party/antlr-v4-grammar/self-hosted.sha256
The fixture workspace reuses the repository lockfile. Recorded checksums are updated for generated ANTLR v4 Rust files.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant GeneratedLexer
  participant CommonTokenStream
  Caller->>GeneratedLexer: Call lex or lex_stream
  GeneratedLexer->>CommonTokenStream: Construct token stream
  CommonTokenStream->>GeneratedLexer: Request and buffer tokens
  GeneratedLexer-->>CommonTokenStream: Return tokens and source diagnostics
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The PR adds generated lex helpers, token buffering, channel and EOF coverage, and token-dump documentation required by issue #242.
Out of Scope Changes check ✅ Passed The fixture lockfile update and recognizer checksum changes support the tests and generated outputs without adding unrelated scope.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: adding generated lex-only helpers to the code generator.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/issue-242-lex-only

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@tinovyatkin

Copy link
Copy Markdown
Contributor Author

Addressed all six follow-ups in 3abf94d9:

  1. The generated and README examples now resolve token names through the grammar vocabulary and print every numeric channel explicitly.
  2. The generated-project test now exercises a real skip rule plus a multi-byte UTF-8 token with byte-span and scalar-column assertions.
  3. The legacy CommonToken guard removes CommonTokenStream before applying the original broad check.
  4. The unit test snapshots the helper once and separately checks that the exact helper was spliced into the module.
  5. Both helpers document buffered lexer diagnostics, construction panics, and the CommonTokenStream::try_new alternative.
  6. The README token section now follows the complete parser/error-listener narrative.

The follow-up also records the generated-banner refresh in the durable commit message. Focused tests, clippy, strict rustdoc, regeneration checks, self-host fixed-point tests, Markdown lint, and generated hashes are clean.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/lexer.rs`:
- Around line 263-273: Update the generated-project test around the token
assertions to use Insta: add the pinned `insta = "=1.48.0"` entry as a generated
dev dependency and replace the manually specified observed token array with
`assert_debug_snapshot!`. Preserve the explicit
`assert_eq!(tokens.number_of_source_errors(), 0)` invariant and use a named
external snapshot for the generated token dump.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 05515c55-29e0-4c03-9737-335921d0c7eb

📥 Commits

Reviewing files that changed from the base of the PR and between 681fd78 and 3abf94d.

⛔ Files ignored due to path filters (8)
  • crates/antlr-rust-codegen/src/generator/snapshots/antlr_rust_codegen__generator__tests__lexer_lex_convenience.snap is excluded by !**/*.snap
  • crates/antlr-rust-g4-parser/src/generated/antlr_v4_lexer.rs is excluded by !**/generated/**
  • crates/antlr-rust-g4-parser/src/generated/antlr_v4_parser.rs is excluded by !**/generated/**
  • crates/antlr-rust-rs-parser/src/generated/rust_lexer.rs is excluded by !**/generated/**
  • crates/antlr-rust-rs-parser/src/generated/rust_parser.rs is excluded by !**/generated/**
  • crates/antlr-rust-runtime/src/xpath/generated/x_path_lexer.rs is excluded by !**/generated/**
  • crates/antlr-rust-toml-parser/src/generated/toml_lexer.rs is excluded by !**/generated/**
  • crates/antlr-rust-toml-parser/src/generated/toml_parser.rs is excluded by !**/generated/**
📒 Files selected for processing (7)
  • README.md
  • crates/antlr-rust-codegen/src/generator/tests.rs
  • crates/antlr-rust-codegen/src/lexer/render.rs
  • crates/antlr-rust-codegen/src/lexer/render_model.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/lexer.rs
  • crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/multi_recognizer.rs
  • third_party/antlr-v4-grammar/self-hosted.sha256

Comment thread crates/antlr-rust-codegen/tests/antlr4_rust_gen_cli/lexer.rs Outdated
Use the existing inline-Insta convention for disposable generated-project crates to pin the complete vocabulary name, channel, text, byte span, and column sequence. Keep lexer diagnostics as a separate invariant.
@tinovyatkin
tinovyatkin merged commit 0949b7c into main Aug 7, 2026
19 checks passed
@tinovyatkin
tinovyatkin deleted the feat/issue-242-lex-only branch August 7, 2026 11:48
@ophiarch ophiarch Bot mentioned this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DX: lex-only token/channel dump convenience for generated lexers

1 participant