From 8b81586d94839c9890b8e657a574b94a2939ed14 Mon Sep 17 00:00:00 2001 From: Igor Dejanovic Date: Sat, 9 Nov 2024 21:06:55 +0100 Subject: [PATCH] feat: location info in AST refs #2 --- CHANGELOG.md | 8 + check-update-all.sh | 4 +- docs/src/builders.md | 14 +- rustemo-compiler/src/generator/actions/mod.rs | 39 +- .../src/generator/actions/production.rs | 141 +- rustemo-compiler/src/main.rs | 6 + rustemo-compiler/src/settings.rs | 9 + rustemo/src/context.rs | 2 +- rustemo/src/glr/gss.rs | 88 +- rustemo/src/glr/parser.rs | 72 +- rustemo/src/lexer.rs | 2 + rustemo/src/location.rs | 25 +- rustemo/src/lr/parser.rs | 2 +- tests/build.rs | 11 +- tests/src/builder/loc_info/json.rustemo | 18 + tests/src/builder/loc_info/loc_info.ast | 325 +++ tests/src/builder/loc_info/loc_info.json | 22 + tests/src/builder/loc_info/mod.rs | 19 + tests/src/builder/mod.rs | 1 + tests/src/glr/build/{ => basic}/calc.rustemo | 0 tests/src/glr/build/basic/mod.rs | 60 + .../{ => basic}/tree_build_default_1.ast | 0 .../{ => basic}/tree_build_default_2.ast | 0 .../{ => basic}/tree_build_generic_1.ast | 18 +- .../{ => basic}/tree_build_generic_2.ast | 18 +- tests/src/glr/build/loc_info/json.rustemo | 18 + .../glr/build/loc_info/loc_info_forest.ast | 2436 +++++++++++++++++ tests/src/glr/build/loc_info/mod.rs | 32 + tests/src/glr/build/mod.rs | 74 +- ...c_incomplete.error => calc_incomplete.err} | 2 +- .../{calc_missing.error => calc_missing.err} | 2 +- ...c_unexpected.error => calc_unexpected.err} | 2 +- tests/src/glr/errors/mod.rs | 6 +- tests/src/glr/forest/calc.ast | 640 +++-- .../most_specific_off/mod.rs | 17 +- .../src/glr/special/bounded_ambiguity/mod.rs | 14 +- .../glr/special/bounded_ambiguity/tree_1.ast | 22 +- .../glr/special/bounded_ambiguity/tree_2.ast | 22 +- .../special/bounded_direct_ambiguity/mod.rs | 14 +- .../bounded_direct_ambiguity/tree_1.ast | 34 +- .../bounded_direct_ambiguity/tree_2.ast | 34 +- .../bounded_direct_ambiguity/tree_3.ast | 34 +- .../bounded_direct_ambiguity/tree_4.ast | 34 +- .../bounded_direct_ambiguity/tree_5.ast | 34 +- tests/src/glr/special/farshi_g7/mod.rs | 14 +- tests/src/glr/special/farshi_g7/tree.ast | 58 +- tests/src/glr/special/farshi_g8/mod.rs | 14 +- tests/src/glr/special/farshi_g8/tree_1.ast | 32 +- tests/src/glr/special/farshi_g8/tree_2.ast | 28 +- tests/src/glr/special/farshi_g8/tree_3.ast | 28 +- tests/src/glr/special/farshi_g8/tree_4.ast | 24 +- tests/src/glr/special/farshi_g8/tree_5.ast | 28 +- tests/src/glr/special/farshi_g8/tree_6.ast | 24 +- tests/src/glr/special/farshi_g8/tree_7.ast | 24 +- tests/src/glr/special/farshi_g8/tree_8.ast | 20 +- tests/src/glr/special/highly_ambiguous/mod.rs | 14 +- .../glr/special/highly_ambiguous/tree_1.ast | 18 +- .../glr/special/highly_ambiguous/tree_10.ast | 20 +- .../glr/special/highly_ambiguous/tree_2.ast | 18 +- .../glr/special/highly_ambiguous/tree_3.ast | 18 +- .../glr/special/highly_ambiguous/tree_4.ast | 20 +- .../glr/special/highly_ambiguous/tree_5.ast | 20 +- .../glr/special/highly_ambiguous/tree_6.ast | 18 +- .../glr/special/highly_ambiguous/tree_7.ast | 20 +- .../glr/special/highly_ambiguous/tree_8.ast | 20 +- .../glr/special/highly_ambiguous/tree_9.ast | 18 +- .../glr/special/reduce_enough_empty/mod.rs | 14 +- .../glr/special/reduce_enough_empty/tree.ast | 20 +- .../special/reduce_enough_many_empty/mod.rs | 14 +- .../special/reduce_enough_many_empty/tree.ast | 26 +- tests/src/glr/special/right_nullable/mod.rs | 14 +- .../src/glr/special/right_nullable/tree_1.ast | 14 +- .../src/glr/special/right_nullable/tree_2.ast | 12 +- .../glr/special/unbounded_ambiguity/mod.rs | 14 +- .../special/unbounded_ambiguity/tree_1.ast | 32 +- .../special/unbounded_ambiguity/tree_2.ast | 32 +- .../special/unbounded_ambiguity/tree_3.ast | 32 +- .../special/unbounded_ambiguity/tree_4.ast | 32 +- .../special/unbounded_ambiguity/tree_5.ast | 30 +- .../nondeterministic_palindromes/tree.ast | 45 - 80 files changed, 4134 insertions(+), 1070 deletions(-) create mode 100644 tests/src/builder/loc_info/json.rustemo create mode 100644 tests/src/builder/loc_info/loc_info.ast create mode 100644 tests/src/builder/loc_info/loc_info.json create mode 100644 tests/src/builder/loc_info/mod.rs rename tests/src/glr/build/{ => basic}/calc.rustemo (100%) create mode 100644 tests/src/glr/build/basic/mod.rs rename tests/src/glr/build/{ => basic}/tree_build_default_1.ast (100%) rename tests/src/glr/build/{ => basic}/tree_build_default_2.ast (100%) rename tests/src/glr/build/{ => basic}/tree_build_generic_1.ast (75%) rename tests/src/glr/build/{ => basic}/tree_build_generic_2.ast (74%) create mode 100644 tests/src/glr/build/loc_info/json.rustemo create mode 100644 tests/src/glr/build/loc_info/loc_info_forest.ast create mode 100644 tests/src/glr/build/loc_info/mod.rs rename tests/src/glr/errors/{calc_incomplete.error => calc_incomplete.err} (86%) rename tests/src/glr/errors/{calc_missing.error => calc_missing.err} (90%) rename tests/src/glr/errors/{calc_unexpected.error => calc_unexpected.err} (90%) delete mode 100644 tests/src/special/nondeterministic_palindromes/tree.ast diff --git a/CHANGELOG.md b/CHANGELOG.md index 652f7f3d..a9c17416 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # [Unreleased] +## Added + +- `builder-loc-info` config option which provides location information in the + default builder generated AST types. See the discussion at [2] and [the + docs](https://www.igordejanovic.net/rustemo/builders.html) + +[2]: https://github.com/igordejanovic/rustemo/issues/2 + # [0.6.3] - 2024-11-11 diff --git a/check-update-all.sh b/check-update-all.sh index a8b1088b..684d1f22 100755 --- a/check-update-all.sh +++ b/check-update-all.sh @@ -13,8 +13,8 @@ cargo nextest run -p rustemo-compiler cargo install --path rustemo-compiler --debug # README Examples -rcomp docs/src/readme_example/src/textlr/calclr.rustemo -rcomp --parser-algo glr docs/src/readme_example/src/textglr/calc.rustemo +rcomp docs/src/readme_example/src/testlr/calclr.rustemo +rcomp --parser-algo glr docs/src/readme_example/src/testglr/calc.rustemo cd docs/src/tutorials/calculator/ for i in {1..5}; do diff --git a/docs/src/builders.md b/docs/src/builders.md index 38e7bd40..8f54794e 100644 --- a/docs/src/builders.md +++ b/docs/src/builders.md @@ -43,7 +43,7 @@ without the concrete syntax information. For example, `3 + 2 * 5` represents an algebric expression where we multiply `2` and `5` and then add product to `3`. AST should be the same no matter what is -the concrete syntax used to write down this information. +the concrete syntax used to write down this information. ![](images/ast.png) @@ -51,6 +51,18 @@ We could write the same expression in the post-fix ([Reverse Polish](https://en. like `3 2 5 * +`. CST would be different but the AST would be the same. ``` +```admonish tip "Location informations" +By default, this builder do not store location information in the generated AST +types. This can be changed by `builder_loc_info` [settings](./configuration.md). +If this settings is configured then each token and generated struct type is +wrapped in [ValLoc](https://docs.rs/rustemo/latest/rustemo/struct.ValLoc.html) +type which provides `location` field and can be dereferenced to the wrapped +value. + +See also [loc_info test](https://github.com/igordejanovic/rustemo/blob/main/tests/src/builder/loc_info/). +``` + + ### AST type inference diff --git a/rustemo-compiler/src/generator/actions/mod.rs b/rustemo-compiler/src/generator/actions/mod.rs index aff162be..572f7fe7 100644 --- a/rustemo-compiler/src/generator/actions/mod.rs +++ b/rustemo-compiler/src/generator/actions/mod.rs @@ -20,24 +20,35 @@ use super::ParserGenerator; mod production; pub(crate) trait ActionsGenerator { - fn terminal_type(&self, terminal: &Terminal) -> syn::Item { - let type_name_ident = format_ident!("{}", terminal.name); - parse_quote! { - pub type #type_name_ident = String; + fn terminal_type(&self, terminal: &Terminal, settings: &Settings) -> syn::Item { + let type_name = format_ident!("{}", terminal.name); + if settings.builder_loc_info { + parse_quote! { + pub type #type_name = ValLoc; + } + } else { + parse_quote! { + pub type #type_name = String; + } } } - fn terminal_action(&self, terminal: &Terminal, _settings: &Settings) -> syn::Item { + fn terminal_action(&self, terminal: &Terminal, settings: &Settings) -> syn::Item { let type_name = format_ident!("{}", terminal.name); let action_name = format_ident!("{}", to_snake_case(&terminal.name)); + let body: syn::Expr = if settings.builder_loc_info { + parse_quote! { #type_name::new(token.value.into(), Some(_ctx.location())) } + } else { + parse_quote! { token.value.into() } + }; parse_quote! { pub fn #action_name(_ctx: &Ctx, token: Token) -> #type_name { - token.value.into() + #body } } } /// Create Rust types for the given non-terminal. - fn nonterminal_types(&self, nonterminal: &NonTerminal) -> Vec; + fn nonterminal_types(&self, nonterminal: &NonTerminal, settings: &Settings) -> Vec; /// Creates an action function for each production of the given non-terminal. fn nonterminal_actions( @@ -73,11 +84,16 @@ pub(super) fn generate_parser_actions(generator: &ParserGenerator) -> Result<()> use super::#lexer_mod::Input; }, }; + let mut base_use: Vec = vec![]; + if generator.settings.builder_loc_info { + base_use.push(parse_quote! {use rustemo::{ValLoc, Context as C};}) + }; + base_use.push(parse_quote! {use rustemo::Token as RustemoToken;}); + base_use.push(parse_quote! {use super::#parser_mod::{TokenKind, Context};}); parse_quote! { /// This file is maintained by rustemo but can be modified manually. /// All manual changes will be preserved except non-doc comments. - use rustemo::Token as RustemoToken; - use super::#parser_mod::{TokenKind, Context}; + #(#base_use)* #input_type pub type Ctx<'i> = Context<'i, Input>; #[allow(dead_code)] @@ -135,7 +151,8 @@ pub(super) fn generate_parser_actions(generator: &ParserGenerator) -> Result<()> let type_name = &terminal.name; if !type_names.contains(type_name) { log!("Create type for terminal '{type_name}'."); - ast.items.push(actions_generator.terminal_type(terminal)); + ast.items + .push(actions_generator.terminal_type(terminal, generator.settings)); } // Add terminal actions let action_name = to_snake_case(&terminal.name); @@ -156,7 +173,7 @@ pub(super) fn generate_parser_actions(generator: &ParserGenerator) -> Result<()> // Add non-terminal type if !type_names.contains(&nonterminal.name) { log!("Creating types for non-terminal '{}'.", nonterminal.name); - for ty in actions_generator.nonterminal_types(nonterminal) { + for ty in actions_generator.nonterminal_types(nonterminal, generator.settings) { ast.items.push(ty); } } diff --git a/rustemo-compiler/src/generator/actions/production.rs b/rustemo-compiler/src/generator/actions/production.rs index 54a4b343..894a76d2 100644 --- a/rustemo-compiler/src/generator/actions/production.rs +++ b/rustemo-compiler/src/generator/actions/production.rs @@ -12,6 +12,16 @@ use crate::{ use super::ActionsGenerator; +macro_rules! name_valloc { + ($base_str:expr, $s:ident) => { + if $s.builder_loc_info { + format!("{}Base", $base_str) + } else { + $base_str.to_string() + } + }; +} + pub(crate) struct ProductionActionsGenerator<'t> { types: &'t SymbolTypes, term_len: usize, @@ -57,8 +67,15 @@ impl<'t> ProductionActionsGenerator<'t> { fn_args } - fn get_action_body(&self, ty: &SymbolType, target_type: &str, choice: &Choice) -> syn::Expr { + fn get_action_body( + &self, + ty: &SymbolType, + target_type: &str, + choice: &Choice, + settings: &Settings, + ) -> syn::Expr { let target_type = format_ident!("{target_type}"); + let target_type_base = format_ident!("{target_type}Base"); let choice_ident = format_ident!("{}", choice.name); let expr: syn::Expr = match &choice.kind { ChoiceKind::Plain => { @@ -66,6 +83,7 @@ impl<'t> ProductionActionsGenerator<'t> { } ChoiceKind::Struct { type_name, fields } => { let struct_ty = format_ident!("{type_name}"); + let struct_ty_base = format_ident!("{type_name}Base"); let fields: Vec = fields .iter() .map(|f| { @@ -79,12 +97,28 @@ impl<'t> ProductionActionsGenerator<'t> { .collect(); if matches!(ty.kind, SymbolTypeKind::Enum { .. }) { + if settings.builder_loc_info { + parse_quote! { + #target_type::#choice_ident( + #struct_ty::new(#struct_ty_base { + #(#fields),* + }, Some(_ctx.location())) + ) + } + } else { + parse_quote! { + #target_type::#choice_ident( + #struct_ty { + #(#fields),* + } + ) + } + } + } else if settings.builder_loc_info { parse_quote! { - #target_type::#choice_ident( - #struct_ty { - #(#fields),* - } - ) + #target_type::new(#target_type_base { + #(#fields),* + }, Some(_ctx.location())) } } else { parse_quote! { @@ -126,58 +160,70 @@ impl<'t> ProductionActionsGenerator<'t> { } impl ActionsGenerator for ProductionActionsGenerator<'_> { - fn nonterminal_types(&self, nonterminal: &NonTerminal) -> Vec { + fn nonterminal_types(&self, nonterminal: &NonTerminal, settings: &Settings) -> Vec { let ty = self .types .get_type(nonterminal.idx.symbol_index(self.term_len)); let type_ident = format_ident!("{}", ty.name); - fn get_choice_type(choice: &Choice, type_name: Option<&str>) -> Option { - match &choice.kind { - ChoiceKind::Struct { - type_name: struct_type, - fields, - } => { - let type_ident = if let Some(type_name) = type_name { - format_ident!("{type_name}") - } else { - format_ident!("{struct_type}") - }; + let get_choice_type = + |choice: &Choice, type_name: Option<&str>| -> Option> { + match &choice.kind { + ChoiceKind::Struct { + type_name: struct_type, + fields, + } => { + let type_name = if let Some(type_name) = type_name { + type_name.to_string() + } else { + struct_type.into() + }; + let type_ident = format_ident!("{}", name_valloc!(type_name, settings)); - let fields: Vec = fields - .iter() - .map(|f| { - let field_name = format_ident!("{}", f.name); - let field_type = format_ident!("{}", f.ref_type); - syn::Field::parse_named - .parse2(if f.recursive.get() { - // Handle direct recursion - quote! { pub #field_name: Box<#field_type> } - } else { - quote! {pub #field_name: #field_type} - }) - .unwrap() - }) - .collect(); - Some(parse_quote! { - #[derive(Debug, Clone)] - pub struct #type_ident { - #(#fields),* + let fields: Vec = fields + .iter() + .map(|f| { + let field_name = format_ident!("{}", f.name); + let field_type = format_ident!("{}", f.ref_type); + syn::Field::parse_named + .parse2(if f.recursive.get() { + // Handle direct recursion + quote! { pub #field_name: Box<#field_type> } + } else { + quote! {pub #field_name: #field_type} + }) + .unwrap() + }) + .collect(); + + let mut types = vec![]; + types.push(parse_quote! { + #[derive(Debug, Clone)] + pub struct #type_ident { + #(#fields),* + } + }); + if settings.builder_loc_info { + let type_ident_loc = format_ident!("{type_name}"); + types.push(parse_quote! { + pub type #type_ident_loc = ValLoc<#type_ident>; + }); } - }) + Some(types) + } + _ => None, } - _ => None, - } - } + }; - fn get_choice_types(choices: &[Choice], type_name: Option<&str>) -> Vec { + let get_choice_types = |choices: &[Choice], type_name: Option<&str>| -> Vec { choices .iter() .filter_map(|choice| get_choice_type(choice, type_name)) + .flatten() .collect() - } + }; - fn get_variants(choices: &[Choice]) -> Vec { + let get_variants = |choices: &[Choice]| -> Vec { choices .iter() .filter_map(|v| { @@ -204,7 +250,7 @@ impl ActionsGenerator for ProductionActionsGenerator<'_> { } }) .collect() - } + }; match &ty.kind { SymbolTypeKind::Enum { @@ -269,7 +315,7 @@ impl ActionsGenerator for ProductionActionsGenerator<'_> { fn nonterminal_actions( &self, nonterminal: &NonTerminal, - _settings: &Settings, + settings: &Settings, ) -> Vec<(String, syn::Item)> { let ty = self .types @@ -293,8 +339,7 @@ impl ActionsGenerator for ProductionActionsGenerator<'_> { let action_name = action_name(nonterminal, choice); let action = format_ident!("{action_name}"); let args = self.get_action_args(ty, choice); - let body = self.get_action_body(ty, target_type, choice); - + let body = self.get_action_body(ty, target_type, choice, settings); ( action_name, parse_quote! { diff --git a/rustemo-compiler/src/main.rs b/rustemo-compiler/src/main.rs index f2900889..a860a4da 100644 --- a/rustemo-compiler/src/main.rs +++ b/rustemo-compiler/src/main.rs @@ -76,6 +76,11 @@ struct Cli { #[clap(short, long, arg_enum, default_value_t)] builder_type: BuilderType, + /// Should generated default AST builder types contain location/layout information + /// This is only used for the default builder type. + #[clap(long)] + builder_loc_info: bool, + /// Lexical disambiguation using most specific match strategy. #[clap(long, default_missing_value = "true", require_equals = true)] lexical_disamb_most_specific: Option, @@ -133,6 +138,7 @@ fn main() { .generator_table_type(cli.generator_table_type) .lexer_type(cli.lexer_type) .builder_type(cli.builder_type) + .builder_loc_info(cli.builder_loc_info) .input_type(cli.input_type); if let Some(most_specific) = cli.lexical_disamb_most_specific { diff --git a/rustemo-compiler/src/settings.rs b/rustemo-compiler/src/settings.rs index 9945f53c..ea2dddd0 100644 --- a/rustemo-compiler/src/settings.rs +++ b/rustemo-compiler/src/settings.rs @@ -91,6 +91,7 @@ pub struct Settings { pub(crate) lexer_type: LexerType, pub(crate) builder_type: BuilderType, + pub(crate) builder_loc_info: bool, pub(crate) generator_table_type: GeneratorTableType, pub(crate) input_type: String, @@ -131,6 +132,7 @@ impl Default for Settings { notrace: false, lexer_type: Default::default(), builder_type: Default::default(), + builder_loc_info: false, generator_table_type: Default::default(), input_type: "str".into(), lexical_disamb_most_specific: true, @@ -260,6 +262,13 @@ impl Settings { self } + /// Should generated default AST builder types contain location/layout information + /// This is only used if builder-type is default. + pub fn builder_loc_info(mut self, builder_loc_info: bool) -> Self { + self.builder_loc_info = builder_loc_info; + self + } + /// Sets generator table type. The default is nested static arrays. pub fn generator_table_type(mut self, generator_table_type: GeneratorTableType) -> Self { self.generator_table_type = generator_table_type; diff --git a/rustemo/src/context.rs b/rustemo/src/context.rs index 073a6969..9758e458 100644 --- a/rustemo/src/context.rs +++ b/rustemo/src/context.rs @@ -4,7 +4,7 @@ use crate::{input::Input, lexer::Token, location::Location, parser::State}; /// Lexer/Parser context is used to keep the state. It provides necessary /// information to parsers and actions. -pub trait Context<'i, I: Input + ?Sized, S: State, TK> { +pub trait Context<'i, I: Input + ?Sized, S: State, TK>: Default { /// The current parser state. fn state(&self) -> S; fn set_state(&mut self, state: S); diff --git a/rustemo/src/glr/gss.rs b/rustemo/src/glr/gss.rs index 3d8bca40..c72581c8 100644 --- a/rustemo/src/glr/gss.rs +++ b/rustemo/src/glr/gss.rs @@ -349,6 +349,8 @@ where /// the parent links keeps all solutions along that back-path. children: RefCell>>>, }, + // Empty Tree + Empty, } impl<'i, I, P, TK> SPPFTree<'i, I, P, TK> @@ -362,13 +364,14 @@ where SPPFTree::NonTerm { children, .. } => { children.borrow().iter().map(|p| p.solutions()).product() } + SPPFTree::Empty => 0, } } #[allow(clippy::mutable_key_type)] fn ambiguities(&self, visited: &mut HashSet>>) -> usize { match self { - SPPFTree::Term { .. } => 0, + SPPFTree::Term { .. } | SPPFTree::Empty => 0, SPPFTree::NonTerm { children, .. } => children .borrow() .iter() @@ -385,6 +388,69 @@ where } } +/// Implementation of Context trait for usage in Tree::build. +impl<'i, I, S, P, TK> Context<'i, I, S, TK> for SPPFTree<'i, I, P, TK> +where + I: Input + ?Sized, + TK: Copy, + S: State, +{ + fn state(&self) -> S { + panic!("state() called on SPPFTree") + } + + fn set_state(&mut self, _state: S) {} + + fn position(&self) -> usize { + panic!("position() called on SPPFTree") + } + + fn set_position(&mut self, _position: usize) {} + + fn location(&self) -> Location { + match self { + SPPFTree::Term { data, .. } | SPPFTree::NonTerm { data, .. } => data.location, + _ => panic!("Called location() on empty tree!"), + } + } + + fn set_location(&mut self, _location: Location) {} + + fn range(&self) -> Range { + match self { + SPPFTree::Term { data, .. } | SPPFTree::NonTerm { data, .. } => data.range.clone(), + _ => panic!("Called range() on empty tree!"), + } + } + + fn set_range(&mut self, _range: Range) {} + + fn token_ahead(&self) -> Option<&Token<'i, I, TK>> { + None + } + + fn set_token_ahead(&mut self, _token: Token<'i, I, TK>) {} + + fn layout_ahead(&self) -> Option<&'i I> { + match self { + SPPFTree::Term { data, .. } | SPPFTree::NonTerm { data, .. } => data.layout, + _ => panic!("Called layout_ahead() on empty tree!"), + } + } + + fn set_layout_ahead(&mut self, _layout: Option<&'i I>) {} +} + +impl<'i, I, P, TK> Default for SPPFTree<'i, I, P, TK> +where + I: Input + ?Sized, + TK: Copy, +{ + fn default() -> Self { + Self::Empty + } +} + impl Clone for SPPFTree<'_, I, P, TK> where I: Input + ?Sized, @@ -406,6 +472,7 @@ where data: data.clone(), children: children.clone(), }, + Self::Empty => Self::Empty, } } } @@ -547,6 +614,7 @@ where match &*self.root { SPPFTree::Term { token, .. } => write!(f, "{:#?}", token.value), SPPFTree::NonTerm { .. } => write!(f, "{:#?}", self.children()), + SPPFTree::Empty => write!(f, "EMPTY"), } } } @@ -564,7 +632,7 @@ where /// current tree index and weighted numbering system. pub fn children(&self) -> Vec> { match *self.root { - SPPFTree::Term { .. } => vec![], + SPPFTree::Term { .. } | SPPFTree::Empty => vec![], SPPFTree::NonTerm { ref children, .. } => { let mut tree_idx = self.idx; // Calculate counter division based on weighted numbering @@ -594,13 +662,15 @@ where } /// Build an output of the tree using the given builder. - pub fn build, C, S>(&self, builder: &mut B) -> B::Output + pub fn build, S, P, TK>, S>( + &self, + builder: &mut B, + ) -> B::Output where - C: Context<'i, I, S, TK> + Default, S: State, P: Copy, { - let mut context = C::default(); + let mut context = GssHead::default(); self.build_inner(&mut context, builder); builder.get_result() } @@ -611,15 +681,21 @@ where S: State, P: Copy, { + match &*self.root { - SPPFTree::Term { token, .. } => builder.shift_action(context, token.clone()), + SPPFTree::Term { token, .. } => { + context.set_location(Context::::location(&*self.root)); + builder.shift_action(context, token.clone()) + }, SPPFTree::NonTerm { prod, .. } => { let children = self.children(); children.iter().for_each(|c| { c.build_inner(context, builder); }); + context.set_location(Context::::location(&*self.root)); builder.reduce_action(context, *prod, children.len()) } + SPPFTree::Empty => (), } } diff --git a/rustemo/src/glr/parser.rs b/rustemo/src/glr/parser.rs index 0b303d09..661ece71 100644 --- a/rustemo/src/glr/parser.rs +++ b/rustemo/src/glr/parser.rs @@ -277,6 +277,10 @@ where .or_default() .insert(head.state(), head_idx); + let token_start_pos = token.location.start.position(); + if token_start_pos > head.position() { + head.set_layout_ahead(Some(input.slice(head.position()..token_start_pos))); + } head.set_token_ahead(token); log!( " {} {}: {:?}", @@ -561,7 +565,7 @@ where // based on the same production || gss.parent(edge).possibilities.borrow().iter().all( |t| match **t { - SPPFTree::Term { .. } => false, + SPPFTree::Term { .. } | SPPFTree::Empty => false, SPPFTree::NonTerm { prod, ref children, ..} => { prod != production || (path.parents.len() == children.borrow().len()) } @@ -602,18 +606,35 @@ where ); let root_head = gss.head(path.root_head); - let start_head = gss.head(start_head); + let range = Range { + start: as Context<'_, I, S, TK>>::range( + &path.parents[0].possibilities.borrow()[0], + ) + .start, + end: as Context<'_, I, S, TK>>::range( + &path.parents[path.parents.len() - 1].possibilities.borrow()[0], + ) + .end, + }; + let location = Location { + start: as Context<'_, I, S, TK>>::location( + &path.parents[0].possibilities.borrow()[0], + ) + .start, + end: Some( + as Context<'_, I, S, TK>>::location( + &path.parents[path.parents.len() - 1].possibilities.borrow() + [0], + ) + .end + .unwrap(), + ), + }; let solution = Rc::new(SPPFTree::NonTerm { prod: production, data: TreeData { - range: Range { - start: root_head.position_ahead, - end: start_head.position_before, - }, - location: Location { - start: root_head.location_pos_ahead, - end: Some(start_head.location_pos_before), - }, + range, + location, layout: root_head.layout_ahead(), }, children: RefCell::new(path.parents), @@ -717,49 +738,54 @@ where ) .green() ); - let shifted_head_idx = match frontier_base.get(&(state, position)) { - Some(&shifted_head) => { + let (shifted_head_idx, range, location) = match frontier_base.get(&(state, position)) { + Some(&shifted_head_idx) => { log!(" {}", "Head already exists. Adding new edge.".green()); - shifted_head + let shifted_head = gss.head(shifted_head_idx); + ( + shifted_head_idx, + shifted_head.range(), + shifted_head.location(), + ) } None => { let new_head = GssHead::new( state, frontier_idx, - // FIXME position, head.position()..position, - token.value.location_after(head.location()), + token.location, + // FIXME position, position, - Default::default(), - Default::default(), + token.location, + token.location, None, None, ); #[cfg(debug_assertions)] let new_head_str = format!("{new_head:?}"); + let (new_head_range, new_head_location) = + (new_head.range(), new_head.location()); let new_head_idx = gss.add_head(new_head); log!( " {}: {new_head_str}", format!("Creating new shifted head {}", new_head_idx.index()).green() ); frontier_base.insert((state, position), new_head_idx); - new_head_idx + (new_head_idx, new_head_range, new_head_location) } }; + dbg!(&range, &location); gss.add_solution( shifted_head_idx, head_idx, Rc::new(SPPFTree::Term { token, data: TreeData { + range, + location, // FIXME: - range: Default::default(), - location: Location { - start: Default::default(), - end: Default::default(), - }, layout: None, }, }), diff --git a/rustemo/src/lexer.rs b/rustemo/src/lexer.rs index 79970cea..ea927d7c 100644 --- a/rustemo/src/lexer.rs +++ b/rustemo/src/lexer.rs @@ -169,6 +169,8 @@ where } log!(" {} {:?}", "Trying recognizers:".green(), expected_tokens); + dbg!(context.position(), context.location()); + Box::new(TokenIterator::new( input, context.position(), diff --git a/rustemo/src/location.rs b/rustemo/src/location.rs index c4528fb2..4faf01f8 100644 --- a/rustemo/src/location.rs +++ b/rustemo/src/location.rs @@ -1,4 +1,7 @@ -use std::fmt::{Debug, Display}; +use std::{ + fmt::{Debug, Display}, + ops::Deref, +}; /// A line-column based location for use where applicable (e.g. plain text). #[derive(PartialEq, Eq, Debug, Copy, Clone)] @@ -92,6 +95,15 @@ impl Location { pub fn from_start(start: Position) -> Self { Self { start, end: None } } + + /// Creates a new location starting from the current location ending with + /// loc_to location. + pub fn to(&self, loc_to: Self) -> Self { + Self { + start: self.start, + end: loc_to.end.or(Some(loc_to.start)) + } + } } impl Debug for Location { @@ -126,11 +138,13 @@ impl Display for ValLoc { write!(f, "{}", self.value) } } + impl AsRef for ValLoc { fn as_ref(&self) -> &T { &self.value } } + impl From for ValLoc { fn from(value: T) -> Self { Self { @@ -139,6 +153,15 @@ impl From for ValLoc { } } } + +impl Deref for ValLoc { + type Target = T; + + fn deref(&self) -> &Self::Target { + &self.value + } +} + impl From> for String { fn from(value: ValLoc) -> Self { value.value diff --git a/rustemo/src/lr/parser.rs b/rustemo/src/lr/parser.rs index 30ce2d1c..26b8e8f0 100644 --- a/rustemo/src/lr/parser.rs +++ b/rustemo/src/lr/parser.rs @@ -297,7 +297,7 @@ where impl<'i, C, S, P, I, TK, NTK, D, L, B> Parser<'i, I, C, S, TK> for LRParser<'i, C, S, P, TK, NTK, D, L, B, I> where - C: Context<'i, I, S, TK> + Default, + C: Context<'i, I, S, TK>, S: State + Debug, P: Debug + Copy + Into, I: Input + ?Sized + Debug + 'i, diff --git a/tests/build.rs b/tests/build.rs index 12e85e90..733ef80d 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -67,6 +67,7 @@ fn main() { s.force(false).actions_in_source_tree() }), ), + ("builder/loc_info", Box::new(|s| s.builder_loc_info(true))), // Lexer ( "lexer/custom_lexer", @@ -85,7 +86,15 @@ fn main() { // GLR ("glr/errors", Box::new(|s| s.parser_algo(ParserAlgo::GLR))), ("glr/forest", Box::new(|s| s.parser_algo(ParserAlgo::GLR))), - ("glr/build", Box::new(|s| s.parser_algo(ParserAlgo::GLR))), + // GLR builders + ( + "glr/build/basic", + Box::new(|s| s.parser_algo(ParserAlgo::GLR)), + ), + ( + "glr/build/loc_info", + Box::new(|s| s.parser_algo(ParserAlgo::GLR).builder_loc_info(true)), + ), // GLR lexical ambiguities ( "glr/lexical_ambiguity/priorities", diff --git a/tests/src/builder/loc_info/json.rustemo b/tests/src/builder/loc_info/json.rustemo new file mode 100644 index 00000000..b5bb14c7 --- /dev/null +++ b/tests/src/builder/loc_info/json.rustemo @@ -0,0 +1,18 @@ +Value: False | True | Null | Object | Array | JsonNumber | JsonString; +Object: "{" Member*[Comma] "}"; +Member: JsonString ":" Value; +Array: "[" Value*[Comma] "]"; + +terminals +False: 'false'; +True: 'true'; +Null: 'null'; +Comma: ','; +JsonNumber: /-?\d+(\.\d+)?(e|E[-+]?\d+)?/; +JsonString: /"((\\")|[^"])*"/; + +OBracket: '['; +CBracket: ']'; +OBrace: '{'; +CBrace: '}'; +Colon: ':'; diff --git a/tests/src/builder/loc_info/loc_info.ast b/tests/src/builder/loc_info/loc_info.ast new file mode 100644 index 00000000..09a8aa73 --- /dev/null +++ b/tests/src/builder/loc_info/loc_info.ast @@ -0,0 +1,325 @@ +Object( + Some( + [ + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"glossary\"", + location: Some( + [2,4-2,14], + ), + }, + value: Object( + Some( + [ + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"title\"", + location: Some( + [3,8-3,15], + ), + }, + value: JsonString( + ValLoc { + value: "\"example glossary\"", + location: Some( + [3,17-3,35], + ), + }, + ), + }, + location: Some( + [3,8-3,35], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"GlossDiv\"", + location: Some( + [4,8-4,18], + ), + }, + value: Object( + Some( + [ + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"title\"", + location: Some( + [5,12-5,19], + ), + }, + value: JsonString( + ValLoc { + value: "\"S\"", + location: Some( + [5,21-5,24], + ), + }, + ), + }, + location: Some( + [5,12-5,24], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"GlossList\"", + location: Some( + [6,12-6,23], + ), + }, + value: Object( + Some( + [ + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"GlossEntry\"", + location: Some( + [7,16-7,28], + ), + }, + value: Object( + Some( + [ + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"ID\"", + location: Some( + [8,20-8,24], + ), + }, + value: JsonString( + ValLoc { + value: "\"SGML\"", + location: Some( + [8,26-8,32], + ), + }, + ), + }, + location: Some( + [8,20-8,32], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"SortAs\"", + location: Some( + [9,20-9,28], + ), + }, + value: JsonString( + ValLoc { + value: "\"SGML\"", + location: Some( + [9,30-9,36], + ), + }, + ), + }, + location: Some( + [9,20-9,36], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"GlossTerm\"", + location: Some( + [10,20-10,31], + ), + }, + value: JsonString( + ValLoc { + value: "\"Standard Generalized Markup Language\"", + location: Some( + [10,33-10,71], + ), + }, + ), + }, + location: Some( + [10,20-10,71], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"Acronym\"", + location: Some( + [11,20-11,29], + ), + }, + value: JsonString( + ValLoc { + value: "\"SGML\"", + location: Some( + [11,31-11,37], + ), + }, + ), + }, + location: Some( + [11,20-11,37], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"Abbrev\"", + location: Some( + [12,20-12,28], + ), + }, + value: JsonString( + ValLoc { + value: "\"ISO 8879:1986\"", + location: Some( + [12,30-12,45], + ), + }, + ), + }, + location: Some( + [12,20-12,45], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"GlossDef\"", + location: Some( + [13,20-13,30], + ), + }, + value: Object( + Some( + [ + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"para\"", + location: Some( + [14,24-14,30], + ), + }, + value: JsonString( + ValLoc { + value: "\"A meta-markup language, used to create markup languages such as DocBook.\"", + location: Some( + [14,32-14,106], + ), + }, + ), + }, + location: Some( + [14,24-14,106], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"GlossSeeAlso\"", + location: Some( + [15,24-15,38], + ), + }, + value: Array( + Some( + [ + JsonString( + ValLoc { + value: "\"GML\"", + location: Some( + [15,41-15,46], + ), + }, + ), + JsonString( + ValLoc { + value: "\"XML\"", + location: Some( + [15,48-15,53], + ), + }, + ), + ], + ), + ), + }, + location: Some( + [15,24-15,54], + ), + }, + ], + ), + ), + }, + location: Some( + [13,20-16,21], + ), + }, + ValLoc { + value: MemberBase { + json_string: ValLoc { + value: "\"GlossSee\"", + location: Some( + [17,20-17,30], + ), + }, + value: JsonString( + ValLoc { + value: "\"markup\"", + location: Some( + [17,32-17,40], + ), + }, + ), + }, + location: Some( + [17,20-17,40], + ), + }, + ], + ), + ), + }, + location: Some( + [7,16-18,17], + ), + }, + ], + ), + ), + }, + location: Some( + [6,12-19,13], + ), + }, + ], + ), + ), + }, + location: Some( + [4,8-20,9], + ), + }, + ], + ), + ), + }, + location: Some( + [2,4-21,5], + ), + }, + ], + ), +) \ No newline at end of file diff --git a/tests/src/builder/loc_info/loc_info.json b/tests/src/builder/loc_info/loc_info.json new file mode 100644 index 00000000..c8f1d8c6 --- /dev/null +++ b/tests/src/builder/loc_info/loc_info.json @@ -0,0 +1,22 @@ +{ + "glossary": { + "title": "example glossary", + "GlossDiv": { + "title": "S", + "GlossList": { + "GlossEntry": { + "ID": "SGML", + "SortAs": "SGML", + "GlossTerm": "Standard Generalized Markup Language", + "Acronym": "SGML", + "Abbrev": "ISO 8879:1986", + "GlossDef": { + "para": "A meta-markup language, used to create markup languages such as DocBook.", + "GlossSeeAlso": ["GML", "XML"] + }, + "GlossSee": "markup" + } + } + } + } +} diff --git a/tests/src/builder/loc_info/mod.rs b/tests/src/builder/loc_info/mod.rs new file mode 100644 index 00000000..61d92461 --- /dev/null +++ b/tests/src/builder/loc_info/mod.rs @@ -0,0 +1,19 @@ +use serial_test::serial; +use rustemo::{rustemo_mod, Parser}; +use rustemo_compiler::{local_file, output_cmp}; + +use self::json::JsonParser; + +rustemo_mod!(json, "/src/builder/loc_info"); +rustemo_mod!(json_actions, "/src/builder/loc_info"); + +#[test] +#[serial(loc_info)] +fn loc_info() { + let mut parser = JsonParser::new(); + let result = parser.parse_file(local_file!(file!(), "loc_info.json")).unwrap(); + output_cmp!( + "src/builder/loc_info/loc_info.ast", + format!("{:#?}", result) + ); +} diff --git a/tests/src/builder/mod.rs b/tests/src/builder/mod.rs index e27e1192..24144008 100644 --- a/tests/src/builder/mod.rs +++ b/tests/src/builder/mod.rs @@ -1,3 +1,4 @@ mod custom_builder; mod generic_tree; +mod loc_info; mod use_context; diff --git a/tests/src/glr/build/calc.rustemo b/tests/src/glr/build/basic/calc.rustemo similarity index 100% rename from tests/src/glr/build/calc.rustemo rename to tests/src/glr/build/basic/calc.rustemo diff --git a/tests/src/glr/build/basic/mod.rs b/tests/src/glr/build/basic/mod.rs new file mode 100644 index 00000000..663ca559 --- /dev/null +++ b/tests/src/glr/build/basic/mod.rs @@ -0,0 +1,60 @@ +use rustemo::{rustemo_mod, Parser, TreeBuilder}; +use rustemo_compiler::output_cmp; + +rustemo_mod!(calc, "/src/glr/build/basic"); +rustemo_mod!(calc_actions, "/src/glr/build/basic"); + +use self::calc::CalcParser; + +// ANCHOR: build +#[test] +fn glr_tree_build_default() { + let forest = CalcParser::new().parse("1 + 4 * 9").unwrap(); + assert_eq!(forest.solutions(), 2); + + let mut builder = calc::DefaultBuilder::new(); + output_cmp!( + "src/glr/build/basic/tree_build_default_1.ast", + format!( + "{:#?}", + forest.get_first_tree().unwrap().build(&mut builder) + ) + ); + output_cmp!( + "src/glr/build/basic/tree_build_default_2.ast", + format!("{:#?}", forest.get_tree(1).unwrap().build(&mut builder)) + ); +} +// ANCHOR_END: build + +#[test] +fn glr_tree_build_generic() { + let forest = CalcParser::new().parse("1 + 4 * 9").unwrap(); + assert_eq!(forest.solutions(), 2); + + let mut builder = TreeBuilder::new(); + output_cmp!( + "src/glr/build/basic/tree_build_generic_1.ast", + format!( + "{:#?}", + forest + .get_first_tree() + .unwrap() + .build::, calc::State>( + &mut builder + ) + ) + ); + output_cmp!( + "src/glr/build/basic/tree_build_generic_2.ast", + format!( + "{:#?}", + forest + .get_tree(1) + .unwrap() + .build::, calc::State>( + &mut builder + ) + ) + ); +} diff --git a/tests/src/glr/build/tree_build_default_1.ast b/tests/src/glr/build/basic/tree_build_default_1.ast similarity index 100% rename from tests/src/glr/build/tree_build_default_1.ast rename to tests/src/glr/build/basic/tree_build_default_1.ast diff --git a/tests/src/glr/build/tree_build_default_2.ast b/tests/src/glr/build/basic/tree_build_default_2.ast similarity index 100% rename from tests/src/glr/build/tree_build_default_2.ast rename to tests/src/glr/build/basic/tree_build_default_2.ast diff --git a/tests/src/glr/build/tree_build_generic_1.ast b/tests/src/glr/build/basic/tree_build_generic_1.ast similarity index 75% rename from tests/src/glr/build/tree_build_generic_1.ast rename to tests/src/glr/build/basic/tree_build_generic_1.ast index 86802cde..15d9b343 100644 --- a/tests/src/glr/build/tree_build_generic_1.ast +++ b/tests/src/glr/build/basic/tree_build_generic_1.ast @@ -1,14 +1,14 @@ NonTermNode { prod: E: E Mul E, - location: [1,0], + location: [1,4-1,5], children: [ NonTermNode { prod: E: E Plus E, - location: [1,0], + location: [1,2-1,3], children: [ NonTermNode { prod: E: Num, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Num("\"1\"" [1,0-1,1]), @@ -18,15 +18,15 @@ NonTermNode { layout: None, }, TermNode { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), layout: None, }, NonTermNode { prod: E: Num, - location: [1,0], + location: [1,2-1,3], children: [ TermNode { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), layout: None, }, ], @@ -36,15 +36,15 @@ NonTermNode { layout: None, }, TermNode { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), layout: None, }, NonTermNode { prod: E: Num, - location: [1,0], + location: [1,4-1,5], children: [ TermNode { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), layout: None, }, ], diff --git a/tests/src/glr/build/tree_build_generic_2.ast b/tests/src/glr/build/basic/tree_build_generic_2.ast similarity index 74% rename from tests/src/glr/build/tree_build_generic_2.ast rename to tests/src/glr/build/basic/tree_build_generic_2.ast index a8407e6a..d16a0075 100644 --- a/tests/src/glr/build/tree_build_generic_2.ast +++ b/tests/src/glr/build/basic/tree_build_generic_2.ast @@ -1,10 +1,10 @@ NonTermNode { prod: E: E Plus E, - location: [1,0], + location: [1,4-1,5], children: [ NonTermNode { prod: E: Num, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Num("\"1\"" [1,0-1,1]), @@ -14,34 +14,34 @@ NonTermNode { layout: None, }, TermNode { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), layout: None, }, NonTermNode { prod: E: E Mul E, - location: [1,0], + location: [1,4-1,5], children: [ NonTermNode { prod: E: Num, - location: [1,0], + location: [1,2-1,3], children: [ TermNode { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), layout: None, }, ], layout: None, }, TermNode { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), layout: None, }, NonTermNode { prod: E: Num, - location: [1,0], + location: [1,4-1,5], children: [ TermNode { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), layout: None, }, ], diff --git a/tests/src/glr/build/loc_info/json.rustemo b/tests/src/glr/build/loc_info/json.rustemo new file mode 100644 index 00000000..b5bb14c7 --- /dev/null +++ b/tests/src/glr/build/loc_info/json.rustemo @@ -0,0 +1,18 @@ +Value: False | True | Null | Object | Array | JsonNumber | JsonString; +Object: "{" Member*[Comma] "}"; +Member: JsonString ":" Value; +Array: "[" Value*[Comma] "]"; + +terminals +False: 'false'; +True: 'true'; +Null: 'null'; +Comma: ','; +JsonNumber: /-?\d+(\.\d+)?(e|E[-+]?\d+)?/; +JsonString: /"((\\")|[^"])*"/; + +OBracket: '['; +CBracket: ']'; +OBrace: '{'; +CBrace: '}'; +Colon: ':'; diff --git a/tests/src/glr/build/loc_info/loc_info_forest.ast b/tests/src/glr/build/loc_info/loc_info_forest.ast new file mode 100644 index 00000000..328e2440 --- /dev/null +++ b/tests/src/glr/build/loc_info/loc_info_forest.ast @@ -0,0 +1,2436 @@ +Forest { + results: [ + NonTerm { + prod: Value: Object, + data: TreeData { + range: 0..705, + location: [1,0-22,1], + layout: Some( + "{", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(0), + head_node: NodeIndex(128), + possibilities: RefCell { + value: [ + NonTerm { + prod: Object: OBrace Member0 CBrace, + data: TreeData { + range: 0..705, + location: [1,0-22,1], + layout: Some( + "{", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(0), + head_node: NodeIndex(1), + possibilities: RefCell { + value: [ + Term { + token: OBrace("\"{\"" [1,0-1,1]), + data: TreeData { + range: 0..1, + location: [1,0-1,1], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(1), + head_node: NodeIndex(126), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member0: Member1, + data: TreeData { + range: 6..703, + location: [2,4-21,5], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(1), + head_node: NodeIndex(125), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member, + data: TreeData { + range: 6..703, + location: [2,4-21,5], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(1), + head_node: NodeIndex(124), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 6..703, + location: [2,4-21,5], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(1), + head_node: NodeIndex(2), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"glossary\\\"\"" [2,4-2,14]), + data: TreeData { + range: 6..16, + location: [2,4-2,14], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(2), + head_node: NodeIndex(3), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [2,14-2,15]), + data: TreeData { + range: 16..17, + location: [2,14-2,15], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(3), + head_node: NodeIndex(123), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: Object, + data: TreeData { + range: 18..703, + location: [2,16-21,5], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(3), + head_node: NodeIndex(122), + possibilities: RefCell { + value: [ + NonTerm { + prod: Object: OBrace Member0 CBrace, + data: TreeData { + range: 18..703, + location: [2,16-21,5], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(3), + head_node: NodeIndex(4), + possibilities: RefCell { + value: [ + Term { + token: OBrace("\"{\"" [2,16-2,17]), + data: TreeData { + range: 18..19, + location: [2,16-2,17], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(4), + head_node: NodeIndex(120), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member0: Member1, + data: TreeData { + range: 28..697, + location: [3,8-20,9], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(4), + head_node: NodeIndex(119), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 28..697, + location: [3,8-20,9], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(4), + head_node: NodeIndex(10), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member, + data: TreeData { + range: 28..55, + location: [3,8-3,35], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(4), + head_node: NodeIndex(9), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 28..55, + location: [3,8-3,35], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(4), + head_node: NodeIndex(5), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"title\\\"\"" [3,8-3,15]), + data: TreeData { + range: 28..35, + location: [3,8-3,15], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(5), + head_node: NodeIndex(6), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [3,15-3,16]), + data: TreeData { + range: 35..36, + location: [3,15-3,16], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(6), + head_node: NodeIndex(8), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 37..55, + location: [3,17-3,35], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(6), + head_node: NodeIndex(7), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"example glossary\\\"\"" [3,17-3,35]), + data: TreeData { + range: 37..55, + location: [3,17-3,35], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(10), + head_node: NodeIndex(11), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [3,35-3,36]), + data: TreeData { + range: 55..56, + location: [3,35-3,36], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(11), + head_node: NodeIndex(118), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 65..697, + location: [4,8-20,9], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(11), + head_node: NodeIndex(12), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GlossDiv\\\"\"" [4,8-4,18]), + data: TreeData { + range: 65..75, + location: [4,8-4,18], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(12), + head_node: NodeIndex(13), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [4,18-4,19]), + data: TreeData { + range: 75..76, + location: [4,18-4,19], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(13), + head_node: NodeIndex(117), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: Object, + data: TreeData { + range: 77..697, + location: [4,20-20,9], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(13), + head_node: NodeIndex(116), + possibilities: RefCell { + value: [ + NonTerm { + prod: Object: OBrace Member0 CBrace, + data: TreeData { + range: 77..697, + location: [4,20-20,9], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(13), + head_node: NodeIndex(14), + possibilities: RefCell { + value: [ + Term { + token: OBrace("\"{\"" [4,20-4,21]), + data: TreeData { + range: 77..78, + location: [4,20-4,21], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(14), + head_node: NodeIndex(114), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member0: Member1, + data: TreeData { + range: 91..687, + location: [5,12-19,13], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(14), + head_node: NodeIndex(113), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 91..687, + location: [5,12-19,13], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(14), + head_node: NodeIndex(20), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member, + data: TreeData { + range: 91..103, + location: [5,12-5,24], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(14), + head_node: NodeIndex(19), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 91..103, + location: [5,12-5,24], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(14), + head_node: NodeIndex(15), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"title\\\"\"" [5,12-5,19]), + data: TreeData { + range: 91..98, + location: [5,12-5,19], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(15), + head_node: NodeIndex(16), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [5,19-5,20]), + data: TreeData { + range: 98..99, + location: [5,19-5,20], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(16), + head_node: NodeIndex(18), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 100..103, + location: [5,21-5,24], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(16), + head_node: NodeIndex(17), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"S\\\"\"" [5,21-5,24]), + data: TreeData { + range: 100..103, + location: [5,21-5,24], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(20), + head_node: NodeIndex(21), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [5,24-5,25]), + data: TreeData { + range: 103..104, + location: [5,24-5,25], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(21), + head_node: NodeIndex(112), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 117..687, + location: [6,12-19,13], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(21), + head_node: NodeIndex(22), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GlossList\\\"\"" [6,12-6,23]), + data: TreeData { + range: 117..128, + location: [6,12-6,23], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(22), + head_node: NodeIndex(23), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [6,23-6,24]), + data: TreeData { + range: 128..129, + location: [6,23-6,24], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(23), + head_node: NodeIndex(111), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: Object, + data: TreeData { + range: 130..687, + location: [6,25-19,13], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(23), + head_node: NodeIndex(110), + possibilities: RefCell { + value: [ + NonTerm { + prod: Object: OBrace Member0 CBrace, + data: TreeData { + range: 130..687, + location: [6,25-19,13], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(23), + head_node: NodeIndex(24), + possibilities: RefCell { + value: [ + Term { + token: OBrace("\"{\"" [6,25-6,26]), + data: TreeData { + range: 130..131, + location: [6,25-6,26], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(24), + head_node: NodeIndex(108), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member0: Member1, + data: TreeData { + range: 148..673, + location: [7,16-18,17], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(24), + head_node: NodeIndex(107), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member, + data: TreeData { + range: 148..673, + location: [7,16-18,17], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(24), + head_node: NodeIndex(106), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 148..673, + location: [7,16-18,17], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(24), + head_node: NodeIndex(25), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GlossEntry\\\"\"" [7,16-7,28]), + data: TreeData { + range: 148..160, + location: [7,16-7,28], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(25), + head_node: NodeIndex(26), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [7,28-7,29]), + data: TreeData { + range: 160..161, + location: [7,28-7,29], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(26), + head_node: NodeIndex(105), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: Object, + data: TreeData { + range: 162..673, + location: [7,30-18,17], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(26), + head_node: NodeIndex(104), + possibilities: RefCell { + value: [ + NonTerm { + prod: Object: OBrace Member0 CBrace, + data: TreeData { + range: 162..673, + location: [7,30-18,17], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(26), + head_node: NodeIndex(27), + possibilities: RefCell { + value: [ + Term { + token: OBrace("\"{\"" [7,30-7,31]), + data: TreeData { + range: 162..163, + location: [7,30-7,31], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(102), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member0: Member1, + data: TreeData { + range: 184..655, + location: [8,20-17,40], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(101), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 184..655, + location: [8,20-17,40], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(94), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 184..613, + location: [8,20-16,21], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(61), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 184..393, + location: [8,20-12,45], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(54), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 184..346, + location: [8,20-11,37], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(47), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 184..307, + location: [8,20-10,71], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(40), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 184..234, + location: [8,20-9,36], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(33), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member, + data: TreeData { + range: 184..196, + location: [8,20-8,32], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(32), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 184..196, + location: [8,20-8,32], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(27), + head_node: NodeIndex(28), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"ID\\\"\"" [8,20-8,24]), + data: TreeData { + range: 184..188, + location: [8,20-8,24], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(28), + head_node: NodeIndex(29), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [8,24-8,25]), + data: TreeData { + range: 188..189, + location: [8,24-8,25], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(29), + head_node: NodeIndex(31), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 190..196, + location: [8,26-8,32], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(29), + head_node: NodeIndex(30), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"SGML\\\"\"" [8,26-8,32]), + data: TreeData { + range: 190..196, + location: [8,26-8,32], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(33), + head_node: NodeIndex(34), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [8,32-8,33]), + data: TreeData { + range: 196..197, + location: [8,32-8,33], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(34), + head_node: NodeIndex(39), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 218..234, + location: [9,20-9,36], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(34), + head_node: NodeIndex(35), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"SortAs\\\"\"" [9,20-9,28]), + data: TreeData { + range: 218..226, + location: [9,20-9,28], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(35), + head_node: NodeIndex(36), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [9,28-9,29]), + data: TreeData { + range: 226..227, + location: [9,28-9,29], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(36), + head_node: NodeIndex(38), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 228..234, + location: [9,30-9,36], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(36), + head_node: NodeIndex(37), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"SGML\\\"\"" [9,30-9,36]), + data: TreeData { + range: 228..234, + location: [9,30-9,36], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(40), + head_node: NodeIndex(41), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [9,36-9,37]), + data: TreeData { + range: 234..235, + location: [9,36-9,37], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(41), + head_node: NodeIndex(46), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 256..307, + location: [10,20-10,71], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(41), + head_node: NodeIndex(42), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GlossTerm\\\"\"" [10,20-10,31]), + data: TreeData { + range: 256..267, + location: [10,20-10,31], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(42), + head_node: NodeIndex(43), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [10,31-10,32]), + data: TreeData { + range: 267..268, + location: [10,31-10,32], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(43), + head_node: NodeIndex(45), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 269..307, + location: [10,33-10,71], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(43), + head_node: NodeIndex(44), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"Standard Generalized Markup Language\\\"\"" [10,33-10,71]), + data: TreeData { + range: 269..307, + location: [10,33-10,71], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(47), + head_node: NodeIndex(48), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [10,71-10,72]), + data: TreeData { + range: 307..308, + location: [10,71-10,72], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(48), + head_node: NodeIndex(53), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 329..346, + location: [11,20-11,37], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(48), + head_node: NodeIndex(49), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"Acronym\\\"\"" [11,20-11,29]), + data: TreeData { + range: 329..338, + location: [11,20-11,29], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(49), + head_node: NodeIndex(50), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [11,29-11,30]), + data: TreeData { + range: 338..339, + location: [11,29-11,30], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(50), + head_node: NodeIndex(52), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 340..346, + location: [11,31-11,37], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(50), + head_node: NodeIndex(51), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"SGML\\\"\"" [11,31-11,37]), + data: TreeData { + range: 340..346, + location: [11,31-11,37], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(54), + head_node: NodeIndex(55), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [11,37-11,38]), + data: TreeData { + range: 346..347, + location: [11,37-11,38], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(55), + head_node: NodeIndex(60), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 368..393, + location: [12,20-12,45], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(55), + head_node: NodeIndex(56), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"Abbrev\\\"\"" [12,20-12,28]), + data: TreeData { + range: 368..376, + location: [12,20-12,28], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(56), + head_node: NodeIndex(57), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [12,28-12,29]), + data: TreeData { + range: 376..377, + location: [12,28-12,29], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(57), + head_node: NodeIndex(59), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 378..393, + location: [12,30-12,45], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(57), + head_node: NodeIndex(58), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"ISO 8879:1986\\\"\"" [12,30-12,45]), + data: TreeData { + range: 378..393, + location: [12,30-12,45], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(61), + head_node: NodeIndex(62), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [12,45-12,46]), + data: TreeData { + range: 393..394, + location: [12,45-12,46], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(62), + head_node: NodeIndex(93), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 415..613, + location: [13,20-16,21], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(62), + head_node: NodeIndex(63), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GlossDef\\\"\"" [13,20-13,30]), + data: TreeData { + range: 415..425, + location: [13,20-13,30], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(63), + head_node: NodeIndex(64), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [13,30-13,31]), + data: TreeData { + range: 425..426, + location: [13,30-13,31], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(64), + head_node: NodeIndex(92), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: Object, + data: TreeData { + range: 427..613, + location: [13,32-16,21], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(64), + head_node: NodeIndex(91), + possibilities: RefCell { + value: [ + NonTerm { + prod: Object: OBrace Member0 CBrace, + data: TreeData { + range: 427..613, + location: [13,32-16,21], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(64), + head_node: NodeIndex(65), + possibilities: RefCell { + value: [ + Term { + token: OBrace("\"{\"" [13,32-13,33]), + data: TreeData { + range: 427..428, + location: [13,32-13,33], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(65), + head_node: NodeIndex(89), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member0: Member1, + data: TreeData { + range: 453..591, + location: [14,24-15,54], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(65), + head_node: NodeIndex(88), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member1 Comma Member, + data: TreeData { + range: 453..591, + location: [14,24-15,54], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(65), + head_node: NodeIndex(71), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member1: Member, + data: TreeData { + range: 453..535, + location: [14,24-14,106], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(65), + head_node: NodeIndex(70), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 453..535, + location: [14,24-14,106], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(65), + head_node: NodeIndex(66), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"para\\\"\"" [14,24-14,30]), + data: TreeData { + range: 453..459, + location: [14,24-14,30], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(66), + head_node: NodeIndex(67), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [14,30-14,31]), + data: TreeData { + range: 459..460, + location: [14,30-14,31], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(67), + head_node: NodeIndex(69), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 461..535, + location: [14,32-14,106], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(67), + head_node: NodeIndex(68), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"A meta-markup langu\"....\"es such as DocBook.\"" [14,32-14,106]), + data: TreeData { + range: 461..535, + location: [14,32-14,106], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(71), + head_node: NodeIndex(72), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [14,106-14,107]), + data: TreeData { + range: 535..536, + location: [14,106-14,107], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(72), + head_node: NodeIndex(87), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 561..591, + location: [15,24-15,54], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(72), + head_node: NodeIndex(73), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GlossSeeAlso\\\"\"" [15,24-15,38]), + data: TreeData { + range: 561..575, + location: [15,24-15,38], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(73), + head_node: NodeIndex(74), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [15,38-15,39]), + data: TreeData { + range: 575..576, + location: [15,38-15,39], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(74), + head_node: NodeIndex(86), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: Array, + data: TreeData { + range: 577..591, + location: [15,40-15,54], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(74), + head_node: NodeIndex(85), + possibilities: RefCell { + value: [ + NonTerm { + prod: Array: OBracket Value0 CBracket, + data: TreeData { + range: 577..591, + location: [15,40-15,54], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(74), + head_node: NodeIndex(75), + possibilities: RefCell { + value: [ + Term { + token: OBracket("\"[\"" [15,40-15,41]), + data: TreeData { + range: 577..578, + location: [15,40-15,41], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(75), + head_node: NodeIndex(83), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value0: Value1, + data: TreeData { + range: 578..590, + location: [15,41-15,53], + layout: None, + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(75), + head_node: NodeIndex(82), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value1: Value1 Comma Value, + data: TreeData { + range: 578..590, + location: [15,41-15,53], + layout: None, + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(75), + head_node: NodeIndex(78), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value1: Value, + data: TreeData { + range: 578..583, + location: [15,41-15,46], + layout: None, + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(75), + head_node: NodeIndex(77), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 578..583, + location: [15,41-15,46], + layout: None, + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(75), + head_node: NodeIndex(76), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GML\\\"\"" [15,41-15,46]), + data: TreeData { + range: 578..583, + location: [15,41-15,46], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(78), + head_node: NodeIndex(79), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [15,46-15,47]), + data: TreeData { + range: 583..584, + location: [15,46-15,47], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(79), + head_node: NodeIndex(81), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 585..590, + location: [15,48-15,53], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(79), + head_node: NodeIndex(80), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"XML\\\"\"" [15,48-15,53]), + data: TreeData { + range: 585..590, + location: [15,48-15,53], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(83), + head_node: NodeIndex(84), + possibilities: RefCell { + value: [ + Term { + token: CBracket("\"]\"" [15,53-15,54]), + data: TreeData { + range: 590..591, + location: [15,53-15,54], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(89), + head_node: NodeIndex(90), + possibilities: RefCell { + value: [ + Term { + token: CBrace("\"}\"" [16,20-16,21]), + data: TreeData { + range: 612..613, + location: [16,20-16,21], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(94), + head_node: NodeIndex(95), + possibilities: RefCell { + value: [ + Term { + token: Comma("\",\"" [16,21-16,22]), + data: TreeData { + range: 613..614, + location: [16,21-16,22], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(95), + head_node: NodeIndex(100), + possibilities: RefCell { + value: [ + NonTerm { + prod: Member: JsonString Colon Value, + data: TreeData { + range: 635..655, + location: [17,20-17,40], + layout: Some( + "\n ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(95), + head_node: NodeIndex(96), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"GlossSee\\\"\"" [17,20-17,30]), + data: TreeData { + range: 635..645, + location: [17,20-17,30], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(96), + head_node: NodeIndex(97), + possibilities: RefCell { + value: [ + Term { + token: Colon("\":\"" [17,30-17,31]), + data: TreeData { + range: 645..646, + location: [17,30-17,31], + layout: None, + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(97), + head_node: NodeIndex(99), + possibilities: RefCell { + value: [ + NonTerm { + prod: Value: JsonString, + data: TreeData { + range: 647..655, + location: [17,32-17,40], + layout: Some( + " ", + ), + }, + children: RefCell { + value: [ + Parent { + root_node: NodeIndex(97), + head_node: NodeIndex(98), + possibilities: RefCell { + value: [ + Term { + token: JsonString("\"\\\"markup\\\"\"" [17,32-17,40]), + data: TreeData { + range: 647..655, + location: [17,32-17,40], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(102), + head_node: NodeIndex(103), + possibilities: RefCell { + value: [ + Term { + token: CBrace("\"}\"" [18,16-18,17]), + data: TreeData { + range: 672..673, + location: [18,16-18,17], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(108), + head_node: NodeIndex(109), + possibilities: RefCell { + value: [ + Term { + token: CBrace("\"}\"" [19,12-19,13]), + data: TreeData { + range: 686..687, + location: [19,12-19,13], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(114), + head_node: NodeIndex(115), + possibilities: RefCell { + value: [ + Term { + token: CBrace("\"}\"" [20,8-20,9]), + data: TreeData { + range: 696..697, + location: [20,8-20,9], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(120), + head_node: NodeIndex(121), + possibilities: RefCell { + value: [ + Term { + token: CBrace("\"}\"" [21,4-21,5]), + data: TreeData { + range: 702..703, + location: [21,4-21,5], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + Parent { + root_node: NodeIndex(126), + head_node: NodeIndex(127), + possibilities: RefCell { + value: [ + Term { + token: CBrace("\"}\"" [22,0-22,1]), + data: TreeData { + range: 704..705, + location: [22,0-22,1], + layout: None, + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], + }, + }, + ], +} \ No newline at end of file diff --git a/tests/src/glr/build/loc_info/mod.rs b/tests/src/glr/build/loc_info/mod.rs new file mode 100644 index 00000000..32de4353 --- /dev/null +++ b/tests/src/glr/build/loc_info/mod.rs @@ -0,0 +1,32 @@ +use serial_test::serial; +use rustemo::{rustemo_mod, Parser}; +use rustemo_compiler::{local_file, output_cmp}; + +use self::json::JsonParser; + +rustemo_mod!(json, "/src/glr/build/loc_info"); +rustemo_mod!(json_actions, "/src/glr/build/loc_info"); + +#[test] +#[serial(loc_info)] +fn glr_loc_info() { + let mut parser = JsonParser::new(); + let forest = parser + // Using the same input file from LR test. + .parse_file(local_file!(file!(), "../../../builder/loc_info/loc_info.json")) + .unwrap(); + + output_cmp!( + "src/glr/build/loc_info/loc_info_forest.ast", + format!("{:#?}", forest) + ); + + let mut builder = self::json::DefaultBuilder::new(); + let result = forest.get_first_tree().unwrap().build(&mut builder); + + output_cmp!( + // Using the same AST output from LR parser test as we expect the same result. + "src/builder/loc_info/loc_info.ast", + format!("{:#?}", result) + ); +} diff --git a/tests/src/glr/build/mod.rs b/tests/src/glr/build/mod.rs index 47628422..022eb0b3 100644 --- a/tests/src/glr/build/mod.rs +++ b/tests/src/glr/build/mod.rs @@ -1,72 +1,2 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; -use rustemo_compiler::output_cmp; - -rustemo_mod!(calc, "/src/glr/build"); -rustemo_mod!(calc_actions, "/src/glr/build"); - -use self::calc::CalcParser; - -// ANCHOR: build -#[test] -fn glr_tree_build_default() { - let forest = CalcParser::new().parse("1 + 4 * 9").unwrap(); - assert_eq!(forest.solutions(), 2); - - let mut builder = calc::DefaultBuilder::new(); - output_cmp!( - "src/glr/build/tree_build_default_1.ast", - format!( - "{:#?}", - forest.get_first_tree().unwrap().build(&mut builder) - ) - ); - output_cmp!( - "src/glr/build/tree_build_default_2.ast", - format!("{:#?}", forest.get_tree(1).unwrap().build(&mut builder)) - ); -} -// ANCHOR_END: build - -#[test] -fn glr_tree_build_generic() { - let forest = CalcParser::new().parse("1 + 4 * 9").unwrap(); - assert_eq!(forest.solutions(), 2); - - let mut builder = TreeBuilder::new(); - output_cmp!( - "src/glr/build/tree_build_generic_1.ast", - format!( - "{:#?}", - forest.get_first_tree().unwrap().build::, GssHead< - '_, - str, - calc::State, - calc::TokenKind, - >, calc::State>( - &mut builder - ) - ) - ); - output_cmp!( - "src/glr/build/tree_build_generic_2.ast", - format!( - "{:#?}", - forest.get_tree(1).unwrap().build::, GssHead< - '_, - str, - calc::State, - calc::TokenKind, - >, calc::State>(&mut builder) - ) - ); -} +mod basic; +mod loc_info; diff --git a/tests/src/glr/errors/calc_incomplete.error b/tests/src/glr/errors/calc_incomplete.err similarity index 86% rename from tests/src/glr/errors/calc_incomplete.error rename to tests/src/glr/errors/calc_incomplete.err index b8b6334c..7109873c 100644 --- a/tests/src/glr/errors/calc_incomplete.error +++ b/tests/src/glr/errors/calc_incomplete.err @@ -4,6 +4,6 @@ Error { "", ), location: Some( - [1,19], + [1,9-1,10], ), } \ No newline at end of file diff --git a/tests/src/glr/errors/calc_missing.error b/tests/src/glr/errors/calc_missing.err similarity index 90% rename from tests/src/glr/errors/calc_missing.error rename to tests/src/glr/errors/calc_missing.err index 2117678d..a3eda5fe 100644 --- a/tests/src/glr/errors/calc_missing.error +++ b/tests/src/glr/errors/calc_missing.err @@ -4,6 +4,6 @@ Error { "", ), location: Some( - [1,10], + [1,5], ), } \ No newline at end of file diff --git a/tests/src/glr/errors/calc_unexpected.error b/tests/src/glr/errors/calc_unexpected.err similarity index 90% rename from tests/src/glr/errors/calc_unexpected.error rename to tests/src/glr/errors/calc_unexpected.err index 17012542..a7af9026 100644 --- a/tests/src/glr/errors/calc_unexpected.error +++ b/tests/src/glr/errors/calc_unexpected.err @@ -4,6 +4,6 @@ Error { "", ), location: Some( - [1,10], + [1,5], ), } \ No newline at end of file diff --git a/tests/src/glr/errors/mod.rs b/tests/src/glr/errors/mod.rs index a9062a4c..99660ef2 100644 --- a/tests/src/glr/errors/mod.rs +++ b/tests/src/glr/errors/mod.rs @@ -10,7 +10,7 @@ fn glr_syntax_error_unexpected() { let input = "1 + 4 * 9 ! 3 * 2 + 7"; let result = CalcParser::new().parse(input); output_cmp!( - "src/glr/errors/calc_unexpected.error", + "src/glr/errors/calc_unexpected.err", format!("{:#?}", result.unwrap_err()) ); } @@ -20,7 +20,7 @@ fn glr_syntax_error_missing() { let input = "1 + 4 * 9 3 * 2 + 7"; let result = CalcParser::new().parse(input); output_cmp!( - "src/glr/errors/calc_missing.error", + "src/glr/errors/calc_missing.err", format!("{:#?}", result.unwrap_err()) ); } @@ -30,7 +30,7 @@ fn glr_syntax_error_incomplete() { let input = "1 + 4 * 9 + 3 * 2 +"; let result = CalcParser::new().parse(input); output_cmp!( - "src/glr/errors/calc_incomplete.error", + "src/glr/errors/calc_incomplete.err", format!("{:#?}", result.unwrap_err()) ); } diff --git a/tests/src/glr/forest/calc.ast b/tests/src/glr/forest/calc.ast index bc1826f5..2bb1cc9f 100644 --- a/tests/src/glr/forest/calc.ast +++ b/tests/src/glr/forest/calc.ast @@ -5,7 +5,9 @@ Forest { data: TreeData { range: 0..17, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -19,7 +21,9 @@ Forest { data: TreeData { range: 0..13, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -33,7 +37,9 @@ Forest { data: TreeData { range: 0..9, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -47,7 +53,9 @@ Forest { data: TreeData { range: 0..5, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -61,7 +69,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -73,8 +83,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -93,10 +103,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -125,10 +135,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -153,10 +163,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -185,10 +195,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -209,7 +219,9 @@ Forest { data: TreeData { range: 0..9, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -223,7 +235,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -235,8 +249,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -255,10 +269,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -303,10 +317,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -325,10 +339,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -357,10 +371,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -391,10 +405,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -423,10 +437,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -447,7 +461,9 @@ Forest { data: TreeData { range: 0..13, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -461,7 +477,9 @@ Forest { data: TreeData { range: 0..5, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -475,7 +493,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -487,8 +507,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -507,10 +527,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -539,10 +559,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -567,10 +587,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -615,10 +635,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -637,10 +657,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -669,10 +689,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -699,7 +719,9 @@ Forest { data: TreeData { range: 0..13, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -713,7 +735,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -725,8 +749,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -745,10 +769,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -809,10 +833,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -831,10 +855,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -863,10 +887,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -891,10 +915,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -923,10 +947,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -975,10 +999,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -997,10 +1021,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -1045,10 +1069,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -1067,10 +1091,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -1099,10 +1123,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -1139,10 +1163,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -1171,10 +1195,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, @@ -1195,7 +1219,9 @@ Forest { data: TreeData { range: 0..17, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -1209,7 +1235,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -1221,8 +1249,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -1241,10 +1269,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -1321,10 +1349,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -1343,10 +1371,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -1375,10 +1403,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -1403,10 +1431,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -1435,10 +1463,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -1487,10 +1515,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -1509,10 +1537,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -1557,10 +1585,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -1579,10 +1607,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -1611,10 +1639,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -1645,10 +1673,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -1677,10 +1705,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, @@ -1745,10 +1773,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -1767,10 +1795,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -1799,10 +1827,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -1827,10 +1855,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -1875,10 +1903,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -1897,10 +1925,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -1929,10 +1957,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, @@ -1987,10 +2015,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -2009,10 +2037,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -2073,10 +2101,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -2095,10 +2123,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -2127,10 +2155,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -2155,10 +2183,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -2187,10 +2215,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, @@ -2239,10 +2267,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -2261,10 +2289,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -2309,10 +2337,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -2331,10 +2359,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -2363,10 +2391,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, @@ -2405,7 +2433,9 @@ Forest { data: TreeData { range: 0..17, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2419,7 +2449,9 @@ Forest { data: TreeData { range: 0..9, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2433,7 +2465,9 @@ Forest { data: TreeData { range: 0..5, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2447,7 +2481,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2459,8 +2495,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -2479,10 +2515,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -2511,10 +2547,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -2539,10 +2575,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -2571,10 +2607,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -2595,7 +2631,9 @@ Forest { data: TreeData { range: 0..9, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2609,7 +2647,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2621,8 +2661,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -2641,10 +2681,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -2689,10 +2729,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -2711,10 +2751,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -2743,10 +2783,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -2777,10 +2817,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -2825,10 +2865,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -2847,10 +2887,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -2879,10 +2919,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, @@ -2909,7 +2949,9 @@ Forest { data: TreeData { range: 0..17, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2923,7 +2965,9 @@ Forest { data: TreeData { range: 0..5, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2937,7 +2981,9 @@ Forest { data: TreeData { range: 0..1, location: [1,0-0], - layout: None, + layout: Some( + "1", + ), }, children: RefCell { value: [ @@ -2949,8 +2995,8 @@ Forest { Term { token: Num("\"1\"" [1,0-1,1]), data: TreeData { - range: 0..0, - location: [0], + range: 0..1, + location: [1,0-1,1], layout: None, }, }, @@ -2969,10 +3015,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,2-1,3]), + token: Plus("\"+\"" [1,1-1,2]), data: TreeData { - range: 0..0, - location: [0], + range: 2..3, + location: [1,1-1,2], layout: None, }, }, @@ -3001,10 +3047,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"4\"" [1,4-1,5]), + token: Num("\"4\"" [1,2-1,3]), data: TreeData { - range: 0..0, - location: [0], + range: 4..5, + location: [1,2-1,3], layout: None, }, }, @@ -3029,10 +3075,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,6-1,7]), + token: Mul("\"*\"" [1,3-1,4]), data: TreeData { - range: 0..0, - location: [0], + range: 6..7, + location: [1,3-1,4], layout: None, }, }, @@ -3093,10 +3139,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -3115,10 +3161,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -3147,10 +3193,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -3175,10 +3221,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -3207,10 +3253,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, @@ -3259,10 +3305,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"9\"" [1,8-1,9]), + token: Num("\"9\"" [1,4-1,5]), data: TreeData { - range: 0..0, - location: [0], + range: 8..9, + location: [1,4-1,5], layout: None, }, }, @@ -3281,10 +3327,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Plus("\"+\"" [1,10-1,11]), + token: Plus("\"+\"" [1,5-1,6]), data: TreeData { - range: 0..0, - location: [0], + range: 10..11, + location: [1,5-1,6], layout: None, }, }, @@ -3329,10 +3375,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"3\"" [1,12-1,13]), + token: Num("\"3\"" [1,6-1,7]), data: TreeData { - range: 0..0, - location: [0], + range: 12..13, + location: [1,6-1,7], layout: None, }, }, @@ -3351,10 +3397,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Mul("\"*\"" [1,14-1,15]), + token: Mul("\"*\"" [1,7-1,8]), data: TreeData { - range: 0..0, - location: [0], + range: 14..15, + location: [1,7-1,8], layout: None, }, }, @@ -3383,10 +3429,10 @@ Forest { possibilities: RefCell { value: [ Term { - token: Num("\"2\"" [1,16-1,17]), + token: Num("\"2\"" [1,8-1,9]), data: TreeData { - range: 0..0, - location: [0], + range: 16..17, + location: [1,8-1,9], layout: None, }, }, diff --git a/tests/src/glr/lexical_ambiguity/most_specific_off/mod.rs b/tests/src/glr/lexical_ambiguity/most_specific_off/mod.rs index ca75f95d..850a3573 100644 --- a/tests/src/glr/lexical_ambiguity/most_specific_off/mod.rs +++ b/tests/src/glr/lexical_ambiguity/most_specific_off/mod.rs @@ -1,20 +1,25 @@ use rustemo::{rustemo_mod, Parser}; use rustemo_compiler::output_cmp; -rustemo_mod!(most_specific, "/src/lexical_ambiguity/most_specific_off"); +rustemo_mod!(most_specific, "/src/glr/lexical_ambiguity/most_specific_off"); rustemo_mod!( most_specific_actions, - "/src/lexical_ambiguity/most_specific_off" + "/src/glr/lexical_ambiguity/most_specific_off" ); use self::most_specific::MostSpecificParser; #[test] -fn lr_lexical_ambiguity_most_specific_off() { - let result = MostSpecificParser::new().parse("s a 42.42").unwrap(); +fn glr_lexical_ambiguity_most_specific_off() { + let forest = MostSpecificParser::new().parse("s a 42.42").unwrap(); + assert_eq!(forest.solutions(), 2); + let mut trees = String::new(); + for tree in &forest { + trees.push_str(&format!("{tree:#?}\n\n")); + } output_cmp!( - "src/lexical_ambiguity/most_specific_off/most_specific.ast", - format!("{result:?}") + "src/glr/lexical_ambiguity/most_specific_off/most_specific.ast", + format!("{trees}") ); } diff --git a/tests/src/glr/special/bounded_ambiguity/mod.rs b/tests/src/glr/special/bounded_ambiguity/mod.rs index afa231f5..f40690f2 100644 --- a/tests/src/glr/special/bounded_ambiguity/mod.rs +++ b/tests/src/glr/special/bounded_ambiguity/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/bounded_ambiguity"); @@ -17,14 +17,10 @@ fn glr_special_bounded_ambiguity() { &format!("src/glr/special/bounded_ambiguity/tree_{}.ast", i), format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); }); diff --git a/tests/src/glr/special/bounded_ambiguity/tree_1.ast b/tests/src/glr/special/bounded_ambiguity/tree_1.ast index da3f60dd..e02e5d5f 100644 --- a/tests/src/glr/special/bounded_ambiguity/tree_1.ast +++ b/tests/src/glr/special/bounded_ambiguity/tree_1.ast @@ -1,40 +1,40 @@ NonTermNode { prod: S: M, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -44,21 +44,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/bounded_ambiguity/tree_2.ast b/tests/src/glr/special/bounded_ambiguity/tree_2.ast index 6da53517..0c9d14c2 100644 --- a/tests/src/glr/special/bounded_ambiguity/tree_2.ast +++ b/tests/src/glr/special/bounded_ambiguity/tree_2.ast @@ -1,40 +1,40 @@ NonTermNode { prod: S: N, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: N: A N Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: N: A N Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: N: A N Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: N: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -44,21 +44,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/bounded_direct_ambiguity/mod.rs b/tests/src/glr/special/bounded_direct_ambiguity/mod.rs index 10589549..64d2b09d 100644 --- a/tests/src/glr/special/bounded_direct_ambiguity/mod.rs +++ b/tests/src/glr/special/bounded_direct_ambiguity/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/bounded_direct_ambiguity"); @@ -17,14 +17,10 @@ fn glr_special_bounded_direct_ambiguity() { &format!("src/glr/special/bounded_direct_ambiguity/tree_{}.ast", i), format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); }); diff --git a/tests/src/glr/special/bounded_direct_ambiguity/tree_1.ast b/tests/src/glr/special/bounded_direct_ambiguity/tree_1.ast index a87f34d3..08ad115c 100644 --- a/tests/src/glr/special/bounded_direct_ambiguity/tree_1.ast +++ b/tests/src/glr/special/bounded_direct_ambiguity/tree_1.ast @@ -1,10 +1,10 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: Tt, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tt("\"t\"" [1,0-1,1]), @@ -15,85 +15,85 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,1-1,2]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,5-1,6]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,6-1,7]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/bounded_direct_ambiguity/tree_2.ast b/tests/src/glr/special/bounded_direct_ambiguity/tree_2.ast index f4555432..3d3ab089 100644 --- a/tests/src/glr/special/bounded_direct_ambiguity/tree_2.ast +++ b/tests/src/glr/special/bounded_direct_ambiguity/tree_2.ast @@ -1,30 +1,30 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: Tt, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tt("\"t\"" [1,0-1,1]), @@ -35,65 +35,65 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,1-1,2]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,5-1,6]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,6-1,7]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/bounded_direct_ambiguity/tree_3.ast b/tests/src/glr/special/bounded_direct_ambiguity/tree_3.ast index 2893e0b3..af2845ce 100644 --- a/tests/src/glr/special/bounded_direct_ambiguity/tree_3.ast +++ b/tests/src/glr/special/bounded_direct_ambiguity/tree_3.ast @@ -1,50 +1,50 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: Tt, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tt("\"t\"" [1,0-1,1]), @@ -55,45 +55,45 @@ NonTermNode { }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,1-1,2]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,5-1,6]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,6-1,7]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/bounded_direct_ambiguity/tree_4.ast b/tests/src/glr/special/bounded_direct_ambiguity/tree_4.ast index 4374fe08..faae0795 100644 --- a/tests/src/glr/special/bounded_direct_ambiguity/tree_4.ast +++ b/tests/src/glr/special/bounded_direct_ambiguity/tree_4.ast @@ -1,40 +1,40 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: Tt, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tt("\"t\"" [1,0-1,1]), @@ -45,55 +45,55 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,1-1,2]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,5-1,6]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,6-1,7]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/bounded_direct_ambiguity/tree_5.ast b/tests/src/glr/special/bounded_direct_ambiguity/tree_5.ast index 75ea9cac..c7e5a07f 100644 --- a/tests/src/glr/special/bounded_direct_ambiguity/tree_5.ast +++ b/tests/src/glr/special/bounded_direct_ambiguity/tree_5.ast @@ -1,20 +1,20 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: Tt, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tt("\"t\"" [1,0-1,1]), @@ -25,75 +25,75 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,1-1,2]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,5-1,6]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,6-1,7]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g7/mod.rs b/tests/src/glr/special/farshi_g7/mod.rs index d35d9d35..1ee077d4 100644 --- a/tests/src/glr/special/farshi_g7/mod.rs +++ b/tests/src/glr/special/farshi_g7/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/farshi_g7"); @@ -20,14 +20,10 @@ fn glr_special_farshi_g7() { "src/glr/special/farshi_g7/tree.ast", format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); } diff --git a/tests/src/glr/special/farshi_g7/tree.ast b/tests/src/glr/special/farshi_g7/tree.ast index ad3b7ac1..2ca71f86 100644 --- a/tests/src/glr/special/farshi_g7/tree.ast +++ b/tests/src/glr/special/farshi_g7/tree.ast @@ -1,6 +1,6 @@ NonTermNode { prod: S: Ta S Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Ta("\"a\"" [1,0-1,1]), @@ -8,22 +8,22 @@ NonTermNode { }, NonTermNode { prod: S: Ta S Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Ta("\"a\"" [1,1-1,2]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: S: C S Tc, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: C: Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Ta("\"a\"" [1,2-1,3]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], @@ -31,30 +31,30 @@ NonTermNode { }, NonTermNode { prod: S: Ta S Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Ta("\"a\"" [1,3-1,4]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: S: Ta S Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Ta("\"a\"" [1,4-1,5]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: S: C S Tc, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: C: Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Ta("\"a\"" [1,5-1,6]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], @@ -62,14 +62,14 @@ NonTermNode { }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Ta("\"a\"" [1,6-1,7]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], @@ -77,14 +77,14 @@ NonTermNode { }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: Ta, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Ta("\"a\"" [1,7-1,8]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], @@ -92,66 +92,66 @@ NonTermNode { }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,8-1,9]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,9-1,10]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,10-1,11]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tc("\"c\"" [1,11-1,12]), + token: Tc("\"c\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Ta("\"a\"" [1,12-1,13]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Ta("\"a\"" [1,13-1,14]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tc("\"c\"" [1,14-1,15]), + token: Tc("\"c\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Ta("\"a\"" [1,15-1,16]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Ta("\"a\"" [1,16-1,17]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/mod.rs b/tests/src/glr/special/farshi_g8/mod.rs index 3ac54684..169027df 100644 --- a/tests/src/glr/special/farshi_g8/mod.rs +++ b/tests/src/glr/special/farshi_g8/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/farshi_g8"); @@ -17,14 +17,10 @@ fn glr_special_farshi_g8() { &format!("src/glr/special/farshi_g8/tree_{}.ast", i), format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); }); diff --git a/tests/src/glr/special/farshi_g8/tree_1.ast b/tests/src/glr/special/farshi_g8/tree_1.ast index 6d98294c..54916c24 100644 --- a/tests/src/glr/special/farshi_g8/tree_1.ast +++ b/tests/src/glr/special/farshi_g8/tree_1.ast @@ -1,20 +1,20 @@ NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -23,21 +23,21 @@ NonTermNode { }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -46,21 +46,21 @@ NonTermNode { }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -69,7 +69,7 @@ NonTermNode { }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -79,21 +79,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/tree_2.ast b/tests/src/glr/special/farshi_g8/tree_2.ast index a7845d78..061f89fd 100644 --- a/tests/src/glr/special/farshi_g8/tree_2.ast +++ b/tests/src/glr/special/farshi_g8/tree_2.ast @@ -1,20 +1,20 @@ NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -23,21 +23,21 @@ NonTermNode { }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -46,17 +46,17 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -66,21 +66,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/tree_3.ast b/tests/src/glr/special/farshi_g8/tree_3.ast index d5fe54c9..bd19a736 100644 --- a/tests/src/glr/special/farshi_g8/tree_3.ast +++ b/tests/src/glr/special/farshi_g8/tree_3.ast @@ -1,20 +1,20 @@ NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -23,31 +23,31 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -56,7 +56,7 @@ NonTermNode { }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -66,21 +66,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/tree_4.ast b/tests/src/glr/special/farshi_g8/tree_4.ast index b9609053..2c7cc701 100644 --- a/tests/src/glr/special/farshi_g8/tree_4.ast +++ b/tests/src/glr/special/farshi_g8/tree_4.ast @@ -1,20 +1,20 @@ NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -23,27 +23,27 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -53,21 +53,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/tree_5.ast b/tests/src/glr/special/farshi_g8/tree_5.ast index 1ba02bb7..fd4220dc 100644 --- a/tests/src/glr/special/farshi_g8/tree_5.ast +++ b/tests/src/glr/special/farshi_g8/tree_5.ast @@ -1,30 +1,30 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -33,21 +33,21 @@ NonTermNode { }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -56,7 +56,7 @@ NonTermNode { }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -66,21 +66,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/tree_6.ast b/tests/src/glr/special/farshi_g8/tree_6.ast index 5a2443b8..05eb8c65 100644 --- a/tests/src/glr/special/farshi_g8/tree_6.ast +++ b/tests/src/glr/special/farshi_g8/tree_6.ast @@ -1,30 +1,30 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -33,17 +33,17 @@ NonTermNode { }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -53,21 +53,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/tree_7.ast b/tests/src/glr/special/farshi_g8/tree_7.ast index b0907e69..ec30d70b 100644 --- a/tests/src/glr/special/farshi_g8/tree_7.ast +++ b/tests/src/glr/special/farshi_g8/tree_7.ast @@ -1,40 +1,40 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: B: A A, - location: [1,0], + location: [1,0-1,0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, @@ -43,7 +43,7 @@ NonTermNode { }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -53,21 +53,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/farshi_g8/tree_8.ast b/tests/src/glr/special/farshi_g8/tree_8.ast index 1839d709..89e500dd 100644 --- a/tests/src/glr/special/farshi_g8/tree_8.ast +++ b/tests/src/glr/special/farshi_g8/tree_8.ast @@ -1,36 +1,36 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -40,21 +40,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/mod.rs b/tests/src/glr/special/highly_ambiguous/mod.rs index 7d79960d..af1572cf 100644 --- a/tests/src/glr/special/highly_ambiguous/mod.rs +++ b/tests/src/glr/special/highly_ambiguous/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/highly_ambiguous"); @@ -20,14 +20,10 @@ fn glr_special_highly_ambiguous() { &format!("src/glr/special/highly_ambiguous/tree_{}.ast", i), format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); }); diff --git a/tests/src/glr/special/highly_ambiguous/tree_1.ast b/tests/src/glr/special/highly_ambiguous/tree_1.ast index 351e2e9d..42f64316 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_1.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_1.ast @@ -1,10 +1,10 @@ NonTermNode { prod: S: S S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -15,14 +15,14 @@ NonTermNode { }, NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -30,10 +30,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -44,10 +44,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_10.ast b/tests/src/glr/special/highly_ambiguous/tree_10.ast index bd239a79..541c0d4f 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_10.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_10.ast @@ -1,14 +1,14 @@ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -19,10 +19,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -33,14 +33,14 @@ NonTermNode { }, NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -48,10 +48,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_2.ast b/tests/src/glr/special/highly_ambiguous/tree_2.ast index 3ce18387..554a8db9 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_2.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_2.ast @@ -1,14 +1,14 @@ NonTermNode { prod: S: S S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -19,10 +19,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -33,10 +33,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -44,10 +44,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_3.ast b/tests/src/glr/special/highly_ambiguous/tree_3.ast index c77e11db..6a418031 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_3.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_3.ast @@ -1,14 +1,14 @@ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: S S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -19,10 +19,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -30,10 +30,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -44,10 +44,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_4.ast b/tests/src/glr/special/highly_ambiguous/tree_4.ast index 9d80ad5f..fb809ba7 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_4.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_4.ast @@ -1,18 +1,18 @@ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -23,10 +23,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -37,10 +37,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -51,10 +51,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_5.ast b/tests/src/glr/special/highly_ambiguous/tree_5.ast index c6c2481a..b95396b0 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_5.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_5.ast @@ -1,14 +1,14 @@ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -19,14 +19,14 @@ NonTermNode { }, NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -34,10 +34,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -51,10 +51,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_6.ast b/tests/src/glr/special/highly_ambiguous/tree_6.ast index 1f44bcf6..d32868ac 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_6.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_6.ast @@ -1,10 +1,10 @@ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -15,14 +15,14 @@ NonTermNode { }, NonTermNode { prod: S: S S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -30,10 +30,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -41,10 +41,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_7.ast b/tests/src/glr/special/highly_ambiguous/tree_7.ast index ec3cb24d..b6b83213 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_7.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_7.ast @@ -1,10 +1,10 @@ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -15,18 +15,18 @@ NonTermNode { }, NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -34,10 +34,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -48,10 +48,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_8.ast b/tests/src/glr/special/highly_ambiguous/tree_8.ast index 3239dbca..c46afad8 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_8.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_8.ast @@ -1,10 +1,10 @@ NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -15,14 +15,14 @@ NonTermNode { }, NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -30,14 +30,14 @@ NonTermNode { }, NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -45,10 +45,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/highly_ambiguous/tree_9.ast b/tests/src/glr/special/highly_ambiguous/tree_9.ast index 6ef2d8fe..635fb866 100644 --- a/tests/src/glr/special/highly_ambiguous/tree_9.ast +++ b/tests/src/glr/special/highly_ambiguous/tree_9.ast @@ -1,10 +1,10 @@ NonTermNode { prod: S: S S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tb("\"b\"" [1,0-1,1]), @@ -15,10 +15,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -26,14 +26,14 @@ NonTermNode { }, NonTermNode { prod: S: S S, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -41,10 +41,10 @@ NonTermNode { }, NonTermNode { prod: S: Tb, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/reduce_enough_empty/mod.rs b/tests/src/glr/special/reduce_enough_empty/mod.rs index 7532b5dd..c0923607 100644 --- a/tests/src/glr/special/reduce_enough_empty/mod.rs +++ b/tests/src/glr/special/reduce_enough_empty/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/reduce_enough_empty"); @@ -16,14 +16,10 @@ fn glr_special_reduce_enough_empty() { "src/glr/special/reduce_enough_empty/tree.ast", format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); } diff --git a/tests/src/glr/special/reduce_enough_empty/tree.ast b/tests/src/glr/special/reduce_enough_empty/tree.ast index 1839d709..89e500dd 100644 --- a/tests/src/glr/special/reduce_enough_empty/tree.ast +++ b/tests/src/glr/special/reduce_enough_empty/tree.ast @@ -1,36 +1,36 @@ NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -40,21 +40,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/reduce_enough_many_empty/mod.rs b/tests/src/glr/special/reduce_enough_many_empty/mod.rs index e15fb8ff..a3a879a9 100644 --- a/tests/src/glr/special/reduce_enough_many_empty/mod.rs +++ b/tests/src/glr/special/reduce_enough_many_empty/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/reduce_enough_many_empty"); @@ -16,14 +16,10 @@ fn glr_special_reduce_enough_many_empty() { "src/glr/special/reduce_enough_many_empty/tree.ast", format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); } diff --git a/tests/src/glr/special/reduce_enough_many_empty/tree.ast b/tests/src/glr/special/reduce_enough_many_empty/tree.ast index 28df41bd..f34beac1 100644 --- a/tests/src/glr/special/reduce_enough_many_empty/tree.ast +++ b/tests/src/glr/special/reduce_enough_many_empty/tree.ast @@ -1,54 +1,54 @@ NonTermNode { prod: S: A B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: B: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: B: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: A B S Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: B: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: S: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -58,21 +58,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/right_nullable/mod.rs b/tests/src/glr/special/right_nullable/mod.rs index 0f790520..f11af80f 100644 --- a/tests/src/glr/special/right_nullable/mod.rs +++ b/tests/src/glr/special/right_nullable/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/right_nullable"); @@ -16,14 +16,10 @@ fn glr_special_right_nullable_g2() { &format!("src/glr/special/right_nullable/tree_{}.ast", i), format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); }) diff --git a/tests/src/glr/special/right_nullable/tree_1.ast b/tests/src/glr/special/right_nullable/tree_1.ast index 08af5e28..134f3a0a 100644 --- a/tests/src/glr/special/right_nullable/tree_1.ast +++ b/tests/src/glr/special/right_nullable/tree_1.ast @@ -1,6 +1,6 @@ NonTermNode { prod: S: Ta S A, - location: [1,0], + location: [0-0], children: [ TermNode { token: Ta("\"a\"" [1,0-1,1]), @@ -8,19 +8,19 @@ NonTermNode { }, NonTermNode { prod: S: Ta S A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Ta("\"a\"" [1,1-1,2]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: S: A, - location: [1,0], + location: [0-0], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -29,7 +29,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -38,7 +38,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, diff --git a/tests/src/glr/special/right_nullable/tree_2.ast b/tests/src/glr/special/right_nullable/tree_2.ast index 0d35d21a..3d05225b 100644 --- a/tests/src/glr/special/right_nullable/tree_2.ast +++ b/tests/src/glr/special/right_nullable/tree_2.ast @@ -1,6 +1,6 @@ NonTermNode { prod: S: Ta S A, - location: [1,0], + location: [0-0], children: [ TermNode { token: Ta("\"a\"" [1,0-1,1]), @@ -8,21 +8,21 @@ NonTermNode { }, NonTermNode { prod: S: Ta S A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Ta("\"a\"" [1,1-1,2]), + token: Ta("\"a\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: S: , - location: [1,0], + location: [0-0], children: [], layout: None, }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -31,7 +31,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, diff --git a/tests/src/glr/special/unbounded_ambiguity/mod.rs b/tests/src/glr/special/unbounded_ambiguity/mod.rs index da3f9aab..8cc66686 100644 --- a/tests/src/glr/special/unbounded_ambiguity/mod.rs +++ b/tests/src/glr/special/unbounded_ambiguity/mod.rs @@ -1,4 +1,4 @@ -use rustemo::{rustemo_mod, GssHead, Parser, TreeBuilder}; +use rustemo::{rustemo_mod, Parser, TreeBuilder}; use rustemo_compiler::output_cmp; rustemo_mod!(lang, "/src/glr/special/unbounded_ambiguity"); @@ -17,14 +17,10 @@ fn glr_special_unbounded_ambiguity() { &format!("src/glr/special/unbounded_ambiguity/tree_{}.ast", i), format!( "{:#?}", - tree.unwrap().build::, GssHead<'_, str, lang::State, lang::TokenKind>, lang::State>( - &mut builder - ) + tree.unwrap() + .build::, lang::State>( + &mut builder + ) ) ); }); diff --git a/tests/src/glr/special/unbounded_ambiguity/tree_1.ast b/tests/src/glr/special/unbounded_ambiguity/tree_1.ast index a42ce947..80e74fe1 100644 --- a/tests/src/glr/special/unbounded_ambiguity/tree_1.ast +++ b/tests/src/glr/special/unbounded_ambiguity/tree_1.ast @@ -1,50 +1,50 @@ NonTermNode { prod: S: M N, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -54,28 +54,28 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -83,10 +83,10 @@ NonTermNode { }, NonTermNode { prod: N: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,5-1,6]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], diff --git a/tests/src/glr/special/unbounded_ambiguity/tree_2.ast b/tests/src/glr/special/unbounded_ambiguity/tree_2.ast index 3e2517da..b66f2a53 100644 --- a/tests/src/glr/special/unbounded_ambiguity/tree_2.ast +++ b/tests/src/glr/special/unbounded_ambiguity/tree_2.ast @@ -1,40 +1,40 @@ NonTermNode { prod: S: M N, - location: [1,0], + location: [0-0], children: [ NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -44,21 +44,21 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -66,18 +66,18 @@ NonTermNode { }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,5-1,6]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], @@ -85,7 +85,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, diff --git a/tests/src/glr/special/unbounded_ambiguity/tree_3.ast b/tests/src/glr/special/unbounded_ambiguity/tree_3.ast index d8f6223b..d8c1aab3 100644 --- a/tests/src/glr/special/unbounded_ambiguity/tree_3.ast +++ b/tests/src/glr/special/unbounded_ambiguity/tree_3.ast @@ -1,30 +1,30 @@ NonTermNode { prod: S: M N, - location: [1,0], + location: [0-0], children: [ NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -34,14 +34,14 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], layout: None, }, TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -49,26 +49,26 @@ NonTermNode { }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,5-1,6]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], @@ -76,7 +76,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -85,7 +85,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, diff --git a/tests/src/glr/special/unbounded_ambiguity/tree_4.ast b/tests/src/glr/special/unbounded_ambiguity/tree_4.ast index d6fb465f..45ed571d 100644 --- a/tests/src/glr/special/unbounded_ambiguity/tree_4.ast +++ b/tests/src/glr/special/unbounded_ambiguity/tree_4.ast @@ -1,20 +1,20 @@ NonTermNode { prod: S: M N, - location: [1,0], + location: [0-0], children: [ NonTermNode { prod: M: A M Tb, - location: [1,0], + location: [1,0-1,1], children: [ NonTermNode { prod: A: , - location: [1,0], + location: [1,0-1,0], children: [], layout: None, }, NonTermNode { prod: M: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -24,7 +24,7 @@ NonTermNode { layout: None, }, TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, ], @@ -32,34 +32,34 @@ NonTermNode { }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,5-1,6]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], @@ -67,7 +67,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -76,7 +76,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -85,7 +85,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, diff --git a/tests/src/glr/special/unbounded_ambiguity/tree_5.ast b/tests/src/glr/special/unbounded_ambiguity/tree_5.ast index 80d9045f..62ec37ec 100644 --- a/tests/src/glr/special/unbounded_ambiguity/tree_5.ast +++ b/tests/src/glr/special/unbounded_ambiguity/tree_5.ast @@ -1,10 +1,10 @@ NonTermNode { prod: S: M N, - location: [1,0], + location: [0-0], children: [ NonTermNode { prod: M: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { token: Tx("\"x\"" [1,0-1,1]), @@ -15,42 +15,42 @@ NonTermNode { }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,1-1,2]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,2-1,3]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,3-1,4]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tb N A, - location: [1,0], + location: [0-0], children: [ TermNode { - token: Tb("\"b\"" [1,4-1,5]), + token: Tb("\"b\"" [1,0-1,1]), layout: None, }, NonTermNode { prod: N: Tx, - location: [1,0], + location: [1,0-1,1], children: [ TermNode { - token: Tx("\"x\"" [1,5-1,6]), + token: Tx("\"x\"" [1,0-1,1]), layout: None, }, ], @@ -58,7 +58,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -67,7 +67,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, @@ -76,7 +76,7 @@ NonTermNode { }, NonTermNode { prod: A: , - location: [1,0], + location: [0-0], children: [], layout: None, }, diff --git a/tests/src/special/nondeterministic_palindromes/tree.ast b/tests/src/special/nondeterministic_palindromes/tree.ast deleted file mode 100644 index afb5572b..00000000 --- a/tests/src/special/nondeterministic_palindromes/tree.ast +++ /dev/null @@ -1,45 +0,0 @@ -Some( - [ - [ - "0", - [ - [ - "1", - [ - [ - "1", - [ - [ - "0", - [ - [ - "0", - [ - [ - "1", - [ - [ - "0", - [], - "0", - ], - ], - "1", - ], - ], - "0", - ], - ], - "0", - ], - ], - "1", - ], - ], - "1", - ], - ], - "0", - ], - ], -) \ No newline at end of file