Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
7d7c83b
fix(codegen): emit label accessors nested in groups and mixed same-ru…
tinovyatkin Jul 26, 2026
e957d4f
fix(codegen): keep inexact label positions unresolved in action trans…
tinovyatkin Jul 27, 2026
34b9b0e
fix(codegen): harden label resolution for nested groups and disjoint …
tinovyatkin Jul 27, 2026
7fc647e
fix(codegen): count list refs when resolving later same-target labels
tinovyatkin Jul 27, 2026
05cc9be
fix(codegen): resolve a label only when its read is provably faithful
tinovyatkin Jul 27, 2026
85d82c7
fix(codegen): keep block-label reads permissive for not-set conforman…
tinovyatkin Jul 27, 2026
7bec82a
fix(codegen): serve unscoped label reads across alternatives, list-aware
tinovyatkin Jul 27, 2026
dd15380
docs(codegen): link the block-label read limitation to issue #233
tinovyatkin Jul 27, 2026
559a4ee
fix(codegen): decline label reads the translator cannot express; igno…
tinovyatkin Jul 27, 2026
c999ad7
fix(codegen): compare label reads by read mode; require one list target
tinovyatkin Jul 27, 2026
29026ea
fix(codegen): track choice branches so optional followers shadow but …
tinovyatkin Jul 27, 2026
a9109cc
fix(codegen): keep full choice ancestry, scope sibling exclusion, mat…
tinovyatkin Jul 27, 2026
fb0d575
fix(codegen): resolve labels against the action's source position
tinovyatkin Jul 27, 2026
916be91
fix(codegen): count exhaustive choices once and overlapping groups ho…
tinovyatkin Jul 27, 2026
a1cf9cf
fix(codegen): read block labels by terminal position instead of the l…
tinovyatkin Jul 27, 2026
420b537
fix(codegen): separate branch membership from optionality; match read…
tinovyatkin Jul 27, 2026
5dfd358
fix(codegen): nearest-ref ancestry, per-branch terminal counts, neste…
tinovyatkin Jul 27, 2026
1b23224
fix(codegen): record choice arity; aggregate satisfiability per parse…
tinovyatkin Jul 27, 2026
bc769f8
fix(codegen): decide action enclosure from choice spans; unify child …
tinovyatkin Jul 27, 2026
967ac20
fix(codegen): pick one enclosing branch; gate sibling hazards on conf…
tinovyatkin Jul 27, 2026
c724702
fix(codegen): normalise read coordinates; treat a taken group's quant…
tinovyatkin Jul 27, 2026
ee429e6
test(codegen): pin every label-resolution outcome as one corpus
tinovyatkin Jul 27, 2026
653282d
fix(codegen): resolve each label declaration on its own; scope group …
tinovyatkin Jul 27, 2026
10edafd
test(codegen): refresh label snapshots for the recovery-aware iterators
tinovyatkin Jul 27, 2026
8a88072
fix(codegen): range-aware index checks; scope confinement per nested …
tinovyatkin Jul 27, 2026
8616aad
fix(codegen): decline a shared last-match read when a branch has a la…
tinovyatkin Jul 27, 2026
e17fe88
fix(codegen): track group optionality per group; treat the fallback i…
tinovyatkin Jul 27, 2026
058080f
fix(codegen): four label-resolution fixes; one shape documented as de…
tinovyatkin Jul 27, 2026
28b7511
fix(codegen): filter the block-label prefix by what has matched
tinovyatkin Jul 27, 2026
6e30862
fix(codegen): only let declarations the action can observe constrain …
tinovyatkin Jul 27, 2026
39d8b47
fix(codegen): reject list prefixes that repeat with the label; closed…
tinovyatkin Jul 27, 2026
a962bbc
fix(codegen): record collapsed groups as terminals; judge branch conf…
tinovyatkin Jul 27, 2026
d82b73c
fix(codegen): keep choice metadata aligned and honour closed repeated…
tinovyatkin Jul 27, 2026
a30a548
fix(codegen): reject preceding sibling branches, propagate expanded-b…
tinovyatkin Jul 27, 2026
5dcbe9e
fix(codegen): route the remaining choice-metadata drops through retai…
tinovyatkin Jul 27, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,115 changes: 1,099 additions & 16 deletions src/bin/antlr4-rust-gen.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,25 @@ expression: "model.rules[1].alts"
),
},
stable_accessor: true,
choice_branch: [],
choice_arity: [],
choice_spans: [],
group_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
group_spans: [],
branch_spans: [],
leading_terminal: true,
span: None,
branch_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
},
ElementRef {
label: None,
Expand All @@ -41,6 +60,30 @@ expression: "model.rules[1].alts"
),
},
stable_accessor: true,
choice_branch: [],
choice_arity: [],
choice_spans: [],
group_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
group_spans: [],
branch_spans: [],
leading_terminal: true,
span: Some(
(
135,
139,
),
),
branch_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
},
ElementRef {
label: Some(
Expand All @@ -57,6 +100,30 @@ expression: "model.rules[1].alts"
),
},
stable_accessor: true,
choice_branch: [],
choice_arity: [],
choice_spans: [],
group_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
group_spans: [],
branch_spans: [],
leading_terminal: false,
span: Some(
(
146,
147,
),
),
branch_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
},
],
children: {
Expand Down Expand Up @@ -99,6 +166,25 @@ expression: "model.rules[1].alts"
),
},
stable_accessor: true,
choice_branch: [],
choice_arity: [],
choice_spans: [],
group_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
group_spans: [],
branch_spans: [],
leading_terminal: true,
span: None,
branch_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
},
ElementRef {
label: None,
Expand All @@ -115,6 +201,30 @@ expression: "model.rules[1].alts"
),
},
stable_accessor: true,
choice_branch: [],
choice_arity: [],
choice_spans: [],
group_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
group_spans: [],
branch_spans: [],
leading_terminal: true,
span: Some(
(
190,
194,
),
),
branch_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
},
ElementRef {
label: Some(
Expand All @@ -131,6 +241,30 @@ expression: "model.rules[1].alts"
),
},
stable_accessor: true,
choice_branch: [],
choice_arity: [],
choice_spans: [],
group_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
group_spans: [],
branch_spans: [],
leading_terminal: false,
span: Some(
(
201,
202,
),
),
branch_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
},
],
children: {
Expand Down Expand Up @@ -173,6 +307,30 @@ expression: "model.rules[1].alts"
),
},
stable_accessor: true,
choice_branch: [],
choice_arity: [],
choice_spans: [],
group_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
group_spans: [],
branch_spans: [],
leading_terminal: true,
span: Some(
(
238,
241,
),
),
branch_local_cardinality: ChildCardinality {
min: 1,
max: Some(
1,
),
},
},
],
children: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
---
source: src/bin/antlr4-rust-gen.rs
expression: context(name)
---

