Skip to content

Commit 307a0a4

Browse files
committed
ast onionskin
1 parent d155a8a commit 307a0a4

31 files changed

+623
-2356
lines changed

baml_language/PARSER_IMPLEMENTATION_SUMMARY.md

Lines changed: 0 additions & 150 deletions
This file was deleted.

baml_language/crates/baml_hir/src/lib.rs

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -4,87 +4,20 @@
44
55
use baml_base::{Name, SourceFile};
66
use baml_parser::syntax_tree;
7-
use baml_syntax::SyntaxKind;
87
use baml_workspace::project_files;
98

109
mod ids;
11-
mod pretty_print;
1210
mod types;
1311

1412
pub use ids::*;
15-
pub use pretty_print::*;
1613
pub use types::*;
1714

1815
/// Tracked: get all items defined in a file
1916
#[salsa::tracked]
2017
pub fn file_items(db: &dyn salsa::Database, file: SourceFile) -> Vec<ItemId> {
21-
return vec![];
22-
let tree = syntax_tree(db, file);
23-
let file_id = file.file_id(db);
24-
let mut items = Vec::new();
25-
26-
// Walk top-level nodes in the syntax tree
27-
// Note: syntax_tree returns a GreenNode, so we need to look at it correctly
28-
29-
// Iterate children_with_tokens and filter to only SyntaxNodes
30-
for element in tree.children_with_tokens() {
31-
// Only process SyntaxNode elements (not tokens)
32-
if let Some(child) = element.into_node() {
33-
match child.kind() {
34-
SyntaxKind::FUNCTION_DEF => {
35-
// Extract function name - WORD is a token, not a node
36-
for element in child.children_with_tokens() {
37-
if let Some(token) = element.into_token() {
38-
if token.kind() == SyntaxKind::WORD {
39-
let name_text = token.text().to_string();
40-
let name = Name::new(&name_text);
41-
items.push(ItemId::Function(FunctionId {
42-
file: file_id,
43-
name,
44-
}));
45-
break;
46-
}
47-
}
48-
}
49-
}
50-
SyntaxKind::CLASS_DEF => {
51-
// Extract class name - WORD is a token, not a node
52-
for element in child.children_with_tokens() {
53-
if let Some(token) = element.into_token() {
54-
if token.kind() == SyntaxKind::WORD {
55-
let name_text = token.text().to_string();
56-
let name = Name::new(&name_text);
57-
items.push(ItemId::Class(ClassId {
58-
file: file_id,
59-
name,
60-
}));
61-
break;
62-
}
63-
}
64-
}
65-
}
66-
SyntaxKind::ENUM_DEF => {
67-
// Extract enum name - WORD is a token, not a node
68-
for element in child.children_with_tokens() {
69-
if let Some(token) = element.into_token() {
70-
if token.kind() == SyntaxKind::WORD {
71-
let name_text = token.text().to_string();
72-
let name = Name::new(&name_text);
73-
items.push(ItemId::Enum(EnumId {
74-
file: file_id,
75-
name,
76-
}));
77-
break;
78-
}
79-
}
80-
}
81-
}
82-
_ => {} // Skip other nodes
83-
}
84-
}
85-
}
86-
87-
items
18+
// TODO: Extract items from syntax tree
19+
let _tree = syntax_tree(db, file);
20+
vec![]
8821
}
8922

9023
/// Tracked: get all items in the entire project

baml_language/crates/baml_lexer/src/tokens.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,8 @@ pub enum TokenKind {
138138
Semicolon,
139139
#[token(".")]
140140
Dot,
141+
#[token("$")]
142+
Dollar,
141143

142144
// Operators (order matters! Longer tokens first)
143145
#[token("->")]

baml_language/crates/baml_onionskin/examples/demo.baml

Lines changed: 0 additions & 10 deletions
This file was deleted.

baml_language/crates/baml_onionskin/examples/demo2.baml

Whitespace-only changes.

0 commit comments

Comments
 (0)