Skip to content

feat(runtime): pass the offending token to ErrorListener::syntax_error - #196

Merged
tinovyatkin merged 3 commits into
mainfrom
feat/195-offending-token
Jul 25, 2026
Merged

feat(runtime): pass the offending token to ErrorListener::syntax_error#196
tinovyatkin merged 3 commits into
mainfrom
feat/195-offending-token

Conversation

@tinovyatkin

Copy link
Copy Markdown
Contributor

Fixes #195. Stacked on #194 (branched from it; rebase after #194 merges if needed — the diff is independent).

What

ErrorListener::syntax_error now receives offending: Option<TokenView<'_>> right after the recognizer — ANTLR's canonical syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e) order. Every reference runtime passes the offending symbol; ours dropped it even though diagnostic_for_token had the token in hand.

  • ParserDiagnostic gains offending: Option<TokenId>, recorded at every creation site (diagnostic_for_token, the extraneous-input and missing-token recovery paths record the current token; AntlrError-conversion and lexer paths record None).
  • Dispatch resolves the ID to a TokenView from the token store, so listeners get start_byte()/stop_byte()/line()/column()/text() — enough to build byte-exact source spans.
  • Lexer errors pass None (no token was produced), matching ANTLR's null offendingSymbol.

Why

Found porting avdl (jonhoo/avdl) off antlr4rust: its CollectingErrorListener builds miette diagnostics with byte-offset underlines from the offending token, and its insta snapshots pin the underline widths. With only (line, column) the span degrades to a 1-char caret across dozens of golden snapshots — a visible regression that blocks faithful migration.

Breaking change

Pre-1.0 trait signature change. Implementors add one parameter; ignoring it (_offending) reproduces the old behavior exactly.

Verification

  • New test recovery_diagnostics_expose_the_offending_token_to_listeners: a listener receives a resolvable view with the correct text for a recovery diagnostic.
  • 3 insta snapshots re-accepted — the only diff is the new field (with real TokenIds recorded on the adaptive-context prediction path).
  • cargo test --locked 310 passed; clippy -D warnings all-targets all-features clean.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

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

Next review available in: 37 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

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: a1828831-22cb-4d5b-9989-d5ee5b491629

📥 Commits

Reviewing files that changed from the base of the PR and between 3634641 and 8e7884c.