pub fn child_count(&self) -> usize {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.child_count(),
__GeneratedRuleContext::Active { context, .. } => context.child_count(),
}
}

pub fn start(&self) -> __GeneratedTokenView {
let token = match &self.__node {
__GeneratedRuleContext::Stored(node) => node.start(),
__GeneratedRuleContext::Active { context, tokens, .. } => context.start(tokens),
};
__GeneratedTokenView { text: token.map(|token| token.text_or_empty().to_owned()).unwrap_or_default() }
}

pub fn text(&self) -> String {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.text(),
__GeneratedRuleContext::Active { context, storage, tokens } => context.text(storage, tokens),
}
}
pub fn unary(&self) -> Result<UnaryContext<'a>, MissingChildError> {
__rule_children(self.__node, 4)
.next()
.map(|node| UnaryContext::__from_child_node(node, self.__invocation_states.as_deref()))
.ok_or_else(|| MissingChildError::new("BranchHazardContext", "unary"))
}
pub fn star_token(&self) -> Option<TerminalNode<'a>> {
__token_children(self.__node, 8)
.next()
.map(TerminalNode::new)
}
pub fn num_token(&self) -> Result<TerminalNode<'a>, MissingChildError> {
__token_children(self.__node, 14)
.next()
.map(TerminalNode::new)
.ok_or_else(|| MissingChildError::new("BranchHazardContext", "NUM"))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
source: src/bin/antlr4-rust-gen.rs
expression: context(name)
---

pub fn child_count(&self) -> usize {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.child_count(),
__GeneratedRuleContext::Active { context, .. } => context.child_count(),
}
}

