Skip to content

Commit

Permalink
Updates for rum_lang dev and nix
Browse files Browse the repository at this point in the history
  • Loading branch information
acweathersby committed Sep 6, 2024
1 parent faccbd5 commit e85de0e
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
4 changes: 2 additions & 2 deletions crates/radlr-ascript/types/mod.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
mod multi;
mod ast_types;
mod database;
mod initializer;
mod multi;
mod rule;
mod structure;

pub use multi::*;
pub use ast_types::*;
pub use database::*;
pub use initializer::*;
pub use multi::*;
pub use rule::*;
pub use structure::*;
38 changes: 28 additions & 10 deletions crates/radlr-build/targets/rust/rust_ast_script.atat
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ use std::collections::HashMap;
}
}


#raw_type_to_multi to:obj MULTI_NAME:str {
@to_type ={ #multi_rust_type(to) }
@to_name ={ @to.name }
Expand Down Expand Up @@ -365,9 +366,29 @@ use std::collections::HashMap;
fn\ from(value:\ @enum_type )\ ->\ Self\ {
Self::@self.name(value) @;
}@;
} \n\n


#token_trait_single to:obj {
match (@to.requires_template) {
true { <Token:Tk> }
}
}

\n\n
#token_trait_single_invert to:obj {
match (@to.requires_template) {
false { <Token:Tk> }
}
}

impl#token_trait_single(self)\ @enum_type {
pub\ fn\ to_ast#token_trait_single_invert(self)(self)\ ->\ @AST_NAME<Token>\ { @;
mat ch\ self\ {
@self.types.iter#multi_convert_from("Self", @AST_NAME)
_\ =>\ @AST_NAME::None,@;
}
}
} \n\n
}

@self.iter#impls()
Expand Down Expand Up @@ -570,16 +591,13 @@ use std::collections::HashMap;
("Map", "Vec") { map_vec }

("Vec", _) {
match self.right.val.#type {
{
let\ mut\ @ref\ =\ @ref_l; @;
@ref . push ( @ref_r ) ; @;
}
}
let\ mut\ @ref\ =\ @ref_l; @;
@ref . push ( @ref_r ) ; @;
}
(_, "Vec") {
let\ mut\ @ref\ =\ @ref_r; @;
@ref . insert ( 0, @ref_l ) ; @;
}

(_, "Vec") { add_vec }

("Map", _) { map_add }

(_, "Map") { add_map }
Expand Down
5 changes: 3 additions & 2 deletions crates/radlr-core/grammar/build_grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ pub fn extract_nonterminals<'a>(
}
(_, Some(name_sym)) => {
let import_grammar_name = name_sym.module.to_string().intern(s_store);
let import_g_id = o_to_r(g_data.imports.get(&import_grammar_name), "could not find grammar")?;
let import_g_id = o_to_r(g_data.imports.get(&import_grammar_name), "could not find grammar E")?;
let (guid_name, f_name) = nterm_names(name_sym.name.as_str(), import_g_id, s_store);
let id = NonTermId::from((import_g_id.guid, name_sym.name.as_str()));
nterms.push((create_bare_nonterm_struct(id, guid_name, f_name, import_g_id, tok), prod_rule));
Expand Down Expand Up @@ -739,7 +739,7 @@ fn process_rule_symbols(
// Add the ProductionID as a non-term symbol
// to the beginning of each rule, making the
// resulting list non-terminal left recursive.
for rule in &mut secondary_rules {
for (index, rule) in secondary_rules.iter_mut().enumerate() {
rule.ast = Some(ASTToken::ListIterate(tok.get_tok_range()));

rule.tok = tok.clone();
Expand All @@ -749,6 +749,7 @@ fn process_rule_symbols(
annotation: annotation.intern(s_store),
loc: tok.clone(),
original_index: 0,
symbol_precedence: index as u16,
..Default::default()
});

Expand Down
1 change: 0 additions & 1 deletion crates/radlr-core/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#![allow(non_snake_case)]
#![feature(box_patterns)]
#![feature(return_position_impl_trait_in_trait)]

mod builder;
mod compile;
Expand Down
6 changes: 3 additions & 3 deletions crates/radlr-core/types/parser_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,11 @@ pub struct ParserDatabase {
/// Item closures, stores the closure of all items, excluding the closure's of
/// items that are complete.
item_closures: Array<Array<Array<ItemIndex>>>,

///NonTerminal Recursion Type
recursion_types: Array<u8>,
recursion_types: Array<u8>,
/// Reduction types
reduction_types: Array<ReductionType>,
reduction_types: Array<ReductionType>,
}

impl ParserDatabase {
Expand Down
1 change: 0 additions & 1 deletion crates/radlr-formatter/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![feature(return_position_impl_trait_in_trait)]
mod formatter;
mod parser;
mod types;
Expand Down
2 changes: 1 addition & 1 deletion scripts/build_radlr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#! /bin/zsh
#! /usr/bin/env zsh

pushd ${0:a:h}/..

Expand Down

0 comments on commit e85de0e

Please sign in to comment.