From 91605de2095e20c1dbe72ecee636e82709fc29cb Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 29 Aug 2025 23:24:36 -0400 Subject: [PATCH 1/2] squawk_syntax: fix ast::BinExpr --- crates/squawk_syntax/src/ast/generated/nodes.rs | 8 -------- crates/squawk_syntax/src/ast/node_ext.rs | 10 ++++++++++ crates/xtask/src/codegen.rs | 2 +- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/crates/squawk_syntax/src/ast/generated/nodes.rs b/crates/squawk_syntax/src/ast/generated/nodes.rs index 0ec92287..c6e36d00 100644 --- a/crates/squawk_syntax/src/ast/generated/nodes.rs +++ b/crates/squawk_syntax/src/ast/generated/nodes.rs @@ -1347,18 +1347,10 @@ pub struct BinExpr { pub(crate) syntax: SyntaxNode, } impl BinExpr { - #[inline] - pub fn lhs(&self) -> Option { - support::child(&self.syntax) - } #[inline] pub fn op(&self) -> Option { support::child(&self.syntax) } - #[inline] - pub fn rhs(&self) -> Option { - support::child(&self.syntax) - } } #[derive(Debug, Clone, PartialEq, Eq, Hash)] diff --git a/crates/squawk_syntax/src/ast/node_ext.rs b/crates/squawk_syntax/src/ast/node_ext.rs index 7dffb972..f42f4ae9 100644 --- a/crates/squawk_syntax/src/ast/node_ext.rs +++ b/crates/squawk_syntax/src/ast/node_ext.rs @@ -41,6 +41,16 @@ impl ast::Constraint { } } +impl ast::BinExpr { + pub fn lhs(&self) -> Option { + support::children(self.syntax()).next() + } + + pub fn rhs(&self) -> Option { + support::children(self.syntax()).nth(1) + } +} + impl ast::NameRef { #[inline] pub fn text(&self) -> TokenText<'_> { diff --git a/crates/xtask/src/codegen.rs b/crates/xtask/src/codegen.rs index dcaaf7b1..70f28bed 100644 --- a/crates/xtask/src/codegen.rs +++ b/crates/xtask/src/codegen.rs @@ -624,7 +624,7 @@ fn lower_rule(acc: &mut Vec, grammar: &Grammar, label: Option<&String>, r } Rule::Labeled { label: l, rule } => { assert!(label.is_none()); - let manually_implemented = matches!(l.as_str(), "value"); + let manually_implemented = matches!(l.as_str(), "value" | "lhs" | "rhs"); if manually_implemented { return; } From ac28ae19c320419bec19d790586543f6b828465e Mon Sep 17 00:00:00 2001 From: Steve Dignam Date: Fri, 29 Aug 2025 23:47:56 -0400 Subject: [PATCH 2/2] fix formatting --- crates/squawk/src/main.rs | 2 +- crates/xtask/src/codegen.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/squawk/src/main.rs b/crates/squawk/src/main.rs index 9ff9b76a..cbe8a9ee 100644 --- a/crates/squawk/src/main.rs +++ b/crates/squawk/src/main.rs @@ -11,11 +11,11 @@ use squawk_linter::{Rule, Version}; use structopt::clap::arg_enum; use crate::file_finding::find_paths; -use std::io::IsTerminal; use config::Config; use log::info; use simplelog::CombinedLogger; use std::io; +use std::io::IsTerminal; use std::panic; use std::path::PathBuf; use std::process::{self, ExitCode}; diff --git a/crates/xtask/src/codegen.rs b/crates/xtask/src/codegen.rs index 70f28bed..61b2c58a 100644 --- a/crates/xtask/src/codegen.rs +++ b/crates/xtask/src/codegen.rs @@ -51,7 +51,7 @@ fn ensure_rustfmt(sh: &Shell) { fn reformat(text: String) -> String { let sh = Shell::new().unwrap(); ensure_rustfmt(&sh); - let mut stdout = cmd!(sh, "rustup run stable rustfmt") + let mut stdout = cmd!(sh, "rustup run stable rustfmt --edition=2024") .stdin(text) .read() .unwrap();