mod support {
use std::sync::Arc;
use techy::core::constructs::FromInvocation;
use techy::core::node::{validate_tree, NodeKind, NodeRef, StagedChildren};
use techy::core::specs::{
CallableSpec, CommandResolution, ResolvedCallable, ScopeStack, StdCallableSpec,
};
use techy::core::token::{
CommandRule, CommandRules, GroupRule, GroupRules, SpecialsMatch,
SpecialsScanError, StdToken, TokenKind, TokenReader, TokenRules, TriggerChars,
WhitespaceRules,
};
use techy::core::{
CommandResolver, FeatureAbsent, FeaturePresent, FinalizeError, Lang, LangFeatures,
Language, NoLangFeatures, ParseResult, ParsingState, StateData, StdParseDriver,
};
use techy::error::Recovery;
use techy::source::SourceSpan;
pub const CT_COMMAND: u32 = 1;
fn scan_tilde<L: Lang<CallableTypeId = u32>>(
content: &str,
pos: usize,
) -> Option<SpecialsMatch<L>> {
content[pos..].starts_with('~').then(|| SpecialsMatch {
end: pos + 1,
callable_type: CT_COMMAND,
spec: Arc::new(StdCallableSpec::default()),
})
}
#[derive(Debug, Clone, Copy)]
pub struct PlainCharsLang;
impl Lang for PlainCharsLang {
type Features = NoLangFeatures;
type GroupTypeId = u32;
type CallableTypeId = u32;
type ModeId = ();
type StateExt = ();
type Event = ();
type SessionExt = ();
type SourceOrigin = Option<String>;
type Tokenization = techy::core::token::StdTokenization;
type NodeExts = ();
type InvocationSyntax = ();
type Driver = StdParseDriver;
fn initial_state_data() -> Result<StateData<Self>, FinalizeError> {
Ok(StateData {
rules: TokenRules::empty(),
scopes: ScopeStack::new(),
mode: (),
ext: (),
})
}
fn scan_specials(
_state: &ParsingState<Self>,
content: &str,
pos: usize,
) -> Result<Option<SpecialsMatch<Self>>, SpecialsScanError> {
Ok(scan_tilde(content, pos))
}
fn specials_trigger_chars(_data: &StateData<Self>) -> TriggerChars {
TriggerChars::Only("~".into())
}
fn make_node_ext(
_kind: &NodeKind<Self>,
_span: &SourceSpan<Option<String>>,
_state: &Arc<ParsingState<Self>>,
_children: StagedChildren<'_, Self>,
) -> Result<(), techy::core::node::NodeBuildError> {
Ok(())
}
}
pub struct GroupsOnlyLangFeatures;
impl LangFeatures for GroupsOnlyLangFeatures {
type Whitespace = FeatureAbsent;
type Paragraphs = FeatureAbsent;
type Groups = FeaturePresent;
type Commands = FeatureAbsent;
type Comments = FeatureAbsent;
type Specials = FeatureAbsent;
type ForbiddenChars = FeatureAbsent;
type Scopes = FeatureAbsent;
}
#[derive(Debug, Clone, Copy)]
pub struct GroupsOnlyLang;
impl Lang for GroupsOnlyLang {
type Features = GroupsOnlyLangFeatures;
type GroupTypeId = u32;
type CallableTypeId = u32;
type ModeId = ();
type StateExt = ();
type Event = ();
type SessionExt = ();
type SourceOrigin = Option<String>;
type Tokenization = techy::core::token::StdTokenization;
type NodeExts = ();
type InvocationSyntax = ();
type Driver = StdParseDriver;
fn initial_state_data() -> Result<StateData<Self>, FinalizeError> {
Ok(StateData {
rules: TokenRules {
groups: GroupRules {
enabled: true,
rules: vec![Arc::new(GroupRule {
group_type: 0,
open: "{".into(),
close: "}".into(),
})],
temporary: vec![Arc::new(GroupRule {
group_type: 0,
open: "[".into(),
close: "]".into(),
})],
expecting_close: None,
},
..TokenRules::empty()
},
scopes: ScopeStack::new(),
mode: (),
ext: (),
})
}
fn scan_specials(
_state: &ParsingState<Self>,
content: &str,
pos: usize,
) -> Result<Option<SpecialsMatch<Self>>, SpecialsScanError> {
Ok(scan_tilde(content, pos))
}
fn specials_trigger_chars(_data: &StateData<Self>) -> TriggerChars {
TriggerChars::Only("~".into())
}
fn make_node_ext(
_kind: &NodeKind<Self>,
_span: &SourceSpan<Option<String>>,
_state: &Arc<ParsingState<Self>>,
_children: StagedChildren<'_, Self>,
) -> Result<(), techy::core::node::NodeBuildError> {
Ok(())
}
}
pub struct CommandsWithoutScopesLangFeatures;
impl LangFeatures for CommandsWithoutScopesLangFeatures {
type Whitespace = FeaturePresent;
type Paragraphs = FeatureAbsent;
type Groups = FeatureAbsent;
type Commands = FeaturePresent;
type Comments = FeatureAbsent;
type Specials = FeatureAbsent;
type ForbiddenChars = FeatureAbsent;
type Scopes = FeatureAbsent;
}
#[derive(Debug, Clone, Copy)]
pub struct CommandsWithoutScopesLang;
impl Lang for CommandsWithoutScopesLang {
type Features = CommandsWithoutScopesLangFeatures;
type GroupTypeId = u32;
type CallableTypeId = u32;
type ModeId = ();
type StateExt = ();
type Event = ();
type SessionExt = ();
type SourceOrigin = Option<String>;
type Tokenization = techy::core::token::StdTokenization;
type NodeExts = ();
type InvocationSyntax = ();
type Driver = StdParseDriver<FixedTableResolver>;
fn initial_state_data() -> Result<StateData<Self>, FinalizeError> {
Ok(StateData {
rules: TokenRules {
whitespace: WhitespaceRules { enabled: true, chars: " \t\n".into() },
commands: CommandRules {
enabled: true,
rules: vec![Arc::new(CommandRule {
escape_char: '\\',
name_chars:
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
.into(),
})],
},
..TokenRules::empty()
},
scopes: ScopeStack::new(),
mode: (),
ext: (),
})
}
fn make_node_ext(
_kind: &NodeKind<Self>,
_span: &SourceSpan<Option<String>>,
_state: &Arc<ParsingState<Self>>,
_children: StagedChildren<'_, Self>,
) -> Result<(), techy::core::node::NodeBuildError> {
Ok(())
}
}
#[derive(Debug, Clone, Copy)]
pub struct FixedTableResolver;
impl CommandResolver<CommandsWithoutScopesLang> for FixedTableResolver {
fn resolve_command(
&self,
_state: &ParsingState<CommandsWithoutScopesLang>,
token: &StdToken<CommandsWithoutScopesLang>,
tokens: &dyn TokenReader<'_, CommandsWithoutScopesLang>,
) -> Result<
CommandResolution<CommandsWithoutScopesLang>,
techy::error::ParseError,
> {
let TokenKind::Command { name, .. } = tokens.token_kind(token) else {
return Ok(CommandResolution::Unresolved { detail: None });
};
let spec: Arc<dyn CallableSpec<CommandsWithoutScopesLang>> = match name {
"mark" => Arc::new(StdCallableSpec::default()),
_ => return Ok(CommandResolution::Unresolved { detail: None }),
};
Ok(CommandResolution::Resolved(ResolvedCallable {
callable_type: CT_COMMAND,
spec,
}))
}
}
pub fn outline<'t, L: Lang>(
nodes: impl IntoIterator<Item = NodeRef<'t, L>>,
) -> Vec<String> {
nodes
.into_iter()
.map(|node| format!("{:?} {}", node.span().range(), node.summary()))
.collect()
}
pub fn fingerprint<L: Lang>(result: &ParseResult<L>) -> Vec<String> {
outline(result.tree.root().descendants())
}
pub fn parse_ok_in<L: Lang>(
language_for: impl Fn(Recovery) -> Language<L>,
input: &str,
) -> ParseResult<L>
where
L::InvocationSyntax: FromInvocation<L>,
{
let result = language_for(Recovery::Strict).parse(input).unwrap();
validate_tree(&result.tree).unwrap();
assert!(
result.diagnostics.is_empty(),
"unexpected strict diagnostics: {:?}",
result.diagnostics
);
let tolerant_result = language_for(Recovery::Tolerant).parse(input).unwrap();
validate_tree(&tolerant_result.tree).unwrap();
assert!(
tolerant_result.diagnostics.is_empty(),
"unexpected tolerant diagnostics: {:?}",
tolerant_result.diagnostics
);
assert_eq!(
fingerprint(&result),
fingerprint(&tolerant_result),
"strict and tolerant trees diverge on a happy-path input"
);
result
}
}
mod plain_chars {
use super::support::*;
use std::sync::Arc;
use techy::core::token::TokenRulesOverrides;
use techy::core::{Language, ParsingState, ParsingStateDelta, StdParseDriver};
use techy::error::Recovery;
fn language(recovery: Recovery) -> Language<PlainCharsLang> {
Language::new(
StdParseDriver::new(recovery, ()),
ParsingState::lang_initial().expect("seed state"),
)
}
#[test]
fn every_construct_spelling_parses_as_plain_character_content() {
let input = "a\\cmd{b} %c\n\nd~e @f";
let result = parse_ok_in(language, input);
let root = result.tree.root();
assert_eq!(root.child_count(), 1, "outline: {:?}", outline(root.children()));
let content = root.child(0).unwrap();
assert!(content.is_chars());
assert_eq!(content.chars(), Some(input));
assert_eq!(content.span().range(), 0..19);
for node in root.descendants() {
assert!(
!node.is_group() && !node.is_callable() && !node.is_comment(),
"unexpected non-chars node: {}",
node.summary()
);
}
}
#[test]
fn an_empty_delta_derives_cleanly() {
let derived = ParsingState::<PlainCharsLang>::lang_initial().expect("seed state")
.derived(&ParsingStateDelta::new())
.unwrap();
assert_eq!(derived.rules().whitespace_chars(), "");
}
#[test]
fn disable_all_mentions_nothing_under_an_all_absent_language() {
let overrides = TokenRulesOverrides::<PlainCharsLang>::disable_all();
assert_eq!(overrides, TokenRulesOverrides::default());
let derived = ParsingState::<PlainCharsLang>::lang_initial().expect("seed state")
.derived(&ParsingStateDelta::new().rules(overrides))
.expect("disable_all() applies cleanly whatever the language declares");
assert!(!derived.rules().commands_enabled());
}
#[test]
fn a_comment_token_from_a_violating_token_source_is_an_implementation_error() {
use techy::core::constructs::{
ConstructParser, ImplementationError, NodesParser, ParseContext, StopSpec,
};
use techy::core::token::{
StdStreamPosition, StdToken, StdTokenReader, TokenEdge, TokenKind,
TokenReader, TokenResult,
};
use techy::core::ParserSession;
use techy::error::DiagnosticInfo;
use techy::source::{Source, SourcePos, SourceSpan, Span};
struct CommentEmittingReader<'s> {
inner: StdTokenReader<'s>,
}
impl<'s> CommentEmittingReader<'s> {
fn inner(&self) -> &dyn TokenReader<'s, PlainCharsLang> {
&self.inner
}
fn inner_mut(&mut self) -> &mut dyn TokenReader<'s, PlainCharsLang> {
&mut self.inner
}
}
impl<'s> TokenReader<'s, PlainCharsLang> for CommentEmittingReader<'s> {
fn peek(
&mut self,
_state: &Arc<ParsingState<PlainCharsLang>>,
) -> TokenResult<PlainCharsLang, StdToken<PlainCharsLang>> {
let content = self.inner.content();
let line_end = content.find('\n').unwrap_or(content.len());
Ok(StdToken::comment(
Span::new(0, 1), Span::new(0, line_end), Span::empty(0), Span::empty(line_end), ))
}
fn move_to(&mut self, tok: &StdToken<PlainCharsLang>, edge: TokenEdge) {
self.inner_mut().move_to(tok, edge);
}
fn move_to_position(&mut self, at: &StdStreamPosition) {
self.inner_mut().move_to_position(at);
}
fn token_kind<'t>(
&self,
tok: &'t StdToken<PlainCharsLang>,
) -> TokenKind<'t, PlainCharsLang>
where
's: 't,
{
self.inner().token_kind(tok)
}
fn source_span_between(
&self,
tok: &StdToken<PlainCharsLang>,
a: TokenEdge,
b: TokenEdge,
) -> SourceSpan {
self.inner().source_span_between(tok, a, b)
}
fn position_here(&self) -> StdStreamPosition {
self.inner().position_here()
}
fn position_at(
&self,
tok: &StdToken<PlainCharsLang>,
edge: TokenEdge,
) -> StdStreamPosition {
self.inner().position_at(tok, edge)
}
fn source_position_at(&self, at: &StdStreamPosition) -> SourcePos {
self.inner().source_position_at(at)
}
fn source_span_within(
&self,
begin: &StdStreamPosition,
end: &StdStreamPosition,
) -> Option<SourceSpan> {
self.inner().source_span_within(begin, end)
}
fn source_span_describing(
&self,
begin: &StdStreamPosition,
end: &StdStreamPosition,
) -> SourceSpan {
self.inner().source_span_describing(begin, end)
}
}
let driver = StdParseDriver::new(Recovery::Tolerant, ());
let mut session = ParserSession::new();
let source: Arc<Source> = Arc::new(Source::new("%c"));
let mut reader = CommentEmittingReader { inner: StdTokenReader::new(&source) };
let mut cx = ParseContext::new(
&mut reader,
Arc::new(ParsingState::<PlainCharsLang>::lang_initial().expect("seed state")),
&mut session,
&driver);
let err = NodesParser::new(StopSpec::none()).parse(&mut cx).unwrap_err();
assert_eq!(err.identifier(), ImplementationError::IDENTIFIER);
}
}
mod groups_only {
use super::support::*;
use std::sync::Arc;
use techy::source::Source;
use techy::core::token::{
StdToken, StdTokenReader, TokenEdge, TokenKind, TokenReader, TokenRulesOverrides,
};
use techy::core::{Language, ParsingState, ParsingStateDelta, StdParseDriver};
use techy::error::Recovery;
fn language(recovery: Recovery) -> Language<GroupsOnlyLang> {
Language::new(
StdParseDriver::new(recovery, ()),
ParsingState::lang_initial().expect("seed state"),
)
}
#[test]
fn braces_parse_as_group_nodes_while_other_constructs_read_as_plain_content() {
let input = "x{a b}y%z\n\n\\w ~@";
let result = parse_ok_in(language, input);
assert_eq!(
outline(result.tree.root().children()),
["0..1 chars(x)", "1..6 group(0 { })", "6..16 chars(y%z\n\n\\w ~@)"]
);
let group = result.tree.root().child(1).unwrap();
assert!(group.is_group());
assert_eq!(group.group_delimiters(), Some(("{", "}")));
assert_eq!(outline(group.children()), ["2..5 chars(a b)"]);
}
#[test]
fn whitespace_characters_are_ordinary_content_tokens_with_empty_pre_space() {
let state = Arc::new(ParsingState::<GroupsOnlyLang>::lang_initial().expect("seed state"));
let source: Arc<Source> = Arc::new(Source::new(" {"));
let mut std_reader = StdTokenReader::new(&source);
let reader: &mut dyn TokenReader<'_, GroupsOnlyLang> = &mut std_reader;
let token: StdToken<GroupsOnlyLang> = reader.peek(&state).unwrap();
assert_eq!(reader.token_kind(&token), TokenKind::Char(' '));
assert_eq!(reader.source_span_of(&token).range(), 0..1);
assert_eq!(
reader
.source_span_between(&token, TokenEdge::StartBeforePreSpace, TokenEdge::Start)
.range(),
0..0
);
reader.move_to(&token, TokenEdge::EndPastPostSpace);
let token = reader.peek(&state).unwrap();
assert!(matches!(
reader.token_kind(&token),
TokenKind::GroupOpen { delim: "{", .. }
));
assert_eq!(
reader
.source_span_between(&token, TokenEdge::StartBeforePreSpace, TokenEdge::Start)
.range(),
1..1
);
}
#[test]
fn disable_all_flips_only_the_groups_gate_and_applies_cleanly() {
let overrides = TokenRulesOverrides::<GroupsOnlyLang>::disable_all();
let mut expected = TokenRulesOverrides::<GroupsOnlyLang>::default();
expected.groups.enabled = Some(false);
assert_eq!(overrides, expected);
let derived = ParsingState::<GroupsOnlyLang>::lang_initial().expect("seed state")
.derived(&ParsingStateDelta::new().rules(overrides))
.expect("disable_all() applies cleanly under a partially-absent language");
assert!(!derived.rules().groups_enabled());
}
#[test]
fn override_all_mirrors_only_the_groups_block() {
let seed = ParsingState::<GroupsOnlyLang>::lang_initial().expect("seed state");
let overrides = TokenRulesOverrides::override_all(seed.rules());
let mut expected = TokenRulesOverrides::<GroupsOnlyLang>::default();
expected.groups.enabled = Some(true);
expected.groups.rules = Some(seed.rules().group_rules().to_vec());
assert_eq!(overrides, expected);
assert!(!seed.rules().temporary_group_rules().is_empty());
assert!(overrides.groups.temporary.is_none());
let disabled = seed
.derived(&ParsingStateDelta::new().rules(TokenRulesOverrides::disable_all()))
.expect("the scoped off applies");
assert!(!disabled.rules().groups_enabled());
let restored = disabled
.derived(&ParsingStateDelta::new().rules(overrides))
.expect("override_all() applies cleanly under a partially-absent language");
assert!(restored.rules().groups_enabled());
assert_eq!(restored.rules().group_rules().len(), seed.rules().group_rules().len());
}
}
mod commands_without_scopes {
use super::support::*;
use std::sync::Arc;
use techy::core::specs::{Package, ScopeOp, ScopeOpError, ScopeStack, SpecsProvider};
use techy::core::token::{TokenRulesOverrides, WhitespaceOverrides};
use techy::core::{Language, ParsingState, ParsingStateDelta, StdParseDriver};
use techy::error::Recovery;
fn language(recovery: Recovery) -> Language<CommandsWithoutScopesLang> {
Language::new(
StdParseDriver::new(recovery, FixedTableResolver),
ParsingState::lang_initial().expect("seed state"),
)
}
#[test]
fn commands_parse_into_callable_nodes_from_a_fixed_table() {
let input = r"\mark {h} %i @";
let result = parse_ok_in(language, input);
assert_eq!(
outline(result.tree.root().children()),
["0..6 1(mark)", "6..14 chars({h} %i @)"]
);
let callable = result.tree.root().child(0).unwrap();
assert!(callable.is_callable());
assert_eq!(callable.name(), Some("mark"));
assert_eq!(callable.callable_type(), Some(CT_COMMAND));
}
#[test]
fn double_newlines_do_not_split_paragraphs() {
let result = parse_ok_in(language, "a\n\nb");
assert_eq!(outline(result.tree.root().children()), ["0..4 chars(a\n\nb)"]);
}
#[test]
fn overrides_for_present_features_apply_cleanly() {
let seed = ParsingState::<CommandsWithoutScopesLang>::lang_initial().expect("seed state");
let derived = seed
.derived(&ParsingStateDelta::new().rules(TokenRulesOverrides {
whitespace: WhitespaceOverrides { enabled: None, chars: Some("Z".into()) },
..TokenRulesOverrides::default()
}))
.unwrap();
assert_eq!(derived.rules().whitespace_chars(), "Z");
}
#[test]
fn disable_all_names_only_the_present_features_and_applies_cleanly() {
let overrides = TokenRulesOverrides::<CommandsWithoutScopesLang>::disable_all();
let mut expected = TokenRulesOverrides::<CommandsWithoutScopesLang>::default();
expected.whitespace.enabled = Some(false);
expected.commands.enabled = Some(false);
assert_eq!(overrides, expected);
let derived = ParsingState::<CommandsWithoutScopesLang>::lang_initial().expect("seed state")
.derived(&ParsingStateDelta::new().rules(overrides))
.expect("disable_all() applies cleanly under a partially-absent language");
assert!(!derived.rules().whitespace_enabled());
assert!(!derived.rules().commands_enabled());
assert!(!derived.rules().comments_enabled());
}
#[test]
fn the_scope_stack_of_a_scopes_absent_language_is_permanently_empty() {
let state = ParsingState::<CommandsWithoutScopesLang>::lang_initial().expect("seed state");
assert!(state.scopes().is_empty());
assert!(state.scopes().providers().is_empty());
assert_eq!(state.scopes().len(), 0);
}
#[test]
fn apply_op_on_a_scopes_absent_stack_reports_scopes_absent_without_panicking() {
let mut stack: ScopeStack<CommandsWithoutScopesLang> = ScopeStack::new();
let provider: Arc<dyn SpecsProvider<CommandsWithoutScopesLang>> =
Arc::new(Package::new("late"));
let error = stack.apply_op(&ScopeOp::Push(provider)).unwrap_err();
assert_eq!(error, ScopeOpError::ScopesAbsent);
assert!(stack.is_empty());
}
}
mod feature_composition {
use super::support::{CommandsWithoutScopesLang, GroupsOnlyLang};
use std::sync::Arc;
use techy::core::constructs::verbatim_state_delta;
use techy::core::specs::{ScopeOp, ScopeStack, SpecsProvider};
use techy::core::token::GroupRule;
use techy::core::{
FeaturePresence, Lang, LangFeatures, LangHasCommands, LangHasGroups,
LangHasScopes, LangHasWhitespace, ParsingStateDelta, TrivialLang,
};
fn requires_groups<L: LangHasGroups>() {}
fn requires_commands<L: LangHasCommands>() {}
fn requires_whitespace<L: LangHasWhitespace>() {}
const _: fn() = requires_groups::<GroupsOnlyLang>;
const _: fn() = requires_commands::<CommandsWithoutScopesLang>;
const _: fn() = requires_whitespace::<CommandsWithoutScopesLang>;
fn mint_verbatim_delta<L: LangHasGroups>(
terminator: Arc<GroupRule<L>>,
) -> ParsingStateDelta<L> {
verbatim_state_delta(terminator)
}
const _: fn(Arc<GroupRule<GroupsOnlyLang>>) -> ParsingStateDelta<GroupsOnlyLang> =
mint_verbatim_delta::<GroupsOnlyLang>;
#[derive(Debug, Clone, Copy)]
struct AllPresentLang;
impl TrivialLang for AllPresentLang {}
fn add_scope_op<L: LangHasScopes>(
delta: ParsingStateDelta<L>,
op: ScopeOp<L>,
) -> ParsingStateDelta<L> {
delta.scope_op(op)
}
const _: fn(
ParsingStateDelta<AllPresentLang>,
ScopeOp<AllPresentLang>,
) -> ParsingStateDelta<AllPresentLang> = add_scope_op::<AllPresentLang>;
fn push_onto_scope_stack<L: LangHasScopes>(
mut stack: ScopeStack<L>,
provider: Arc<dyn SpecsProvider<L>>,
) -> ScopeStack<L> {
stack.push(provider);
stack
}
#[allow(clippy::type_complexity)]
const _: fn(
ScopeStack<AllPresentLang>,
Arc<dyn SpecsProvider<AllPresentLang>>,
) -> ScopeStack<AllPresentLang> = push_onto_scope_stack::<AllPresentLang>;
type GroupsOnlyDecl = <GroupsOnlyLang as Lang>::Features;
const _: () =
assert!(<<GroupsOnlyDecl as LangFeatures>::Groups as FeaturePresence>::PRESENT);
const _: () =
assert!(!<<GroupsOnlyDecl as LangFeatures>::Whitespace as FeaturePresence>::PRESENT);
const _: () =
assert!(!<<GroupsOnlyDecl as LangFeatures>::Scopes as FeaturePresence>::PRESENT);
type CommandsDecl = <CommandsWithoutScopesLang as Lang>::Features;
const _: () =
assert!(<<CommandsDecl as LangFeatures>::Commands as FeaturePresence>::PRESENT);
const _: () =
assert!(<<CommandsDecl as LangFeatures>::Whitespace as FeaturePresence>::PRESENT);
const _: () =
assert!(!<<CommandsDecl as LangFeatures>::Scopes as FeaturePresence>::PRESENT);
const _: () =
assert!(!<<CommandsDecl as LangFeatures>::Groups as FeaturePresence>::PRESENT);
}
mod storage_collapse {
use core::mem::size_of;
use techy::core::specs::ScopeStack;
use techy::core::token::{TokenRules, TokenRulesOverrides};
use techy::core::{ParsingState, ParsingStateDelta, StateData, TrivialLang};
use super::support::PlainCharsLang;
#[derive(Debug, Clone, Copy)]
struct AllPresentLang;
impl TrivialLang for AllPresentLang {}
const _: () = assert!(size_of::<TokenRules<PlainCharsLang>>() == 0);
const _: () = assert!(size_of::<TokenRulesOverrides<PlainCharsLang>>() == 0);
const _: () = assert!(size_of::<ScopeStack<PlainCharsLang>>() == 0);
const _: () = assert!(size_of::<StateData<PlainCharsLang>>() == 0);
const _: () = assert!(size_of::<ParsingState<PlainCharsLang>>() == 0);
#[cfg(target_pointer_width = "64")]
const _: () = assert!(size_of::<ParsingStateDelta<PlainCharsLang>>() == 32);
#[cfg(target_pointer_width = "64")]
mod all_present_sizes_unchanged {
use super::*;
const _: () = assert!(size_of::<TokenRules<AllPresentLang>>() == 176);
const _: () = assert!(size_of::<TokenRulesOverrides<AllPresentLang>>() == 184);
const _: () = assert!(size_of::<ParsingStateDelta<AllPresentLang>>() == 240);
const _: () = assert!(size_of::<StateData<AllPresentLang>>() == 200);
const _: () = assert!(size_of::<ParsingState<AllPresentLang>>() == 232);
const _: () = assert!(size_of::<ScopeStack<AllPresentLang>>() == 24);
}
}