pub fn start(&self) -> __GeneratedTokenView {
let token = match &self.__node {
__GeneratedRuleContext::Stored(node) => node.start(),
__GeneratedRuleContext::Active { context, tokens, .. } => context.start(tokens),
};
__GeneratedTokenView { text: token.map(|token| token.text_or_empty().to_owned()).unwrap_or_default() }
}

pub fn text(&self) -> String {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.text(),
__GeneratedRuleContext::Active { context, storage, tokens } => context.text(storage, tokens),
}
}
pub fn unary(&self) -> Result<UnaryContext<'a>, MissingChildError> {
__rule_children(self.__node, 4)
.next()
.map(|node| UnaryContext::__from_child_node(node, self.__invocation_states.as_deref()))
.ok_or_else(|| MissingChildError::new("BranchRivalContext", "unary"))
}
pub fn num_token(&self) -> Result<TerminalNode<'a>, MissingChildError> {
__token_children(self.__node, 14)
.next()
.map(TerminalNode::new)
.ok_or_else(|| MissingChildError::new("BranchRivalContext", "NUM"))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
source: src/bin/antlr4-rust-gen.rs
expression: "context(\"ClosedRepeatPrefixContext\")"
---

pub fn child_count(&self) -> usize {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.child_count(),
__GeneratedRuleContext::Active { context, .. } => context.child_count(),
}
}

pub fn start(&self) -> __GeneratedTokenView {
let token = match &self.__node {
__GeneratedRuleContext::Stored(node) => node.start(),
__GeneratedRuleContext::Active { context, tokens, .. } => context.start(tokens),
};
__GeneratedTokenView { text: token.map(|token| token.text_or_empty().to_owned()).unwrap_or_default() }
}

pub fn text(&self) -> String {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.text(),
__GeneratedRuleContext::Active { context, storage, tokens } => context.text(storage, tokens),
}
}
pub fn star_tokens(&self) -> impl Iterator<Item = TerminalNode<'a>> + '_ {
__token_children(self.__node, 8).map(TerminalNode::new)
}
pub fn ident_tokens(&self) -> impl Iterator<Item = TerminalNode<'a>> + '_ {
__token_children(self.__node, 13).map(TerminalNode::new)
}
pub fn num_token(&self) -> Result<TerminalNode<'a>, MissingChildError> {
__token_children(self.__node, 14)
.next()
.map(TerminalNode::new)
.ok_or_else(|| MissingChildError::new("ClosedRepeatPrefixContext", "NUM"))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
source: src/bin/antlr4-rust-gen.rs
expression: "context(\"ExhaustivePrefixContext\")"
---

pub fn child_count(&self) -> usize {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.child_count(),
__GeneratedRuleContext::Active { context, .. } => context.child_count(),
}
}

pub fn start(&self) -> __GeneratedTokenView {
let token = match &self.__node {
__GeneratedRuleContext::Stored(node) => node.start(),
__GeneratedRuleContext::Active { context, tokens, .. } => context.start(tokens),
};
__GeneratedTokenView { text: token.map(|token| token.text_or_empty().to_owned()).unwrap_or_default() }
}

pub fn text(&self) -> String {
match &self.__node {
__GeneratedRuleContext::Stored(node) => node.text(),
__GeneratedRuleContext::Active { context, storage, tokens } => context.text(storage, tokens),
}
}
pub fn unary_children(&self) -> impl Iterator<Item = UnaryContext<'a>> + '_ {
__rule_children(self.__node, 4)
.map(move |node| UnaryContext::__from_child_node(node, self.__invocation_states.as_deref()))
}
pub fn num_token(&self) -> Result<TerminalNode<'a>, MissingChildError> {
__token_children(self.__node, 14)
.next()
.map(TerminalNode::new)
.ok_or_else(|| MissingChildError::new("ExhaustivePrefixContext", "NUM"))
}
pub fn pick(&self) -> Result<UnaryContext<'a>, MissingChildError> {
__rule_children(self.__node, 4)
.nth(1)
.map(|node| UnaryContext::__from_child_node(node, self.__invocation_states.as_deref()))
.ok_or_else(|| MissingChildError::new("ExhaustivePrefixContext", "pick"))
}
}
Loading
Loading