Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cfgrammar/src/lib/yacc/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ mod test {
"#;

let astart_ast_validity =
ASTWithValidityInfo::new(YaccKind::Original(YaccOriginalActionKind::NoAction), &y_src);
ASTWithValidityInfo::new(YaccKind::Original(YaccOriginalActionKind::NoAction), y_src);
let bstart_rule = astart_ast_validity.ast().get_rule("BStart").unwrap();
let bstart_ast_validity = astart_ast_validity
.clone_and_change_start_rule(bstart_rule.clone())
Expand Down
11 changes: 5 additions & 6 deletions lrlex/src/lib/ctbuilder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,9 @@ where
/// .lexer_in_src_dir("calc.l")?
/// .build()?;
/// ```
pub fn lrpar_config<F: 'a>(mut self, config_func: F) -> Self
pub fn lrpar_config<F>(mut self, config_func: F) -> Self
where
F: Fn(CTParserBuilder<LexerTypesT>) -> CTParserBuilder<LexerTypesT>,
F: Fn(CTParserBuilder<LexerTypesT>) -> CTParserBuilder<LexerTypesT> + 'a,
{
self.lrpar_config = Some(Box::new(config_func));
self
Expand Down Expand Up @@ -1375,11 +1375,10 @@ impl<StorageT: Display + ToTokens> CTTokenMapBuilder<StorageT> {
))
})
.collect::<Result<(TokenStream, TokenStream), Box<dyn Error>>>()?;
let unused_annotation;
if self.allow_dead_code {
unused_annotation = quote! {#[allow(dead_code)]};
let unused_annotation = if self.allow_dead_code {
quote! {#[allow(dead_code)]}
} else {
unused_annotation = quote! {};
quote! {}
};
// Since the formatter doesn't preserve comments and we don't want to lose build time,
// just format the module contents.
Expand Down
4 changes: 1 addition & 3 deletions lrpar/cttests/src/grmtools_section.test
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ grammar: |
array_seq -> Vec<Setting<Span>>
: %empty { Vec::new() }
| val {
let mut x = Vec::new();
x.push($1);
x
vec![$1]
}
| array_seq ',' val {
$1.push($3);
Expand Down
8 changes: 4 additions & 4 deletions lrpar/cttests/src/multi_start.y
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
%%

AStart -> ()
: A ':' BStart ';' {()}
: A ':' BStart ';' {}
;

BStart -> ()
: B ',' C {()}
| C ',' B {()}
;
: B ',' C {}
| C ',' B {}
;
8 changes: 4 additions & 4 deletions lrpar/examples/calc_ast_arena/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ fn eval(
e: &Expr,
) -> Result<u64, (Span, &'static str)> {
match e {
Expr::Add { span, lhs, rhs } => eval(lexer, *lhs)?
.checked_add(eval(lexer, *rhs)?)
Expr::Add { span, lhs, rhs } => eval(lexer, lhs)?
.checked_add(eval(lexer, rhs)?)
.ok_or((*span, "overflowed")),
Expr::Mul { span, lhs, rhs } => eval(lexer, *lhs)?
.checked_mul(eval(lexer, *rhs)?)
Expr::Mul { span, lhs, rhs } => eval(lexer, lhs)?
.checked_mul(eval(lexer, rhs)?)
.ok_or((*span, "overflowed")),
Expr::Number { span } => lexer
.span_str(*span)
Expand Down