Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
sbillig committed Mar 1, 2024
1 parent 65f3804 commit 42202eb
Show file tree
Hide file tree
Showing 68 changed files with 2,844 additions and 2,406 deletions.
102 changes: 55 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ opt-level = 3

[profile.dev]
# Speeds up the build. May need to diable for debugging.
debug = 0
debug = 1
6 changes: 3 additions & 3 deletions crates/hir/src/lower/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@ impl DiagnosticVoucher for ParserError {

fn to_complete(&self, _db: &dyn SpannedHirDb) -> CompleteDiagnostic {
let error_code = self.error_code();
let span = Span::new(self.file, self.error.range, SpanKind::Original);
let span = Span::new(self.file, self.error.range(), SpanKind::Original);
CompleteDiagnostic::new(
Severity::Error,
self.error.msg.clone(),
self.error.msg(),
vec![SubDiagnostic::new(
LabelStyle::Primary,
self.error.msg.clone(),
self.error.msg(),
Some(span),
)],
vec![],
Expand Down
2 changes: 2 additions & 0 deletions crates/parser2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ logos = "0.12.1"
rustc-hash = "1.1.0"
lazy_static = "1.4.0"
derive_more = "0.99"
smallvec = { version = "1.11.2", features = ["union"] }
unwrap-infallible = "0.1.5"

[dev-dependencies]
fe-compiler-test-utils = { path = "../test-utils" }
Expand Down
2 changes: 1 addition & 1 deletion crates/parser2/src/ast/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ mod tests {
fn parse_attr_list(source: &str) -> AttrList {
let lexer = Lexer::new(source);
let mut parser = Parser::new(lexer);
parser.parse(AttrListScope::default(), None);
parser.parse(AttrListScope::default()).unwrap();
AttrList::cast(parser.finish_to_node().0).unwrap()
}

Expand Down
5 changes: 3 additions & 2 deletions crates/parser2/src/ast/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ pub enum ArithBinOp {
BitAnd(SyntaxToken),
/// `|`
BitOr(SyntaxToken),
/// `^`
/// `^`
BitXor(SyntaxToken),
}
impl ArithBinOp {
Expand Down Expand Up @@ -674,7 +674,7 @@ mod tests {
{
let lexer = Lexer::new(source);
let mut parser = Parser::new(lexer);
crate::parser::expr::parse_expr(&mut parser);
crate::parser::expr::parse_expr(&mut parser).unwrap();
Expr::cast(parser.finish_to_node().0)
.unwrap()
.kind()
Expand Down Expand Up @@ -913,6 +913,7 @@ mod tests {

let if_expr: IfExpr = parse_expr("if { true } { return } else { continue }");
if let ExprKind::Block(stmts) = if_expr.cond().unwrap().kind() {
dbg!(&stmts);
assert!(matches!(
stmts.into_iter().next().unwrap().kind(),
crate::ast::StmtKind::Expr(_)
Expand Down
3 changes: 2 additions & 1 deletion crates/parser2/src/ast/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ mod tests {
let lexer = Lexer::new(source);
let mut parser = Parser::new(lexer);

parser.parse(ItemListScope::default(), None);
let _ = parser.parse(ItemListScope::default());
let (node, errs) = parser.finish_to_node();
for e in errs {
eprintln!("{:?}", e);
Expand Down Expand Up @@ -729,6 +729,7 @@ mod tests {
let u: Use = parse_item(source);
let use_tree = u.use_tree().unwrap();
let mut count = 0;
dbg!(use_tree.path().unwrap());
for segment in use_tree.path().unwrap() {
match count {
0 => {
Expand Down
Loading

0 comments on commit 42202eb

Please sign in to comment.