⛔ Files ignored due to path filters (6)
  • src/bin_support/grammar/generated/antlr_v4_lexer.rs is excluded by !**/generated/**
  • src/snapshots/antlr4_runtime__parser__tests__generated_prediction_diagnostics_use_adaptive_context.snap is excluded by !**/*.snap
  • src/snapshots/antlr4_runtime__parser__tests__parser_dispatches_recovery_diagnostics_through_registered_listeners.snap is excluded by !**/*.snap
  • src/snapshots/antlr4_runtime__parser__tests__recovery_diagnostics_expose_the_offending_token_to_listeners.snap is excluded by !**/*.snap
  • src/snapshots/antlr4_runtime__recognizer__tests__recognizers_replace_the_default_console_error_listener.snap is excluded by !**/*.snap
  • src/xpath/generated/x_path_lexer.rs is excluded by !**/generated/**
📒 Files selected for processing (6)
  • src/bin/antlr4-runtime-testsuite.rs
  • src/bin/antlr4-rust-gen.rs
  • src/bin_support/grammar/frontend.rs
  • src/errors.rs
  • src/parser.rs
  • src/recognizer.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/195-offending-token

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.

@claude

claude Bot commented Jul 25, 2026

Copy link
Copy Markdown

Claude finished @tinovyatkin's task in 7m 54s —— View job


Code review: offending token → syntax_error

  • Gather context (diff vs origin/main, touched files)
  • Compare against ANTLR v4.13.2 upstream (antlr-upstream/) for syntaxError semantics
  • Review every diagnostic recording site for missed/incorrect anchors
  • Check test coverage + snapshot/house-style conformance
  • Verify build/tests/clippy locally
  • Post consolidated review

The design is right and the upstream alignment checks out. Both Codex P1s from 789a910f7 are resolved by 9c2cda2 (ParserError now carries the anchor; the new test is a named external snapshot). Four items below, none blocking.


Upstream verification (all confirmed against antlr-upstream/)

Claim Upstream
Parameter order (recognizer, offending, line, column, msg, error) ANTLRErrorListener.java:52-57syntaxError(recognizer, offendingSymbol, line, charPositionInLine, msg, e)
Lexer errors pass None Lexer.java:364listener.syntaxError(this, null, ...)
Extraneous-input / missing-token anchor = current token DefaultErrorStrategy.reportUnwantedToken/reportMissingToken use getCurrentToken() ✅ (parser.rs:5560, 5602)
No-viable-alt anchors at the error index, not the decision start ParserATNSimulator.java:2012-2015new NoViableAltException(..., input.get(startIndex), input.LT(1), ...) ✅ (no_viable_alternativetoken_at(error_index), parser.rs:11283)
Failed-predicate anchor = current token FailedPredicateException sets offendingToken = recognizer.getCurrentToken() ✅ (parser.rs:6588, 6608)

Two things I specifically tried to break and could not:

  • Anchor invalidation by single-token insertion. insert_synthetic_tokenCommonTokenStream::insertTokenStore::push (token_stream.rs:250) appends, so recorded TokenIds stay valid across recovery. No shifting.
  • Alternative selection perturbed by the new field. dedupe_fast_outcomes keys on (index, consumed_eof, diagnostics_len, diagnostics_recovery_rank) (parser.rs:12327-12330), not full ParserDiagnostic equality — so widening the struct can't change which alternative wins. Consistent with the 357/357 sweep you reported.

Also verified: .clippy.toml has too-many-arguments-threshold = 6, so the three #[allow(clippy::too_many_arguments)]s land on exactly the 7-arg functions and Recognizer::notify_error_listeners (6 args) correctly has none. No syntax_error impls elsewhere in the repo, nothing in .conformance-review/Rust.test.stg or src/bin_support/embedded.rs references notifyErrorListeners, and no checked-in generated code outside the two updated files calls it.

Locally: cargo test --locked → 310 passed, 0 failed. cargo clippy --locked --all-targets --all-features -- -D warnings → clean.


1. The motivating capability — byte spans — isn't pinned by any test (medium)

RecordedDiagnostic captures only offending_text (parser.rs:12755). The new snapshot proves the view resolves and the text is right, but nothing asserts byte_span()/start_byte()/stop_byte(). That's the whole point of the change: avdl's snapshots pin underline widths, and a regression that delivered a different-but-same-text token, or a view whose byte span collapsed to 0..0, would sail through.

Cheap to close — the test token already carries a real span: TestToken::with_span(0, 3) sets start_byte = 0, stop_byte = 4 (parser.rs:12627-12628), so adding

offending_byte_span: offending.as_ref().map(Token::byte_span),

to RecordedDiagnostic makes the snapshot show 0..4 and turns the byte-exactness claim into a regression target. Fix this →

2. Two more breaking changes than the PR body lists (medium)

The body calls out the ErrorListener::syntax_error signature. Two others ship alongside it and downstream users will hit both:

  • AntlrError::ParserError gained a field — any exhaustive AntlrError::ParserError { line, column, message } pattern stops compiling. The PR itself had to patch the smoke-crate template to { line, column, message, .. } (src/bin/antlr4-runtime-testsuite.rs:1074), which is exactly the downstream experience.
  • Recognizer::notify_error_listeners gained a parameter — generated recognizers call it (src/bin/antlr4-rust-gen.rs:3307), so previously generated parsers/lexers must be regenerated, not just recompiled.

The repo has never used ! or BREAKING CHANGE: footers (0 in the last 400 commits), so I'm not claiming a convention violation — but release-please reads conventional commits, and without a footer the release notes get no ⚠ section for a change that requires regeneration. Worth at least adding both to the PR body.

3. The "anchor captured at build time" invariant holds for ParserError only (low)

errors.rs:22-27 documents the rule crisply, and 9c2cda2 implements it for ParserError. But generated_rule_error_diagnostic's other live arms still resolve lazily:

AntlrError::MismatchedInput { .. } => diagnostic_for_token(self.input.lt(1), ...),   // parser.rs:5930
AntlrError::Unsupported(message)   => diagnostic_for_token(self.input.lt(1), message), // parser.rs:5948

MismatchedInput is live — match_token (parser.rs:5332) and match_wildcard (parser.rs:6263) both produce it. Not a new defect: those variants carry no position either, so the anchor is exactly as stale as the line/column already were, and they stay mutually consistent. (NoViableAlternative is constructed only in tests, so its arm is effectively dead.) Still, the doc comment reads as a runtime-wide guarantee when it isn't — either extend the anchor to those variants or narrow the wording. Fix this →

4. offending: TokenId is store-relative but rides on a Clone + Eq error that outlives the store (low)

Resolution is safe inside dispatch. But the field is public on a value users can keep, and CommonTokenStream::try_refill replaces the store outright (self.store = store, token_stream.rs:141), restarting TokenIds at 0. The README documents exactly that reuse pattern (tokens.refill(); parser.reset();, README.md:213-222), so an error held across a re-feed resolves through parser.token_store().view(id) to a different token — silently, no None. The field doc explains when the anchor is captured but not that it's only meaningful against the store that produced it. One sentence on the field, plus a line in the README's error-listener paragraph (README.md:201-203), closes it. Fix this →

Nits (no action needed)

  • push_generated_parser_diagnostic (parser.rs:5903) dedupes on full ParserDiagnostic equality, which now includes offending — strictly narrower than before. I traced every producer and couldn't construct a reachable case where identical (line, column, message) maps to different TokenIds, and 357/357 conformance agrees. Informational.
  • DiagnosticCollector in src/bin_support/grammar/frontend.rs:962 discards _offending. The .g4 frontend is the one in-repo consumer that renders grammar diagnostics, so it's the natural first customer for the new spans — nice follow-up, out of scope here.
  • Prediction reports (reportAttemptingFullContext/reportContextSensitivity) now dispatch with a non-null offending symbol, where upstream routes them through the separate reportAmbiguity/reportAttemptingFullContext callbacks and never through syntaxError. That funnelling is a pre-existing deviation of this runtime, not something this PR introduces, and the added anchor is a strict improvement — just noting it in case the single-callback shape is ever revisited.
    · branch feat/195-offending-token

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 789a910f72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/parser.rs Outdated
Comment on lines +5912 to +5915
line,
column,
message,
offending: None,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Preserve the current token for recovered parser errors

When a generated match cannot use insertion or deletion, recover_generated_match returns an AntlrError::ParserError, and nested generated rules pass it through this branch while the offending lookahead is still available. Hard-coding offending: None therefore leaves listeners without a token for ordinary mismatched-input diagnostics—the main span-building scenario this change is intended to support. Resolve the current lookahead here, as the other parser-error variants do.

Useful? React with 👍 / 👎.

Comment thread src/parser.rs Outdated
Comment on lines +12865 to +12866
assert_eq!(recorded.len(), 1);
assert_eq!(recorded[0].offending_text.as_deref(), Some("oops"));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Snapshot the complete recorded diagnostic

This value-pinning test uses the explicitly discouraged “assert length, then spot-check one field” pattern, so changes to the grammar name, position, message, or error payload can pass unnoticed. Replace these assertions with a named external assert_debug_snapshot! of the complete recorded value.

AGENTS.md reference: AGENTS.md:L167-L177

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jul 25, 2026

Copy link
Copy Markdown

📊 Source Code Metrics (this PR vs main)

File Cyclomatic Cognitive Functions LLOC MI
src/parser.rs 2105 (main: 2102) 🔴 1404 ⚪ 657 (main: 656) 🔴 4600 (main: 4586) 🔴 0 ⚪
src/recognizer.rs 43 (main: 42) 🔴 1 ⚪ 34 ⚪ 48 ⚪ 10.90 (main: 11.69) 🔴
src/errors.rs 4 ⚪ 0 ⚪ 1 ⚪ 1 ⚪ 36.55 (main: 39.25) 🔴

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

@codecov

codecov Bot commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.44444% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/parser.rs 81.81% 14 Missing ⚠️

📢 Thoughts on this report? Let us know!

ErrorListener::syntax_error now receives offending: Option<TokenView>
right after the recognizer, matching ANTLR's canonical
syntaxError(recognizer, offendingSymbol, ...) contract. Every reference
runtime passes the offending symbol; span-building error reporters
(e.g. avdl's miette diagnostics with byte-offset underlines) need
start_byte/stop_byte from the token, not just (line, column).

ParserDiagnostic records the anchoring TokenId at each creation site
(diagnostic_for_token already had the token in hand; the extraneous/
missing recovery paths record the current token) and dispatch resolves
it to a TokenView from the token store. Lexer-originated diagnostics
pass None, matching ANTLR's null offendingSymbol for lexer errors.

Fixes #195
@tinovyatkin
tinovyatkin force-pushed the feat/195-offending-token branch from 789a910 to cbefcfd Compare July 25, 2026 13:46
@tinovyatkin

Copy link
Copy Markdown
Contributor Author

Local conformance sweep on this branch (rebased onto main incl. #194): 357 passed, 0 failed, 0 skipped. The offending-token threading is diagnostics-plumbing only — no recognition-path change, as the sweep confirms.

Review on #196 found the offending-token contract held only for
extraneous-input/missing-token recovery and prediction diagnostics:
generated parsers route ordinary mismatched-input, no-viable-alternative,
failed-predicate, and sync errors through AntlrError::ParserError, whose
diagnostic arm hard-coded offending: None — exactly the errors a real
recognizer reports most.

ParserError gains offending: Option<TokenId>, recorded where each error
is built (recover_generated_match, generated sync, failed-predicate
builders, recognition_error) rather than resolved at reporting time:
prediction restores the input cursor, so lt(1) at dispatch can point at
the decision start instead of the error index —
no_viable_alternative_error_at now forwards the anchor its diagnostic
already computed.

Also converts the new listener test to a named insta snapshot per house
style.
@github-actions

Copy link
Copy Markdown

Copy/Paste Detection

Found 1789 duplication(s) across 8 changed Rust file(s) (threshold: 100 tokens).

Show duplications

Found a 1 line (391 tokens) duplication in the following files:

  • Starting at line 220 of src/bin_support/grammar/generated/antlr_v4_lexer.rs
  • Starting at line 220 of src/bin_support/grammar/generated/antlr_v4_lexer.rs
static LEXER_DFA_DATA: &[u32] = &[1280852999,3,0,4096,4133,4138,0,0,65535,4294967295,1,1,65535,0,2,1,65535,1,2,1,65535,2,3,2,65535,3,2,1,65535,4,2,1,65535,5,2,1,65535,6,4,1,65535,7,2,1,65535,8,5,1,65535,4294967295,6,1,65535,9,7,1,65535,4294967295,2,1,65535,10,8,1,65535,11,9,1,65535,12,2,1,65535,13,2,1,65535,14,2,1,65535,15,2,1,65535,16,2,1,65535,17,2,1,65535,18,10,3,65535,19,2,1,65535,20,11,3,65535,21,12,3,65535,22,13,3,65535,23,14,3,65535,24,15,3,65535,25,16,3,65535,26,17,3,65535,27,18,3,65535,28,19,3,65535,29,20,3,65535,30,21,4,65535,4294967295,2,1,65535,31,2,1,65535,32,2,1,65535,33,2,1,65535,34,22,2,68,4294967295,2,1,65535,35,2,1,65535,36,2,1,65535,37,23,5,70,4294967295,24,6,65535,38,2,1,65535,39,25,3,65535,40,26,3,65535,41,27,3,65535,42,28,3,65535,43,29,3,65535,44,30,3,65535,45,31,3,65535,46,32,3,65535,47,33,3,65535,48,34,3,65535,49,35,3,65535,50,36,3,65535,51,37,3,65535,52,38,3,65535,53,39,3,65535,54,40,3,65535,55,41,7,65535,4294967295,42,8,65535,4294967295,43,4,65535,4294967295,44,4,65535,4294967295,45,9,65535,4294967295,2,1,65535,56,46,10,65535,57,47,2,65535,58,2,1,65535,59,48,5,70,4294967295,49,11,102,4294967295,50,3,65535,60,51,3,65535,61,52,3,65535,62,53,3,65535,63,54,3,65535,64,55,3,65535,65,56,3,65535,66,57,3,65535,67,58,3,65535,68,59,3,65535,69,60,3,65535,70,61,3,65535,71,62,3,65535,72,63,3,65535,73,64,3,65535,74,65,3,65535,75,66,3,65535,76,67,7,65535,4294967295,68,4,65535,4294967295,69,7,124,4294967295,70,8,126,4294967295,71,12,65535,4294967295,72,13,65535,4294967295,73,9,142,4294967295,74,14,65535,4294967295,2,1,65535,77,75,10,68,4294967295,76,2,65535,78,77,5,70,4294967295,2,1,65535,79,78,11,102,4294967295,79,11,102,4294967295,80,15,152,80,81,3,65535,81,82,3,65535,82,83,3,65535,83,84,3,65535,84,85,3,65535,85,86,3,65535,86,87,3,65535,87,88,3,65535,88,10,3,65535,89,89,3,65535,90,90,3,65535,91,91,3,65535,92,92,3,65535,93,93,3,65535,94,94,3,65535,95,95,3,65535,96,96,3,65535,97,97,16,65535,4294967295,98,17,65535,4294967295,99,7,65535,4294967295,100,18,65535,4294967295,101,8,65535,4294967295,102,19,65535,4294967295,103,20,65535,4294967295,104,12,65535,4294967295,105,12,65535,4294967295,106,12,65535,4294967295,107,21,65535,4294967295,108,22,65535,98,109,13,65535,4294967295,110,23,65535,4294967295,111,24,65535,4294967295,112,25,65535,4294967295,109,13,65535,4294967295,113,26,65535,4294967295,109,13,65535,99,114,27,65535,4294967295,115,9,65535,4294967295,116,28,65535,4294967295,117,14,65535,4294967295,118,14,142,4294967295,119,29,65535,4294967295,120,10,65535,100,121,2,65535,101,2,1,65535,102,2,1,65535,103,2,1,65535,104,80,15,152,4294967295,122,15,152,4294967295,10,3,65535,105,123,3,65535,106,124,3,65535,107,125,3,65535,108,126,3,65535,109,127,3,65535,110,10,3,65535,111,128,3,65535,112,129,3,65535,113,130,3,65535,114,131,3,65535,115,132,3,65535,116,133,3,65535,117,134,3,65535,118,135,3,65535,119,136,3,65535,120,137,16,65535,4294967295,138,30,65535,4294967295,139,31,65535,4294967295,140,16,249,4294967295,141,32,65535,4294967295,142,17,124,4294967295,143,7,65535,4294967295,144,18,126,4294967295,145,8,65535,4294967295,146,19,65535,4294967295,108,22,65535,4294967295,147,12,65535,4294967295,148,19,65535,4294967295,149,19,124,4294967295,150,20,65535,4294967295,151,20,126,4294967295,152,33,65535,4294967295,153,34,65535,4294967295,154,21,65535,4294967295,155,21,142,4294967295,156,35,65535,4294967295,157,22,65535,4294967295,158,23,65535,4294967295,159,23,65535,4294967295,160,36,65535,4294967295,161,23,65535,4294967295,162,23,124,4294967295,163,37,65535,4294967295,164,38,65535,4294967295,165,24,65535,4294967295,166,24,126,4294967295,167,39,65535,4294967295,168,33,65535,4294967295,169,40,65535,4294967295,170,41,65535,4294967295,112,25,65535,4294967295,171,25,65535,4294967295,112,25,65535,4294967295,172,42,65535,4294967295,173,43,65535,4294967295,174,26,65535,4294967295,175,26,142,4294967295,176,27,142,4294967295,177,44,65535,4294967295,178,9,65535,4294967295,179,28,333,4294967295,180,45,65535,4294967295,181,14,65535,4294967295,182,46,65535,4294967295,183,29,65535,4294967295,184,29,142,4294967295,45,9,65535,121,185,10,65535,122,3,2,65535,123,2,1,65535,124,186,3,65535,125,187,3,65535,126,188,3,65535,127,189,3,65535,128,10,3,65535,129,10,3,65535,130,190,3,65535,131,10,3,65535,132,191,3,65535,133,192,3,65535,134,10,3,65535,135,193,3,65535,136,10,3,65535,137,194,3,65535,138,195,31,65535,4294967295,196,30,65535,4294967295,197,30,364,4294967295,198,31,65535,4294967295,199,16,65535,4294967295,200,47,65535,4294967295,201,31,65535,4294967295,202,31,364,4294967295,203,48,65535,4294967295,204,49,65535,4294967295,205,16,65535,4294967295,206,16,364,4294967295,207,16,65535,4294967295,208,17,65535,4294967295,209,32,65535,4294967295,210,32,65535,4294967295,2,1,65535,139,211,17,65535,4294967295,212,7,65535,4294967295,213,18,65535,4294967295,214,8,65535,4294967295,215,50,65535,4294967295,216,51,65535,4294967295,217,19,65535,4294967295,218,52,65535,4294967295,219,20,65535,4294967295,220,53,65535,4294967295,221,54,65535,4294967295,168,33,65535,4294967295,222,55,65535,4294967295,223,33,65535,4294967295,224,56,65535,4294967295,153,34,65535,4294967295,225,57,65535,4294967295,226,58,65535,4294967295,227,34,65535,4294967295,153,34,65535,4294967295,228,59,65535,4294967295,153,34,65535,140,229,60,65535,4294967295,230,21,65535,4294967295,231,61,65535,4294967295,232,35,65535,4294967295,233,35,65535,4294967295,234,35,142,4294967295,235,62,65535,4294967295,236,63,65535,4294967295,237,36,65535,4294967295,238,36,464,4294967295,239,64,65535,4294967295,240,65,65535,4294967295,241,66,65535,4294967295,158,23,65535,4294967295,242,23,65535,4294967295,243,67,65535,4294967295,244,37,65535,4294967295,245,37,484,4294967295,246,38,65535,4294967295,247,38,65535,4294967295,248,38,65535,4294967295,249,38,490,4294967295,250,68,65535,4294967295,251,69,65535,4294967295,252,70,65535,4294967295,111,24,65535,4294967295,253,24,65535,4294967295,254,39,65535,4294967295,255,39,507,4294967295,256,33,65535,4294967295,257,40,65535,4294967295,258,40,65535,4294967295,259,71,65535,4294967295,257,40,65535,4294967295,260,40,65535,4294967295,261,40,124,4294967295,262,72,65535,4294967295,263,73,65535,4294967295,170,41,65535,4294967295,264,41,65535,4294967295,265,41,126,4294967295,266,74,65535,4294967295,112,25,65535,4294967295,267,75,65535,4294967295,172,42,65535,4294967295,268,42,65535,4294967295,269,42,142,4294967295,270,43,65535,4294967295,271,43,333,4294967295,272,76,65535,4294967295,273,77,65535,4294967295,113,26,65535,4294967295,274,26,65535,4294967295,275,27,65535,4294967295,276,78,65535,4294967295,277,44,65535,4294967295,278,44,142,4294967295,279,79,65535,4294967295,280,9,65535,4294967295,281,28,65535,4294967295,282,80,65535,4294967295,283,81,65535,4294967295,284,45,65535,4294967295,285,82,333,4294967295,286,82,65535,4294967295,287,8,65535,141,288,14,65535,4294967295,289,46,507,4294967295,290,83,65535,4294967295,291,84,65535,4294967295,292,85,65535,4294967295,293,29,65535,4294967295,294,10,65535,142,295,3,65535,143,10,3,65535,144,296,3,65535,145,10,3,65535,146,297,3,65535,147,10,3,65535,148,298,3,65535,149,10,3,65535,150,299,1,65535,4294967295,2,1,65535,151,300,16,65535,4294967295,301,30,65535,4294967295,302,86,65535,4294967295,303,30,65535,4294967295,304,30,364,4294967295,305,30,65535,4294967295,300,16,65535,4294967295,306,31,65535,4294967295,307,47,65535,4294967295,308,47,610,4294967295,309,87,65535,4294967295,310,88,65535,4294967295,311,31,65535,4294967295,312,31,364,4294967295,313,31,65535,4294967295,314,48,629,4294967295,315,89,65535,4294967295,316,90,65535,4294967295,317,49,249,4294967295,318,31,65535,4294967295,319,16,65535,4294967295,320,16,65535,4294967295,321,32,65535,4294967295,322,91,65535,4294967295,323,92,65535,4294967295,324,17,65535,4294967295,67,7,65535,4294967295,325,18,65535,4294967295,42,8,65535,4294967295,326,50,65535,4294967295,327,93,65535,4294967295,328,87,65535,4294967295,329,50,65535,4294967295,330,50,249,4294967295,331,94,65535,4294967295,332,95,65535,4294967295,216,51,65535,4294967295,333,51,65535,4294967295,334,51,124,4294967295,335,96,65535,4294967295,336,19,65535,4294967295,337,97,65535,4294967295,338,98,65535,4294967295,218,52,65535,4294967295,339,52,65535,4294967295,340,52,126,4294967295,341,99,65535,4294967295,342,20,65535,4294967295,343,53,65535,4294967295,344,33,65535,4294967295,345,53,65535,4294967295,346,53,124,4294967295,347,54,65535,4294967295,348,54,126,4294967295,349,55,65535,4294967295,350,100,65535,4294967295,351,101,65535,4294967295,352,102,65535,4294967295,353,55,65535,4294967295,354,103,65535,4294967295,355,56,65535,4294967295,356,56,142,4294967295,357,104,65535,4294967295,358,57,65535,4294967295,359,57,65535,4294967295,360,105,65535,4294967295,361,57,65535,4294967295,358,57,65535,4294967295,362,57,124,4294967295,363,106,65535,4294967295,364,107,65535,4294967295,365,58,65535,4294967295,226,58,65535,4294967295,366,58,126,4294967295,367,108,65535,4294967295,349,55,65535,4294967295,368,109,65535,4294967295,369,59,65535,4294967295,228,59,65535,4294967295,370,59,142,4294967295,371,110,65535,4294967295,229,60,65535,4294967295,372,60,65535,4294967295,373,60,142,4294967295,374,21,65535,4294967295,375,61,65535,4294967295,376,61,333,4294967295,377,111,65535,4294967295,378,60,65535,4294967295,379,35,65535,4294967295,380,112,65535,4294967295,381,62,65535,4294967295,382,62,65535,4294967295,383,62,142,4294967295,107,21,65535,152,384,63,65535,4294967295,385,63,65535,4294967295,386,113,65535,4294967295,387,63,65535,4294967295,388,63,249,4294967295,389,114,65535,4294967295,390,115,65535,4294967295,391,116,65535,4294967295,392,117,65535,4294967295,160,36,65535,4294967295,393,36,65535,4294967295,394,64,65535,4294967295,395,64,829,4294967295,396,118,65535,4294967295,240,65,65535,4294967295,397,65,65535,4294967295,398,65,124,4294967295,399,119,65535,4294967295,400,120,65535,4294967295,401,80,65535,4294967295,402,66,65535,4294967295,403,66,124,4294967295,404,121,65535,4294967295,405,23,65535,4294967295,406,67,65535,4294967295,407,67,853,4294967295,408,122,65535,4294967295,409,123,65535,4294967295,410,124,65535,4294967295,163,37,65535,4294967295,411,37,65535,4294967295,412,125,65535,4294967295,413,126,65535,4294967295,414,127,65535,4294967295,415,128,65535,4294967295,246,38,65535,4294967295,416,38,65535,4294967295,417,68,65535,4294967295,418,68,887,4294967295,419,129,65535,4294967295,251,69,65535,4294967295,420,69,65535,4294967295,421,69,126,4294967295,422,130,65535,4294967295,423,131,65535,4294967295,424,132,65535,4294967295,425,70,65535,4294967295,426,70,126,4294967295,427,24,65535,4294967295,428,133,65535,4294967295,429,134,65535,4294967295,430,135,65535,4294967295,167,39,65535,4294967295,431,39,65535,4294967295,71,12,65535,4294967295,432,136,65535,4294967295,259,71,65535,4294967295,433,71,65535,4294967295,434,71,464,4294967295,435,137,65535,4294967295,240,65,65535,4294967295,436,138,65535,4294967295,257,40,65535,4294967295,437,40,65535,4294967295,438,139,65535,4294967295,262,72,65535,4294967295,439,72,65535,4294967295,440,72,484,4294967295,441,73,65535,4294967295,442,73,65535,4294967295,441,73,65535,4294967295,443,73,65535,4294967295,444,73,490,4294967295,445,140,65535,4294967295,251,69,65535,4294967295,446,141,65535,4294967295,170,41,65535,4294967295,447,41,65535,4294967295,266,74,65535,4294967295,448,74,65535,4294967295,449,74,507,4294967295,267,75,65535,4294967295,450,75,65535,4294967295,451,75,333,4294967295,272,76,65535,4294967295,452,142,65535,4294967295,172,42,65535,4294967295,453,42,65535,4294967295,454,143,65535,4294967295,455,144,65535,4294967295,173,43,65535,4294967295,456,43,65535,4294967295,457,145,65535,4294967295,272,76,65535,4294967295,458,76,65535,4294967295,459,76,142,4294967295,460,77,65535,4294967295,461,146,65535,4294967295,462,77,65535,4294967295,463,77,992,4294967295,464,26,65535,4294967295,465,27,65535,4294967295,466,78,333,4294967295,467,147,65535,4294967295,468,148,65535,4294967295,469,149,65535,4294967295,470,44,65535,4294967295,471,79,65535,4294967295,472,79,142,4294967295,114,27,65535,153,45,9,65535,4294967295,473,28,65535,4294967295,474,132,65535,4294967295,475,80,464,4294967295,476,81,65535,4294967295,477,81,333,4294967295,478,150,65535,4294967295,479,151,65535,4294967295,480,152,65535,4294967295,481,82,65535,4294967295,482,82,65535,4294967295,116,28,65535,154,483,14,65535,4294967295,484,46,65535,4294967295,485,83,65535,4294967295,486,83,507,4294967295,487,153,65535,4294967295,488,84,65535,4294967295,489,84,65535,4294967295,490,84,142,4294967295,224,56,65535,155,491,85,65535,4294967295,492,154,65535,4294967295,493,155,65535,4294967295,494,85,142,4294967295,495,156,65535,4294967295,491,85,65535,156,496,29,65535,4294967295,46,10,65535,157,497,3,65535,158,10,3,65535,159,498,1,65535,4294967295,2,1,65535,160,499,3,65535,161,500,31,65535,4294967295,501,31,65535,4294967295,502,86,65535,4294967295,503,86,364,4294967295,504,30,65535,4294967295,505,30,65535,4294967295,506,30,65535,4294967295,507,157,65535,4294967295,508,47,65535,4294967295,509,158,65535,4294967295,510,47,65535,4294967295,511,47,364,4294967295,512,47,65535,4294967295,513,50,65535,4294967295,514,159,65535,4294967295,515,87,65535,4294967295,516,87,65535,4294967295,517,87,364,4294967295,518,160,65535,4294967295,519,88,65535,4294967295,520,63,65535,4294967295,521,161,65535,4294967295,522,162,65535,4294967295,523,88,364,4294967295,524,163,65535,4294967295,300,16,65535,4294967295,525,31,65535,4294967295,526,31,65535,4294967295,527,164,65535,4294967295,528,48,65535,4294967295,529,48,364,4294967295,530,48,65535,4294967295,531,165,65535,4294967295,532,89,65535,4294967295,533,89,629,4294967295,534,166,65535,4294967295,535,90,65535,4294967295,536,49,65535,4294967295,537,90,65535,4294967295,538,90,364,4294967295,539,49,65535,4294967295,540,49,364,4294967295,541,49,65535,4294967295,542,157,65535,4294967295,543,16,65535,4294967295,544,16,65535,4294967295,545,49,65535,4294967295,546,167,65535,4294967295,547,168,65535,4294967295,548,91,65535,4294967295,549,91,65535,4294967295,550,91,65535,4294967295,551,169,65535,4294967295,552,170,65535,162,553,92,65535,4294967295,554,171,65535,4294967295,555,172,65535,4294967295,556,173,65535,4294967295,553,92,65535,4294967295,557,149,65535,4294967295,553,92,65535,163,558,17,65535,4294967295,559,18,65535,4294967295,560,87,65535,4294967295,561,93,65535,4294967295,562,93,65535,4294967295,563,93,364,4294967295,564,50,65535,4294967295,565,174,65535,4294967295,566,50,65535,4294967295,567,50,364,4294967295,568,50,65535,4294967295,569,94,65535,4294967295,570,51,65535,4294967295,571,97,65535,4294967295,572,94,65535,4294967295,573,94,65535,4294967295,574,94,124,4294967295,575,175,65535,4294967295,343,53,65535,164,576,95,65535,4294967295,577,176,464,4294967295,578,177,65535,4294967295,579,51,65535,4294967295,580,96,65535,4294967295,581,178,484,4294967295,582,179,65535,4294967295,583,19,65535,4294967295,584,52,65535,4294967295,585,97,65535,4294967295,586,180,490,4294967295,587,95,65535,4294967295,588,98,65535,4294967295,589,98,65535,4294967295,590,98,126,4294967295,221,54,65535,165,591,181,65535,4294967295,592,52,65535,4294967295,593,99,65535,4294967295,594,182,507,4294967295,595,183,65535,4294967295,596,20,65535,4294967295,597,184,65535,4294967295,598,185,65535,4294967295,599,53,65535,4294967295,600,186,65535,4294967295,601,54,65535,4294967295,349,55,65535,4294967295,602,100,65535,4294967295,603,187,65535,4294967295,604,188,65535,4294967295,605,100,65535,4294967295,602,100,65535,4294967295,606,100,124,4294967295,607,189,65535,4294967295,602,100,65535,166,608,190,65535,4294967295,609,191,65535,4294967295,610,101,65535,4294967295,351,101,65535,4294967295,611,101,126,4294967295,612,192,65535,4294967295,351,101,65535,167,352,102,65535,4294967295,613,193,65535,4294967295,614,194,65535,4294967295,615,102,65535,4294967295,616,102,65535,4294967295,617,102,65535,4294967295,618,195,65535,4294967295,619,187,65535,4294967295,349,55,65535,4294967295,620,196,65535,4294967295,349,55,65535,168,621,197,65535,4294967295,622,103,65535,4294967295,354,103,65535,4294967295,623,103,142,4294967295,624,198,65535,4294967295,354,103,65535,169,625,199,65535,4294967295,626,56,65535,4294967295,627,200,65535,4294967295,357,104,65535,4294967295,628,104,65535,4294967295,629,104,142,4294967295,630,201,65535,4294967295,631,105,65535,4294967295,360,105,65535,4294967295,632,105,464,4294967295,633,202,65535,4294967295,634,187,65535,4294967295,578,177,65535,4294967295,358,57,65535,4294967295,635,57,65535,4294967295,636,203,65535,4294967295,637,106,65535,4294967295,363,106,65535,4294967295,638,106,484,4294967295,639,107,65535,4294967295,640,107,65535,4294967295,641,107,65535,4294967295,639,107,65535,4294967295,642,107,490,4294967295,643,204,65535,4294967295,609,191,65535,4294967295,591,181,65535,4294967295,226,58,65535,4294967295,644,58,65535,4294967295,645,108,65535,4294967295,367,108,65535,4294967295,646,108,507,4294967295,647,109,65535,4294967295,368,109,65535,4294967295,648,109,333,4294967295,620,196,65535,4294967295,649,205,65535,4294967295,228,59,65535,4294967295,650,59,65535,4294967295,651,110,65535,4294967295,652,200,333,4294967295,156,35,65535,4294967295,653,60,65535,4294967295,654,21,65535,4294967295,655,206,65535,4294967295,656,61,65535,4294967295,657,207,65535,4294967295,658,208,65535,4294967295,659,111,65535,4294967295,660,111,65535,4294967295,661,209,333,4294967295,662,209,65535,4294967295,663,20,65535,170,664,196,65535,4294967295,665,35,65535,4294967295,666,112,65535,4294967295,667,112,507,4294967295,668,210,65535,4294967295,669,60,65535,4294967295,618,195,65535,4294967295,670,62,65535,4294967295,385,63,65535,4294967295,671,211,65535,4294967295,672,113,65535,4294967295,673,113,1429,4294967295,674,212,65535,4294967295,675,213,65535,4294967295,676,214,65535,4294967295,677,63,65535,4294967295,678,63,364,4294967295,679,63,65535,4294967295,680,215,65535,4294967295,681,114,65535,4294967295,682,114,1452,4294967295,390,115,65535,4294967295,683,115,65535,4294967295,684,115,464,4294967295,685,216,65535,4294967295,686,217,65535,4294967295,687,218,65535,4294967295,688,116,464,4294967295,689,219,65535,4294967295,690,220,65535,4294967295,691,117,65535,4294967295,692,117,464,4294967295,693,221,65535,4294967295,694,36,65535,4294967295,695,222,65535,4294967295,696,223,65535,4294967295,697,224,65535,4294967295,239,64,65535,4294967295,698,64,65535,4294967295,396,118,65535,4294967295,699,118,65535,4294967295,700,225,65535,4294967295,240,65,65535,4294967295,240,65,65535,4294967295,701,65,65535,4294967295,702,226,65535,4294967295,399,119,65535,4294967295,703,119,65535,4294967295,704,120,65535,4294967295,705,66,65535,4294967295,706,131,65535,4294967295,707,120,65535,4294967295,708,120,124,4294967295,709,227,65535,4294967295,67,7,65535,171,710,66,65535,4294967295,711,121,484,4294967295,712,23,65535,4294967295,713,228,65535,4294967295,714,229,65535,4294967295,715,230,65535,4294967295,243,67,65535,4294967295,716,67,65535,4294967295,717,231,65535,4294967295,408,122,65535,4294967295,718,122,65535,4294967295,719,122,484,4294967295,720,123,484,4294967295,721,232,65535,4294967295,722,233,65535,4294967295,723,124,65535,4294967295,724,124,484,4294967295,725,234,65535,4294967295,726,37,65535,4294967295,727,125,65535,4294967295,728,125,65535,4294967295,729,125,65535,4294967295,730,125,1539,4294967295,731,235,65535,4294967295,413,126,65535,4294967295,732,126,65535,4294967295,733,126,490,4294967295,734,236,65535,4294967295,735,237,65535,4294967295,736,238,65535,4294967295,737,127,490,4294967295,738,239,65535,4294967295,739,240,65535,4294967295,740,128,65535,4294967295,741,128,490,4294967295,742,241,65535,4294967295,743,38,65535,4294967295,744,242,65535,4294967295,745,243,65535,4294967295,746,244,65535,4294967295,250,68,65535,4294967295,747,68,65535,4294967295,748,129,65535,4294967295,749,129,65535,4294967295,748,129,65535,4294967295,750,129,65535,4294967295,751,245,65535,4294967295,251,69,65535,4294967295,251,69,65535,4294967295,752,69,65535,4294967295,422,130,65535,4294967295,753,130,65535,4294967295,754,70,65535,4294967295,755,131,490,4294967295,756,132,65535,4294967295,757,132,126,4294967295,42,8,65535,172,758,70,65535,4294967295,759,24,65535,4294967295,428,133,65535,4294967295,760,133,65535,4294967295,761,133,507,4294967295,762,134,507,4294967295,763,246,65535,4294967295,764,135,65535,4294967295,765,135,65535,4294967295,766,135,1604,4294967295,767,39,65535,4294967295,768,136,65535,4294967295,769,247,65535,4294967295,770,136,65535,4294967295,771,248,65535,4294967295,768,136,65535,4294967295,772,136,65535,4294967295,773,136,249,4294967295,774,249,65535,4294967295,390,115,65535,4294967295,775,250,65535,4294967295,259,71,65535,4294967295,776,71,65535,4294967295,435,137,65535,4294967295,777,137,65535,4294967295,778,137,829,4294967295,779,185,65535,4294967295,780,176,65535,4294967295,436,138,65535,4294967295,781,138,65535,4294967295,782,138,124,4294967295,783,178,65535,4294967295,784,40,65535,4294967295,438,139,65535,4294967295,785,139,65535,4294967295,786,139,853,4294967295,408,122,65535,4294967295,787,251,65535,4294967295,262,72,65535,4294967295,788,72,65535,4294967295,789,252,65535,4294967295,413,126,65535,4294967295,790,253,65535,4294967295,441,73,65535,4294967295,791,73,65535,4294967295,445,140,65535,4294967295,792,140,65535,4294967295,793,140,887,4294967295,794,180,65535,4294967295,446,141,65535,4294967295,795,141,65535,4294967295,796,141,126,4294967295,797,182,65535,4294967295,798,41,65535,4294967295,428,133,65535,4294967295,799,254,65535,4294967295,800,255,65535,4294967295,266,74,65535,4294967295,801,74,65535,4294967295,454,143,65535,4294967295,802,256,65535,4294967295,803,257,65535,4294967295,267,75,65535,4294967295,804,75,65535,4294967295,805,142,65535,4294967295,806,258,65535,4294967295,805,142,65535,4294967295,807,142,65535,4294967295,808,142,992,4294967295,809,42,65535,4294967295,454,143,65535,4294967295,810,143,65535,4294967295,811,143,333,4294967295,812,144,65535,4294967295,813,144,65535,4294967295,814,144,1707,4294967295,815,43,65535,4294967295,457,145,65535,4294967295,816,145,65535,4294967295,272,76,65535,4294967295,817,259,65535,4294967295,272,76,65535,4294967295,818,76,65535,4294967295,819,146,65535,4294967295,820,146,1719,4294967295,821,260,65535,4294967295,822,261,65535,4294967295,823,262,65535,4294967295,460,77,65535,4294967295,824,77,65535,4294967295,825,26,65535,4294967295,826,27,65535,4294967295,827,78,65535,4294967295,828,116,65535,4294967295,829,263,65535,4294967295,830,147,65535,4294967295,831,264,333,4294967295,832,264,65535,4294967295,833,18,65535,173,834,265,65535,4294967295,835,148,65535,4294967295,836,148,65535,4294967295,837,148,142,4294967295,838,266,65535,4294967295,839,267,65535,4294967295,840,268,65535,4294967295,841,149,142,4294967295,842,44,65535,4294967295,843,269,65535,4294967295,844,270,65535,4294967295,845,79,65535,4294967295,846,28,65535,4294967295,847,271,65535,4294967295,848,80,65535,4294967295,849,81,65535,4294967295,850,150,65535,4294967295,851,150,507,4294967295,182,46,65535,174,852,151,65535,4294967295,853,151,65535,4294967295,854,272,333,4294967295,855,273,65535,4294967295,856,54,65535,175,857,152,65535,4294967295,858,274,65535,4294967295,859,275,65535,4294967295,860,276,65535,4294967295,861,277,333,4294967295,862,278,65535,176,863,82,65535,4294967295,864,272,65535,4294967295,865,277,65535,4294967295,74,14,65535,4294967295,866,46,65535,4294967295,867,83,65535,4294967295,868,153,65535,4294967295,869,9,65535,177,870,199,65535,4294967295,871,84,65535,4294967295,872,154,65535,4294967295,873,279,507,4294967295,874,280,65535,4294967295,875,85,65535,178,876,281,65535,4294967295,493,155,65535,4294967295,877,155,65535,4294967295,878,155,142,4294967295,879,282,65535,4294967295,880,283,65535,4294967295,491,85,65535,4294967295,881,85,65535,4294967295,882,284,65535,4294967295,883,277,65535,4294967295,884,156,65535,4294967295,885,156,142,4294967295,886,285,65535,4294967295,887,29,65535,4294967295,888,1,65535,4294967295,2,1,65535,179,10,3,65535,180,889,157,65535,4294967295,890,286,65535,4294967295,891,86,65535,4294967295,892,86,65535,4294967295,893,86,364,4294967295,894,86,65535,4294967295,895,287,65535,4294967295,896,30,65535,4294967295,897,30,65535,4294967295,898,157,65535,4294967295,899,287,65535,4294967295,900,288,65535,4294967295,901,289,65535,4294967295,902,157,65535,4294967295,903,157,249,4294967295,904,290,65535,4294967295,137,16,65535,181,905,291,65535,4294967295,906,158,65535,4294967295,907,158,610,4294967295,908,47,65535,4294967295,909,47,65535,4294967295,910,47,65535,4294967295,911,87,65535,4294967295,912,159,65535,4294967295,913,159,65535,4294967295,914,159,610,4294967295,915,292,65535,4294967295,916,293,65535,4294967295,917,87,65535,4294967295,918,87,364,4294967295,919,87,65535,4294967295,920,160,65535,4294967295,921,160,629,4294967295,922,294,65535,4294967295,923,63,65535,4294967295,924,161,65535,4294967295,925,161,610,4294967295,926,295,65535,4294967295,927,292,65535,4294967295,928,296,65535,4294967295,929,297,65535,4294967295,522,162,65535,4294967295,930,162,65535,4294967295,931,162,364,4294967295,932,298,65535,4294967295,933,88,364,4294967295,934,88,65535,4294967295,935,299,65535,4294967295,936,163,65535,4294967295,937,163,629,4294967295,938,31,65535,4294967295,939,31,65535,4294967295,940,164,629,4294967295,941,300,65535,4294967295,942,48,65535,4294967295,943,48,65535,4294967295,944,165,1987,4294967295,945,301,65535,4294967295,946,89,65535,4294967295,947,89,364,4294967295,948,89,65535,4294967295,949,302,65535,4294967295,950,166,65535,4294967295,951,303,629,4294967295,952,9,65535,182,536,49,65535,4294967295,953,90,65535,4294967295,954,304,65535,4294967295,955,305,65535,4294967295,956,90,65535,4294967295,957,90,364,4294967295,958,90,65535,4294967295,959,90,65535,4294967295,960,49,65535,4294967295,961,49,65535,4294967295,962,288,65535,4294967295,963,16,65535,4294967295,137,16,65535,4294967295,964,90,65535,4294967295,965,167,65535,4294967295,552,170,65535,4294967295,966,91,65535,4294967295,967,167,65535,4294967295,968,167,124,4294967295,969,168,65535,4294967295,970,168,126,4294967295,971,306,65535,4294967295,972,307,65535,4294967295,973,169,65535,4294967295,974,169,142,4294967295,975,170,65535,4294967295,976,171,65535,4294967295,977,171,65535,4294967295,978,308,65535,4294967295,979,171,65535,4294967295,980,171,124,4294967295,981,309,65535,4294967295,982,310,65535,4294967295,983,172,65535,4294967295,984,172,126,4294967295,985,311,65535,4294967295,986,306,65535,4294967295,987,312,65535,4294967295,988,313,65535,4294967295,556,173,65535,4294967295,989,173,65535,4294967295,556,173,65535,4294967295,990,314,65535,4294967295,98,17,65535,4294967295,100,18,65535,4294967295,513,50,65535,4294967295,991,93,65535,4294967295,992,93,65535,4294967295,993,93,364,4294967295,994,93,65535,4294967295,995,87,65535,4294967295,996,315,65535,4294967295,997,316,65535,4294967295,565,174,65535,4294967295,998,174,65535,4294967295,999,174,249,4294967295,1000,317,65535,4294967295,1001,87,65535,4294967295,1002,50,65535,4294967295,1003,50,65535,4294967295,1004,51,65535,4294967295,1005,318,65535,4294967295,1006,185,65535,4294967295,1007,94,65535,4294967295,1008,175,65535,4294967295,1009,319,992,4294967295,1010,320,65535,4294967295,1011,321,65535,4294967295,1012,176,65535,4294967295,1013,176,65535,4294967295,1014,322,65535,4294967295,1015,207,65535,4294967295,1016,177,65535,4294967295,1017,177,65535,4294967295,1018,177,124,4294967295,1019,323,65535,4294967295,1020,51,65535,4294967295,1021,324,65535,4294967295,1022,178,65535,4294967295,1023,178,65535,4294967295,1024,325,65535,4294967295,582,179,65535,4294967295,1025,179,65535,4294967295,1026,251,484,4294967295,146,19,65535,4294967295,1027,326,65535,4294967295,1028,327,65535,4294967295,1029,180,65535,4294967295,1030,180,65535,4294967295,1031,180,65535,4294967295,1032,98,65535,4294967295,1033,186,65535,4294967295,1034,98,65535,4294967295,1035,328,65535,4294967295,1036,329,65535,4294967295,1037,181,65535,4294967295,1038,181,65535,4294967295,1039,181,126,4294967295,1040,52,65535,4294967295,1041,330,65535,4294967295,1042,182,65535,4294967295,1043,182,65535,4294967295,595,183,65535,4294967295,1044,183,65535,4294967295,1045,254,507,4294967295,103,20,65535,4294967295,1046,184,65535,4294967295,1047,331,65535,4294967295,1048,247,65535,4294967295,1049,184,65535,4294967295,1050,184,249,4294967295,1051,138,65535,4294967295,598,185,65535,4294967295,1052,185,65535,4294967295,1053,185,124,4294967295,1054,319,65535,4294967295,1055,53,65535,4294967295,1056,176,65535,4294967295,600,186,65535,4294967295,1057,186,65535,4294967295,1058,186,126,4294967295,1059,54,65535,4294967295,634,187,65535,4294967295,1060,332,65535,4294967295,1061,190,65535,4294967295,634,187,65535,4294967295,1062,187,65535,4294967295,1063,187,124,4294967295,1064,333,65535,4294967295,1065,334,65535,4294967295,1066,188,65535,4294967295,604,188,65535,4294967295,1067,335,490,4294967295,1068,336,65535,4294967295,1069,100,65535,183,1070,337,65535,4294967295,1071,100,65535,4294967295,602,100,65535,4294967295,1072,100,65535,4294967295,1073,338,65535,4294967295,1074,189,65535,4294967295,607,189,65535,4294967295,1075,339,992,4294967295,1076,100,65535,184,1077,190,65535,4294967295,1078,340,65535,4294967295,1079,190,65535,4294967295,1061,190,65535,4294967295,1080,341,464,4294967295,1081,342,65535,4294967295,1082,101,65535,185,1083,188,65535,4294967295,609,191,65535,4294967295,1084,191,65535,4294967295,1085,191,126,4294967295,1086,343,65535,4294967295,351,101,65535,4294967295,1087,101,65535,4294967295,1088,344,65535,4294967295,1089,192,65535,4294967295,612,192,65535,4294967295,1090,345,333,4294967295,1091,101,65535,186,1092,193,65535,4294967295,1093,346,65535,4294967295,1094,347,65535,4294967295,1095,193,65535,4294967295,1092,193,65535,4294967295,1096,193,124,4294967295,1097,348,65535,4294967295,1092,193,65535,187,1098,349,65535,4294967295,1099,350,65535,4294967295,1100,194,65535,4294967295,614,194,65535,4294967295,1101,194,126,4294967295,1102,351,65535,4294967295,614,194,65535,188,349,55,65535,4294967295,1103,346,65535,4294967295,352,102,65535,4294967295,352,102,65535,4294967295,1104,352,65535,4294967295,352,102,65535,189,1105,353,65535,4294967295,1106,195,65535,4294967295,1107,195,142,4294967295,1108,354,65535,4294967295,618,195,65535,190,1109,100,65535,4294967295,620,196,65535,4294967295,1110,196,142,4294967295,1111,197,65535,4294967295,621,197,65535,4294967295,1112,355,507,4294967295,1113,356,65535,4294967295,1114,103,65535,191,1115,357,65535,4294967295,1116,333,65535,4294967295,354,103,65535,4294967295,1117,103,65535,4294967295,1118,345,65535,4294967295,624,198,65535,4294967295,1119,198,65535,4294967295,1120,198,142,4294967295,1115,357,65535,4294967295,625,199,65535,4294967295,1121,199,65535,4294967295,1122,199,142,4294967295,1123,56,65535,4294967295,1124,200,65535,4294967295,1125,358,65535,4294967295,156,35,65535,4294967295,1126,104,65535,4294967295,1127,201,65535,4294967295,1128,201,65535,4294967295,1129,359,65535,4294967295,1130,201,65535,4294967295,1127,201,65535,4294967295,1131,201,249,4294967295,1132,360,65535,4294967295,1078,340,65535,4294967295,1133,361,65535,4294967295,360,105,65535,4294967295,1134,105,65535,4294967295,1135,202,65535,4294967295,633,202,65535,4294967295,1136,202,829,4294967295,1137,57,65535,4294967295,1138,203,65535,4294967295,636,203,65535,4294967295,1139,203,853,4294967295,1140,362,65535,4294967295,1141,363,65535,4294967295,363,106,65535,4294967295,1142,106,65535,4294967295,1143,364,65535,4294967295,1144,334,65535,4294967295,1145,365,65535,4294967295,639,107,65535,4294967295,1146,107,65535,4294967295,1147,204,65535,4294967295,643,204,65535,4294967295,1148,204,887,4294967295,1149,58,65535,4294967295,1150,366,65535,4294967295,1151,367,65535,4294967295,367,108,65535,4294967295,1152,108,65535,4294967295,1088,344,65535,4294967295,1153,368,65535,4294967295,368,109,65535,4294967295,1154,109,65535,4294967295,1155,205,65535,4294967295,1156,369,65535,4294967295,1157,205,65535,4294967295,1155,205,65535,4294967295,1158,205,992,4294967295,1159,59,65535,4294967295,1160,370,65535,4294967295,1161,200,65535,4294967295,1162,60,65535,4294967295,107,21,65535,4294967295,655,206,65535,4294967295,1163,206,65535,4294967295,1164,206,333,4294967295,1165,371,65535,4294967295,1166,61,65535,4294967295,1167,329,65535,4294967295,1168,207,65535,4294967295,1169,207,464,4294967295,1170,208,65535,4294967295,1171,208,65535,4294967295,1172,208,333,4294967295,1173,372,65535,4294967295,1174,206,65535,4294967295,1102,351,65535,4294967295,1175,209,65535,4294967295,1176,209,65535,4294967295,1177,209,65535,4294967295,231,61,65535,192,1104,352,65535,4294967295,1178,35,65535,4294967295,1179,373,65535,4294967295,1180,112,65535,4294967295,1181,210,65535,4294967295,1182,210,65535,4294967295,1183,210,507,4294967295,1184,374,65535,4294967295,1185,375,65535,4294967295,1186,62,65535,4294967295,1187,211,65535,4294967295,1188,211,65535,4294967295,1189,211,65535,4294967295,1190,211,2528,4294967295,1191,376,65535,4294967295,1192,377,65535,4294967295,1193,378,65535,4294967295,1194,379,65535,4294967295,1195,211,65535,4294967295,1196,113,364,4294967295,1197,113,65535,4294967295,1198,212,65535,4294967295,1199,212,2551,4294967295,1200,380,65535,4294967295,675,213,65535,4294967295,1201,213,65535,4294967295,1202,213,249,4294967295,1203,381,65535,4294967295,890,286,65535,4294967295,1204,271,65535,4294967295,1205,214,65535,4294967295,1206,214,249,4294967295,1207,382,65535,4294967295,923,63,65535,4294967295,1208,63,65535,4294967295,1209,63,65535,4294967295,1210,215,65535,4294967295,1211,215,2575,4294967295,1212,383,65535,4294967295,1213,384,65535,4294967295,1214,385,65535,4294967295,1215,386,65535,4294967295,1216,114,364,4294967295,1217,114,65535,4294967295,390,115,65535,4294967295,1218,387,65535,4294967295,390,115,65535,4294967295,1219,115,65535,4294967295,685,216,65535,4294967295,1220,216,65535,4294967295,1221,217,65535,4294967295,1222,217,126,4294967295,100,18,65535,193,1223,238,65535,4294967295,1224,218,65535,4294967295,1225,218,124,4294967295,1226,116,65535,4294967295,1227,219,65535,4294967295,1228,117,65535,4294967295,1229,239,65535,4294967295,1230,219,65535,4294967295,1231,219,490,4294967295,1232,388,65535,4294967295,706,131,65535,194,1233,240,65535,4294967295,1234,220,65535,4294967295,1235,240,464,4294967295,1236,8,65535,195,1237,117,65535,4294967295,1238,221,829,4294967295,1239,36,65535,4294967295,695,222,65535,4294967295,1240,222,65535,4294967295,1241,222,829,4294967295,1242,389,65535,4294967295,1243,223,829,4294967295,1244,390,65535,4294967295,1245,391,65535,4294967295,1246,224,65535,4294967295,1247,224,829,4294967295,1248,392,65535,4294967295,1249,64,65535,4294967295,390,115,65535,4294967295,700,225,65535,4294967295,1250,225,65535,4294967295,1251,65,65535,4294967295,702,226,65535,4294967295,1252,226,65535,4294967295,408,122,65535,4294967295,1253,66,65535,4294967295,1254,157,65535,4294967295,1255,284,65535,4294967295,1256,120,65535,4294967295,1257,227,992,4294967295,1258,393,65535,4294967295,1259,66,65535,4294967295,1260,121,65535,4294967295,158,23,65535,4294967295,713,228,65535,4294967295,1261,228,65535,4294967295,1262,228,853,4294967295,1263,229,853,4294967295,1264,394,65535,4294967295,1265,395,65535,4294967295,1266,230,65535,4294967295,1267,230,853,4294967295,1268,396,65535,4294967295,1269,67,65535,4294967295,717,231,65535,4294967295,1270,231,65535,4294967295,408,122,65535,4294967295,1271,397,65535,4294967295,408,122,65535,4294967295,1272,122,65535,4294967295,1273,123,65535,4294967295,1274,232,65535,4294967295,1275,232,484,4294967295,1276,233,853,4294967295,1277,124,65535,4294967295,1278,234,65535,4294967295,1279,398,484,4294967295,1280,9,65535,196,1281,37,65535,4294967295,1282,125,65535,4294967295,728,125,65535,4294967295,1283,399,65535,4294967295,1284,400,65535,4294967295,1285,401,65535,4294967295,1286,125,65535,4294967295,1287,125,364,4294967295,1288,125,65535,4294967295,1289,235,65535,4294967295,1290,235,2707,4294967295,413,126,65535,4294967295,1291,402,65535,4294967295,413,126,65535,4294967295,1292,126,65535,4294967295,734,236,65535,4294967295,1293,236,65535,4294967295,1294,127,65535,4294967295,1295,237,65535,4294967295,1296,237,126,4294967295,1297,218,65535,4294967295,1298,238,65535,4294967295,1299,238,124,4294967295,98,17,65535,197,1300,127,65535,4294967295,1301,128,65535,4294967295,1302,239,65535,4294967295,1303,403,65535,4294967295,1304,7,65535,198,1305,220,65535,4294967295,1306,240,65535,4294967295,1307,404,65535,4294967295,401,80,65535,199,1308,128,65535,4294967295,1309,398,65535,4294967295,1310,241,887,4294967295,1311,38,65535,4294967295,744,242,65535,4294967295,1312,242,65535,4294967295,1313,242,887,4294967295,1314,405,65535,4294967295,1315,243,887,4294967295,1316,406,65535,4294967295,1317,407,65535,4294967295,1318,244,65535,4294967295,1319,244,887,4294967295,1320,408,65535,4294967295,1321,68,65535,4294967295,1322,409,65535,4294967295,413,126,65535,4294967295,751,245,65535,4294967295,1323,245,65535,4294967295,1324,69,65535,4294967295,428,133,65535,4294967295,1325,289,65535,4294967295,1326,131,65535,4294967295,1327,278,65535,4294967295,1328,132,65535,4294967295,1329,70,65535,4294967295,111,24,65535,4294967295,428,133,65535,4294967295,1330,410,65535,4294967295,428,133,65535,4294967295,1331,133,65535,4294967295,1332,134,65535,4294967295,1333,246,65535,4294967295,1334,246,507,4294967295,1335,411,65535,4294967295,1336,412,65535,4294967295,1337,413,65535,4294967295,1338,414,65535,4294967295,764,135,65535,4294967295,1339,135,65535,4294967295,1340,39,65535,4294967295,1341,136,65535,4294967295,1342,184,65535,4294967295,1343,415,65535,4294967295,769,247,65535,4294967295,1344,247,65535,4294967295,1345,247,364,4294967295,1346,416,65535,4294967295,770,136,65535,4294967295,1347,417,65535,4294967295,771,248,65535,4294967295,1348,248,65535,4294967295,1349,248,1429,4294967295,1350,418,65535,4294967295,675,213,65535,4294967295,1351,419,65535,4294967295,1352,136,65535,4294967295,1353,136,364,4294967295,1354,136,65535,4294967295,1355,420,65535,4294967295,774,249,65535,4294967295,1356,249,65535,4294967295,1357,249,1452,4294967295,1358,421,65535,4294967295,1359,422,65535,4294967295,775,250,65535,4294967295,1360,250,65535,4294967295,1361,250,464,4294967295,1362,423,65535,4294967295,1363,71,65535,4294967295,695,222,65535,4294967295,1364,424,65535,4294967295,435,137,65535,4294967295,1365,137,65535,4294967295,1366,138,65535,4294967295,578,177,65535,4294967295,1367,138,65535,4294967295,1368,40,65535,4294967295,713,228,65535,4294967295,1369,425,65535,4294967295,438,139,65535,4294967295,1370,139,65535,4294967295,1371,426,65535,4294967295,787,251,65535,4294967295,1372,251,65535,4294967295,1373,427,65535,4294967295,1374,72,65535,4294967295,1375,252,65535,4294967295,1376,252,65535,4294967295,1375,252,65535,4294967295,1377,252,65535,4294967295,1378,252,1539,4294967295,1379,428,65535,4294967295,1380,429,65535,4294967295,1381,430,65535,4294967295,790,253,65535,4294967295,1382,253,65535,4294967295,1383,253,490,4294967295,1384,431,65535,4294967295,1385,73,65535,4294967295,744,242,65535,4294967295,1386,432,65535,4294967295,445,140,65535,4294967295,1387,140,65535,4294967295,1388,141,65535,4294967295,591,181,65535,4294967295,1389,141,65535,4294967295,1390,41,65535,4294967295,1391,433,65535,4294967295,799,254,65535,4294967295,1392,254,65535,4294967295,1393,434,65535,4294967295,1394,255,65535,4294967295,1394,255,65535,4294967295,1395,255,65535,4294967295,1396,255,1604,4294967295,1397,74,65535,4294967295,802,256,65535,4294967295,1398,256,65535,4294967295,1399,256,333,4294967295,1400,435,65535,4294967295,1401,257,65535,4294967295,1401,257,65535,4294967295,1402,257,65535,4294967295,1403,257,1707,4294967295,1404,75,65535,4294967295,806,258,65535,4294967295,1405,258,65535,4294967295,1406,258,1719,4294967295,821,260,65535,4294967295,1407,436,65535,4294967295,805,142,65535,4294967295,1408,142,65535,4294967295,1409,42,65535,4294967295,454,143,65535,4294967295,1410,437,65535,4294967295,454,143,65535,4294967295,1411,143,65535,4294967295,1412,438,65535,4294967295,1413,439,65535,4294967295,1414,440,65535,4294967295,812,144,65535,4294967295,1415,144,65535,4294967295,1416,43,65535,4294967295,454,143,65535,4294967295,1417,259,65535,4294967295,1418,441,65535,4294967295,1417,259,65535,4294967295,1419,259,65535,4294967295,1420,76,65535,4294967295,1421,442,65535,4294967295,1422,443,65535,4294967295,1423,444,65535,4294967295,461,146,65535,4294967295,1424,146,65535,4294967295,1425,445,65535,4294967295,821,260,65535,4294967295,1426,260,65535,4294967295,1427,260,992,4294967295,1428,261,992,4294967295,1429,446,65535,4294967295,1430,262,65535,4294967295,1431,262,992,4294967295,1432,77,65535,4294967295,113,26,65535,4294967295,114,27,65535,4294967295,1433,78,65535,4294967295,1434,217,65535,4294967295,1435,263,65535,4294967295,1436,263,333,4294967295,1437,447,65535,4294967295,1438,448,65535,4294967295,1439,449,65535,4294967295,1440,264,65535,4294967295,1441,264,65535,4294967295,276,78,65535,200,1442,265,65535,4294967295,1443,265,333,4294967295,1444,450,65535,4294967295,1445,451,65535,4294967295,1446,452,65535,4294967295,1447,148,65535,4294967295,1448,453,65535,4294967295,1449,266,65535,4294967295,1450,266,65535,4294967295,1451,266,142,4294967295,551,169,65535,201,1452,267,65535,4294967295,1453,267,333,4294967295,1454,454,65535,4294967295,840,268,65535,4294967295,1455,268,65535,4294967295,1456,268,142,4294967295,1457,455,65535,4294967295,557,149,65535,4294967295,1458,149,65535,4294967295,1459,44,65535,4294967295,1460,456,65535,4294967295,1461,269,65535,4294967295,1462,269,65535,4294967295,1463,269,142,4294967295,1464,457,65535,4294967295,1465,458,65535,202,1466,270,65535,4294967295,1467,459,65535,4294967295,1468,460,65535,4294967295,1469,270,142,4294967295,1470,461,65535,4294967295,1466,270,65535,203,1471,79,65535,4294967295,116,28,65535,4294967295,1472,291,65535,4294967295,1473,271,1429,4294967295,1474,80,65535,4294967295,1475,81,65535,4294967295,1476,462,65535,4294967295,1477,279,65535,4294967295,1478,150,65535,4294967295,1479,370,65535,4294967295,1480,272,65535,4294967295,1481,272,65535,4294967295,1482,273,65535,4294967295,1483,273,65535,4294967295,371,110,65535,204,1484,274,65535,4294967295,1485,274,65535,4294967295,1486,463,65535,4294967295,1487,274,65535,4294967295,1488,464,464,4294967295,1489,465,65535,4294967295,1490,278,65535,205,1491,466,65535,4294967295,1492,275,65535,4294967295,1493,275,333,4294967295,1494,467,65535,4294967295,1495,468,65535,4294967295,860,276,65535,4294967295,1496,276,65535,4294967295,1497,469,333,4294967295,1498,470,65535,4294967295,1499,471,65535,4294967295,883,277,65535,4294967295,1500,277,65535,4294967295,883,277,65535,206,1501,278,65535,4294967295,1502,472,65535,4294967295,1501,278,65535,207,1503,82,65535,4294967295,1504,272,65535,4294967295,627,200,65535,208,1505,469,65535,4294967295,1506,473,65535,4294967295,1507,46,65535,4294967295,1508,83,65535,4294967295,1509,474,65535,4294967295,1510,357,65535,4294967295,1511,84,65535,4294967295,1512,475,65535,4294967295,1513,279,65535,4294967295,1514,476,65535,4294967295,1513,279,65535,4294967295,1515,279,65535,4294967295,1513,279,65535,209,1516,280,65535,4294967295,1517,477,507,4294967295,1518,478,65535,4294967295,876,281,65535,4294967295,1519,281,65535,4294967295,1520,479,507,4294967295,1521,480,65535,4294967295,493,155,65535,4294967295,1522,481,65535,4294967295,493,155,65535,4294967295,1523,155,65535,4294967295,1524,482,65535,4294967295,879,282,65535,4294967295,1525,282,65535,4294967295,1526,282,142,4294967295,1527,483,65535,4294967295,1528,283,65535,4294967295,1529,484,65535,4294967295,1530,283,65535,4294967295,1531,485,484,4294967295,1532,486,65535,4294967295,1533,85,65535,210,1534,85,65535,4294967295,1535,284,65535,4294967295,1536,487,65535,4294967295,1537,466,65535,4294967295,1538,284,124,4294967295,1539,488,65535,4294967295,1535,284,65535,211,1540,486,65535,4294967295,1541,156,65535,4294967295,495,156,65535,4294967295,1542,156,65535,4294967295,495,156,65535,212,1543,285,65535,4294967295,1544,285,142,4294967295,119,29,65535,4294967295,900,288,65535,4294967295,1545,286,65535,4294967295,1546,214,65535,4294967295,1547,489,65535,4294967295,1548,286,65535,4294967295,1549,157,249,4294967295,1550,490,65535,4294967295,1551,7,65535,213,1552,90,65535,4294967295,1553,86,65535,4294967295,1554,86,65535,4294967295,1555,86,65535,4294967295,1556,288,65535,4294967295,1557,491,65535,4294967295,1558,287,65535,4294967295,1559,287,364,4294967295,1560,492,65535,4294967295,138,30,65535,214,1561,30,65535,4294967295,138,30,65535,4294967295,1562,288,65535,4294967295,1563,493,65535,4294967295,1564,288,65535,4294967295,507,157,65535,4294967295,1565,494,65535,4294967295,1566,288,65535,4294967295,1567,288,3260,4294967295,1568,495,65535,4294967295,1569,496,65535,4294967295,1570,289,1539,4294967295,1571,318,65535,4294967295,1572,497,65535,4294967295,1573,157,65535,4294967295,1574,157,364,4294967295,1575,157,65535,4294967295,1576,290,3287,4294967295,1577,498,65535,4294967295,1578,291,65535,4294967295,1579,499,65535,4294967295,1580,500,65535,4294967295,1581,291,65535,4294967295,1582,501,610,4294967295,1583,8,65535,215,1584,158,65535,4294967295,1585,158,65535,4294967295,1586,158,364,4294967295,1587,158,65535,4294967295,1588,501,65535,4294967295,1589,47,65535,4294967295,1590,47,65535,4294967295,1591,502,65535,4294967295,1592,159,65535,4294967295,1593,503,65535,4294967295,1594,159,65535,4294967295,1595,159,364,4294967295,1596,159,65535,4294967295,1597,504,65535,4294967295,1598,505,65535,4294967295,927,292,65535,4294967295,1599,506,65535,4294967295,1600,292,364,4294967295,1601,507,65535,4294967295,916,293,65535,4294967295,1602,201,65535,4294967295,1603,508,65535,4294967295,1604,293,65535,4294967295,1605,293,364,4294967295,1606,509,65535,4294967295,513,50,65535,4294967295,1607,87,65535,4294967295,1608,87,65535,4294967295,1609,510,65535,4294967295,1610,160,65535,4294967295,1611,160,364,4294967295,1612,160,65535,4294967295,1613,511,65535,4294967295,1614,294,65535,4294967295,1615,294,65535,4294967295,1616,294,629,4294967295,1617,512,65535,4294967295,385,63,65535,4294967295,1618,513,65535,4294967295,1619,161,364,4294967295,1620,161,65535,4294967295,1621,295,65535,4294967295,1622,295,3398,4294967295,1623,292,65535,4294967295,1624,296,65535,4294967295,1625,296,65535,4294967295,1626,514,65535,4294967295,1624,296,65535,4294967295,1627,296,65535,4294967295,1628,136,249,4294967295,1629,515,65535,4294967295,1630,516,65535,4294967295,929,297,65535,4294967295,1631,297,65535,4294967295,1632,517,610,4294967295,1633,518,65535,4294967295,522,162,65535,4294967295,1634,296,65535,4294967295,1635,162,364,4294967295,1636,162,65535,4294967295,1637,519,65535,4294967295,932,298,65535,4294967295,1638,298,65535,4294967295,1639,520,629,4294967295,1640,88,65535,4294967295,1641,88,65535,4294967295,1642,299,65535,4294967295,1643,299,1987,4294967295,1644,521,65535,4294967295,1645,163,364,4294967295,1646,163,65535,4294967295,1647,31,65535,4294967295,198,31,65535,4294967295,1648,164,65535,4294967295,1649,164,364,4294967295,1650,164,65535,4294967295,1651,522,65535,4294967295,1652,300,65535,4294967295,1653,300,629,4294967295,1654,523,65535,4294967295,1655,48,65535,4294967295,1656,48,65535,4294967295,1657,165,65535,4294967295,1658,165,364,4294967295,1659,165,65535,4294967295,1660,271,65535,4294967295,1661,524,65535,4294967295,1662,301,65535,4294967295,1663,525,1987,4294967295,1664,526,65535,4294967295,1665,8,65535,216,1666,89,65535,4294967295,1667,89,65535,4294967295,1668,302,3398,4294967295,1669,527,65535,4294967295,1670,528,65535,4294967295,1671,529,65535,4294967295,1672,303,65535,4294967295,1673,303,65535,4294967295,1674,303,364,4294967295,1675,303,65535,4294967295,1676,48,629,4294967295,1677,530,65535,4294967295,1678,531,65535,4294967295,1679,532,65535,4294967295,1680,304,65535,4294967295,1681,304,65535,4294967295,1682,304,364,4294967295,1683,533,65535,4294967295,1684,305,65535,4294967295,1685,534,65535,4294967295,1686,535,65535,4294967295,1687,536,65535,4294967295,1688,305,364,4294967295,1689,537,65535,4294967295,536,49,65535,4294967295,1690,90,65535,4294967295,1691,90,65535,4294967295,1692,530,65535,4294967295,1693,49,65535,4294967295,1694,49,65535,4294967295,889,157,65535,4294967295,137,16,65535,4294967295,1695,49,65535,4294967295,1696,531,65535,4294967295,1697,538,65535,4294967295,1698,167,65535,4294967295,1699,539,65535,4294967295,1700,168,65535,4294967295,1701,540,65535,4294967295,1702,541,65535,4294967295,986,306,65535,4294967295,1703,542,65535,4294967295,1704,306,65535,4294967295,1465,458,65535,4294967295,972,307,65535,4294967295,1705,543,65535,4294967295,1706,544,65535,4294967295,1707,307,65535,4294967295,972,307,65535,4294967295,1446,452,65535,4294967295,972,307,65535,217,1708,451,65535,4294967295,1709,169,65535,4294967295,1710,534,65535,4294967295,1711,308,65535,4294967295,1712,308,464,4294967295,1713,545,65535,4294967295,1714,546,65535,4294967295,976,171,65535,4294967295,1715,171,65535,4294967295,1716,547,65535,4294967295,1717,309,65535,4294967295,1718,309,484,4294967295,1719,310,65535,4294967295,1720,310,65535,4294967295,1721,310,65535,4294967295,1722,310,490,4294967295,1723,548,65535,4294967295,1724,549,65535,4294967295,555,172,65535,4294967295,1725,172,65535,4294967295,1726,311,65535,4294967295,1727,311,507,4294967295,1728,306,65535,4294967295,1729,312,65535,4294967295,1730,312,65535,4294967295,1731,550,65535,4294967295,1729,312,65535,4294967295,1732,312,65535,4294967295,1733,312,124,4294967295,1734,551,65535,4294967295,1735,552,65535,4294967295,988,313,65535,4294967295,1736,313,65535,4294967295,1737,313,126,4294967295,1738,553,65535,4294967295,556,173,65535,4294967295,1739,554,65535,4294967295,990,314,65535,4294967295,1740,314,65535,4294967295,1741,314,142,4294967295,1742,87,65535,4294967295,1743,93,65535,4294967295,1744,93,65535,4294967295,1745,93,65535,4294967295,1746,502,65535,4294967295,1747,315,65535,4294967295,1748,174,65535,4294967295,1749,555,65535,4294967295,1750,315,65535,4294967295,1751,315,65535,4294967295,1752,318,249,4294967295,1753,556,65535,4294967295,1754,53,65535,218,1755,557,65535,4294967295,1756,316,65535,4294967295,1757,558,1429,4294967295,1758,559,65535,4294967295,1759,174,65535,4294967295,1760,174,364,4294967295,1761,174,65535,4294967295,1762,317,65535,4294967295,1763,560,1452,4294967295,1764,561,65535,4294967295,1765,502,65535,4294967295,1766,50,65535,4294967295,1767,50,65535,4294967295,1768,94,65535,4294967295,1769,562,65535,4294967295,1770,563,65535,4294967295,1771,326,65535,4294967295,1772,318,65535,4294967295,1773,318,65535,4294967295,1774,318,249,4294967295,1775,564,65535,4294967295,1046,184,65535,219,1776,337,65535,4294967295,1777,94,65535,4294967295,1778,565,65535,4294967295,1779,319,65535,4294967295,1780,319,65535,4294967295,1781,566,65535,4294967295,1782,320,65535,4294967295,1783,320,65535,4294967295,1784,567,992,4294967295,1785,568,65535,4294967295,1786,53,65535,220,1787,569,65535,4294967295,1788,570,65535,4294967295,1011,321,65535,4294967295,1789,321,65535,4294967295,1790,430,464,4294967295,1791,176,65535,4294967295,1792,322,65535,4294967295,1793,177,65535,4294967295,1794,328,65535,4294967295,1795,322,65535,4294967295,1796,322,65535,4294967295,1797,322,124,4294967295,1798,571,65535,4294967295,146,19,65535,221,1799,51,65535,4294967295,1800,177,65535,4294967295,1801,323,65535,4294967295,1802,323,484,4294967295,1803,51,65535,4294967295,1804,572,65535,4294967295,1021,324,65535,4294967295,1805,324,65535,4294967295,1806,573,484,4294967295,1807,573,65535,4294967295,1808,178,65535,4294967295,1809,325,65535,4294967295,1810,426,853,4294967295,1811,574,65535,4294967295,1141,363,65535,4294967295,1812,251,65535,4294967295,1813,575,65535,4294967295,1814,326,65535,4294967295,1815,576,1539,4294967295,1816,577,65535,4294967295,1817,578,65535,4294967295,1028,327,65535,4294967295,1818,327,65535,4294967295,1819,421,490,4294967295,1820,579,65535,4294967295,1821,421,65535,4294967295,1822,180,65535,4294967295,1823,316,65535,4294967295,1824,343,65535,4294967295,1825,98,65535,4294967295,1826,181,65535,4294967295,1827,328,65535,4294967295,1828,328,490,4294967295,1829,329,65535,4294967295,1830,329,65535,4294967295,1831,329,126,4294967295,103,20,65535,222,1832,52,65535,4294967295,1833,181,65535,4294967295,1834,52,65535,4294967295,1041,330,65535,4294967295,1835,330,65535,4294967295,1836,435,507,4294967295,1837,182,65535,4294967295,668,210,65535,4294967295,1838,254,65535,4294967295,1839,247,65535,4294967295,1840,331,65535,4294967295,1841,331,65535,4294967295,1842,331,364,4294967295,1843,184,65535,4294967295,1844,580,65535,4294967295,1845,184,65535,4294967295,1846,184,364,4294967295,1847,184,65535,4294967295,1848,185,65535,4294967295,569,94,65535,4294967295,1849,482,65535,4294967295,1850,185,65535,4294967295,1851,581,65535,4294967295,1852,53,65535,4294967295,1853,186,65535,4294967295,338,98,65535,4294967295,1854,582,65535,4294967295,1855,186,65535,4294967295,1856,54,65535,4294967295,1857,332,65535,4294967295,1858,583,65535,4294967295,1859,584,65535,4294967295,1860,332,65535,4294967295,1857,332,65535,4294967295,1861,332,249,4294967295,1862,585,65535,4294967295,1857,332,65535,223,1863,346,65535,4294967295,634,187,65535,4294967295,1140,362,65535,4294967295,1864,187,65535,4294967295,1865,586,65535,4294967295,1866,333,65535,4294967295,1064,333,65535,4294967295,1867,587,484,4294967295,1868,588,65535,4294967295,1869,103,65535,224,1144,334,65535,4294967295,1870,188,65535,4294967295,1144,334,65535,4294967295,1871,334,65535,4294967295,1872,334,490,4294967295,1873,589,65535,4294967295,1874,590,65535,4294967295,1875,335,65535,4294967295,1876,335,65535,4294967295,1877,335,65535,4294967295,1875,335,65535,4294967295,1875,335,65535,4294967295,1878,591,65535,4294967295,1879,335,65535,4294967295,1875,335,65535,225,1880,336,65535,4294967295,1068,336,65535,4294967295,1881,592,1604,4294967295,1882,100,65535,226,1070,337,65535,4294967295,1883,593,65535,4294967295,1070,337,65535,4294967295,1884,337,124,4294967295,1885,339,65535,4294967295,1886,187,65535,4294967295,1887,100,65535,4294967295,1888,338,65535,4294967295,1073,338,65535,4294967295,1889,594,1707,4294967295,1890,100,65535,227,1891,595,65535,4294967295,1892,567,65535,4294967295,1893,339,65535,4294967295,1894,596,65535,4294967295,1895,339,65535,4294967295,1885,339,65535,4294967295,1885,339,65535,4294967295,1896,339,65535,4294967295,1885,339,65535,228,1897,597,65535,4294967295,1078,340,65535,4294967295,1898,340,65535,4294967295,1899,340,464,4294967295,1900,598,65535,4294967295,1901,341,65535,4294967295,1902,569,65535,4294967295,1903,341,65535,4294967295,1904,341,65535,4294967295,1901,341,65535,4294967295,1901,341,65535,4294967295,1905,599,65535,4294967295,1906,341,65535,4294967295,1901,341,65535,229,1907,600,65535,4294967295,1908,342,65535,4294967295,1081,342,65535,4294967295,1909,601,853,4294967295,1910,101,65535,230,1911,334,65535,4294967295,1099,350,65535,4294967295,609,191,65535,4294967295,1150,366,65535,4294967295,1912,191,65535,4294967295,1086,343,65535,4294967295,1913,341,65535,4294967295,1914,602,65535,4294967295,1086,343,65535,4294967295,1915,343,126,4294967295,1916,101,65535,4294967295,1088,344,65535,4294967295,1917,344,65535,4294967295,1918,344,333,4294967295,1919,603,65535,4294967295,1920,604,65535,4294967295,1921,345,65535,4294967295,1118,345,65535,4294967295,1118,345,65535,4294967295,1922,345,65535,4294967295,1118,345,65535,231,1863,346,65535,4294967295,1923,605,65535,4294967295,1924,349,65535,4294967295,1925,346,65535,4294967295,1926,346,65535,4294967295,1927,346,124,4294967295,1928,606,65535,4294967295,1929,607,65535,4294967295,1930,347,65535,4294967295,1094,347,65535,4294967295,1931,608,490,4294967295,1932,609,65535,4294967295,1933,193,65535,232,1934,610,65535,4294967295,1935,193,65535,4294967295,1092,193,65535,4294967295,1936,193,65535,4294967295,1937,611,65535,4294967295,1938,348,65535,4294967295,1097,348,65535,4294967295,1939,612,992,4294967295,1940,193,65535,233,1941,349,65535,4294967295,1942,613,65535,4294967295,1943,349,65535,4294967295,1924,349,65535,4294967295,1944,614,464,4294967295,1945,615,65535,4294967295,1946,194,65535,234,1947,347,65535,4294967295,1948,350,65535,4294967295,1949,350,65535,4294967295,1950,350,126,4294967295,1951,614,65535,4294967295,614,194,65535,4294967295,1952,194,65535,4294967295,1953,616,65535,4294967295,1954,351,65535,4294967295,1955,617,333,4294967295,1956,194,65535,235,1957,193,65535,4294967295,1958,352,65535,4294967295,1959,352,65535,4294967295,1960,352,142,4294967295,1961,353,65535,4294967295,1105,353,65535,4294967295,1962,614,507,4294967295,1963,618,65535,4294967295,1964,195,65535,236,1965,375,65535,4294967295,1966,606,65535,4294967295,618,195,65535,4294967295,1967,195,65535,4294967295,1968,617,65535,4294967295,1969,354,65535,4294967295,1970,354,65535,4294967295,1971,354,142,4294967295,1972,619,65535,4294967295,1973,614,65535,4294967295,1974,614,65535,4294967295,620,196,65535,4294967295,1975,196,65535,4294967295,1976,620,65535,4294967295,1977,355,65535,4294967295,1978,614,65535,4294967295,1979,355,65535,4294967295,1977,355,65535,4294967295,1977,355,65535,4294967295,1980,355,65535,4294967295,1977,355,65535,237,1113,356,65535,4294967295,1981,356,65535,4294967295,1982,614,507,4294967295,1976,620,65535,4294967295,1115,357,65535,4294967295,1983,357,142,4294967295,1984,103,65535,4294967295,1985,621,65535,4294967295,1108,354,65535,4294967295,1986,588,65535,4294967295,624,198,65535,4294967295,624,198,65535,4294967295,1987,198,65535,4294967295,624,198,65535,238,291,84,65535,4294967295,1988,199,65535,4294967295,1989,56,65535,4294967295,1125,358,65535,4294967295,1990,358,65535,4294967295,1991,433,333,4294967295,1992,104,65535,4294967295,1128,201,65535,4294967295,1993,614,65535,4294967295,1994,359,65535,4294967295,1129,359,65535,4294967295,1995,359,1429,4294967295,1996,622,65535,4294967295,1997,614,65535,4294967295,1758,559,65535,4294967295,1998,201,65535,4294967295,1999,201,364,4294967295,2000,201,65535,4294967295,2001,623,65535,4294967295,2002,360,65535,4294967295,1132,360,65535,4294967295,2003,360,1452,4294967295,2004,624,65535,4294967295,2005,625,65535,4294967295,2006,361,65535,4294967295,2007,361,65535,4294967295,2008,361,464,4294967295,2009,626,65535,4294967295,2010,105,65535,4294967295,2011,627,65535,4294967295,2012,628,65535,4294967295,633,202,65535,4294967295,2013,202,65535,4294967295,2014,57,65535,4294967295,1907,600,65535,4294967295,2015,629,65535,4294967295,636,203,65535,4294967295,2016,203,65535,4294967295,1140,362,65535,4294967295,2017,362,65535,4294967295,2018,362,484,4294967295,2019,630,65535,4294967295,2020,363,65535,4294967295,2021,363,65535,4294967295,2022,363,484,4294967295,2023,631,65535,4294967295,2024,106,65535,4294967295,2025,364,65535,4294967295,2025,364,65535,4294967295,2026,364,65535,4294967295,2025,364,65535,4294967295,2027,364,1539,4294967295,2028,632,65535,4294967295,2029,614,65535,4294967295,2030,633,65535,4294967295,2031,365,65535,4294967295,2032,365,65535,4294967295,2033,365,490,4294967295,2034,634,65535,4294967295,2035,107,65535,4294967295,2036,635,65535,4294967295,2037,636,65535,4294967295,643,204,65535,4294967295,2038,204,65535,4294967295,2039,58,65535,4294967295,1150,366,65535,4294967295,2040,366,65535,4294967295,2041,366,507,4294967295,2042,367,65535,4294967295,2043,367,65535,4294967295,2042,367,65535,4294967295,2044,367,1604,4294967295,2045,108,65535,4294967295,2046,368,65535,4294967295,2047,368,65535,4294967295,2046,368,65535,4294967295,2048,368,1707,4294967295,2049,109,65535,4294967295,2050,369,65535,4294967295,1156,369,65535,4294967295,2051,369,1719,4294967295,2052,614,65535,4294967295,2053,637,65535,4294967295,1155,205,65535,4294967295,2054,205,65535,429496729

_(report truncated; full output in workflow logs)_

@tinovyatkin
tinovyatkin enabled auto-merge (squash) July 25, 2026 16:33
@tinovyatkin
tinovyatkin disabled auto-merge July 25, 2026 23:01
@tinovyatkin
tinovyatkin merged commit dde6bf0 into main Jul 25, 2026
11 of 12 checks passed
@tinovyatkin
tinovyatkin deleted the feat/195-offending-token branch July 25, 2026 23:02
@ophiarch ophiarch Bot mentioned this pull request Jul 25, 2026
tinovyatkin added a commit that referenced this pull request Jul 26, 2026
… (ANTLR parity) (#204)

* feat(runtime): pass the offending token to ErrorListener::syntax_error

ErrorListener::syntax_error now receives offending: Option<TokenView>
right after the recognizer, matching ANTLR's canonical
syntaxError(recognizer, offendingSymbol, ...) contract. Every reference
runtime passes the offending symbol; span-building error reporters
(e.g. avdl's miette diagnostics with byte-offset underlines) need
start_byte/stop_byte from the token, not just (line, column).

ParserDiagnostic records the anchoring TokenId at each creation site
(diagnostic_for_token already had the token in hand; the extraneous/
missing recovery paths record the current token) and dispatch resolves
it to a TokenView from the token store. Lexer-originated diagnostics
pass None, matching ANTLR's null offendingSymbol for lexer errors.

Fixes #195

* fix(runtime): carry the offending token on AntlrError::ParserError

Review on #196 found the offending-token contract held only for
extraneous-input/missing-token recovery and prediction diagnostics:
generated parsers route ordinary mismatched-input, no-viable-alternative,
failed-predicate, and sync errors through AntlrError::ParserError, whose
diagnostic arm hard-coded offending: None — exactly the errors a real
recognizer reports most.

ParserError gains offending: Option<TokenId>, recorded where each error
is built (recover_generated_match, generated sync, failed-predicate
builders, recognition_error) rather than resolved at reporting time:
prediction restores the input cursor, so lt(1) at dispatch can point at
the decision start instead of the error index —
no_viable_alternative_error_at now forwards the anchor its diagnostic
already computed.

Also converts the new listener test to a named insta snapshot per house
style.

* ci: displace wedged Copy/Paste Detection run

* merge: combine offending-token (#195) with main incl. depth cap (#199)

The depth-cap violation error now carries its offending token like
every other ParserError built at a known input position.

* feat(runtime): add_parse_listener — parse-time rule enter/exit events

ANTLR's addParseListener delivers enterEveryRule/exitEveryRule during
recognition; cel-rust's RecursionListener (live expr-depth counting with
parse abort) is built on it. Our runtime only had post-parse listeners,
forcing ports to rework such listeners into post-parse tree walks.

ParseListener (enter fallible for aborts, exit infallible) dispatches
from generated rule bodies: enter before the body after the depth-cap
probe, exit on every exit path, one simulated enter per left-recursive
operator expansion (upstream Parser.pushNewRecursionContext fires
triggerEnterRuleEvent) with matching exits as the rule unrolls — pairs
always balance. A listener abort is sticky through rule-level recovery,
drained at the top-level entry via take_parse_abort() (unified with the
depth-cap violation, depth error preferred), and cleared at entry so
instances never poison the next parse.

Costs nothing when unused: dispatch sites gate on list emptiness (one
predictable branch; Kotlin parse timings unchanged, ktor parse-bench
fixture at baseline). When a listener is registered, generated dispatch
routes ATN-preferred rules through their generated bodies so real
grammars observe every rule; interpreter-only rules do not fire events
(documented divergence, matching the depth cap). Emitted probes are
plain if-let — generated output stays edition-2021 clean.

e2e: cel-rust's RecursionListener ported verbatim in the deep-nesting
fixture test — live counting, positioned abort error, LR expansion
entries counted, clean reuse after abort.

Closes #202

* fix(runtime): address parse-listener review findings

1. Reserved-name collision: add_parse_listener/remove_parse_listeners
   join GENERATED_PARSER_RESERVED_RULE_METHODS so a grammar rule named
   addParseListener renames to add_parse_listener_rule instead of
   colliding with the facade (E0592).
2. Exit events now fire in reverse registration order, matching
   upstream Parser.triggerExitRuleEvent; new e2e test registers two
   tracing listeners and pins enter A,B / exit B,A plus pair balance
   on both the success and recovery paths.
3. Doc correction: the aborting enter_every_rule receives no matching
   exit (same as Java, where enterRule throws before try/finally);
   listener state shared across parses must be reset after an abort.
4. remove_parse_listeners clears the sticky abort and returns the
   boxed listeners, giving callers their accumulated state back
   without external shared handles.
5. enter_every_rule takes #[non_exhaustive] EnterRuleEvent so future
   fields extend the event without breaking implementors; the dispatch
   helper loses its #[cold] (it is the hot path once registered).
6. New coverage: multi-listener order, recovery balance, depth-cap +
   listener coexistence (either bound trips first and surfaces).

Measured with-listener cost (finding 7): on the CEL grammar — the
migration target, no ATN-preferred rules — a counting listener adds
~5% (0.0433 -> 0.0453 ms on cel-rust's criterion stress expression).
On grammars with ATN-preferred rules the dominant cost is the routing
override those rules take (Kotlin ktor fixture 10.2 -> 86 ms), shared
byte-for-byte with the depth cap (cap-only run measures identically);
listener dispatch on top of it is noise. Documented on the trait.

* fix(runtime): parse-listener round-2 review findings

1. Parser trait gains add_parse_listener(Box<dyn ParseListener>) /
   remove_parse_listeners() (mirroring set_max_rule_depth), fixing the
   broken intra-doc link and letting code generic over P: Parser reach
   listener registration.
2. LR-expansion aborts now match Java exactly: the listener enter probe
   fires AFTER push_new_recursion_context_with_previous (upstream
   assigns _ctx before triggerEnterRuleEvent), so an aborting
   expansion is already counted and the unroll fires its matching exit
   — Java parity via the finally-driven unrollRecursionContexts.
   Ordinary-rule aborts keep the documented no-exit behavior (also
   Java parity). Trait doc states both cases precisely.
3. Success-path LR coverage: a+a+a+a under a tracing listener pins 7
   RULE_EXPR enters (1 dispatch + 3 expansions + 3 operands) and full
   enter/exit balance through the unroll loop.
4. Stale ATN-preferred routing comment updated for the listener guard.

* fix(runtime): make removed parse listeners re-registrable

CodeRabbit round 3: Box<dyn ParseListener> returned by
remove_parse_listeners could not be passed back to the inherent
add_parse_listener (Box did not implement ParseListener). Add the
forwarding impl for Box<T: ParseListener + ?Sized> and pin the
round-trip in the e2e test — a removed listener re-registers with its
accumulated state and still enforces its limit.

Also cover the left-recursive success path: one listener instance
parses the same under-limit operator chain twice; identical high-water
marks prove the live depth counter returned to zero after the first
LR unroll (balanced enter/exit through expansions).

* fix(runtime): match upstream left-recursive listener exit timing

Round-4 review built a Java oracle (ANTLR 4.13.2 on this PR's own
Nest.g4) and caught that batching expansion exits at unroll diverges
from upstream on live depth: recRuleSetPrevCtx fires triggerExitRuleEvent
at the TOP of each operator-loop pass, so the outgoing iteration exits
before the next expansion enters and flat chains never accumulate depth
(a+a+...+a peaks at 2 in every ANTLR target; ours peaked at chain width).
The motivating cel-rust RecursionListener would have rejected wide flat
CEL expressions every other target accepts.

The generated operator loop now exits the outgoing iteration first, and
unroll_recursion_context drops the batched exits (upstream's
unrollRecursionContexts walks exactly one link — the dispatch wrapper's
single exit plays it). Event counts unchanged; timing now matches the
oracle: 7/7 depth 2, 79/79 depth 2, bracket cases unchanged. The e2e
that encoded the divergence now pins the Java-oracle depth of 2 for a
40-term chain.

Also from review: generated impl Parser blocks forward
add_parse_listener/remove_parse_listeners (they inherited the no-op
trait defaults — generic registration silently dropped listeners and
trait-removal left them firing with the sticky abort uncleared), and
the trait doc gains the expansion-anchor note (EnterRuleEvent::current
is the operator-side lookahead, not Java's whole-expression start).
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.

feat(runtime): pass the offending token to ErrorListener::syntax_error (ANTLR parity)

1 participant