-
Notifications
You must be signed in to change notification settings - Fork 15
feat(grammars): apex/html/xml/dart/clojure search grammars (→ 93.4%) #531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,11 @@ | |
| Language::Scala => tree_sitter_scala::LANGUAGE.into(), | ||
| Language::Elixir => tree_sitter_elixir::LANGUAGE.into(), | ||
| Language::Json => tree_sitter_json::LANGUAGE.into(), | ||
| Language::Apex => tree_sitter_sfapex::apex::LANGUAGE.into(), | ||
| Language::Clojure => tree_sitter_clojure_orchard::LANGUAGE.into(), | ||
| Language::Html => tree_sitter_html::LANGUAGE.into(), | ||
| Language::Xml => tree_sitter_xml::LANGUAGE_XML.into(), | ||
| Language::Dart => tree_sitter_dart::LANGUAGE.into(), | ||
| // Regex-mode rules never use a tree-sitter parser — they match raw text | ||
| // only. Return `None` immediately so the scanner skips the tree build. | ||
| Language::Regex => return None, | ||
|
|
@@ -147,6 +152,52 @@ | |
| assert!(!tree.root_node().has_error()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_apex_without_errors() { | ||
| let source = | ||
| "public class Hello {\n public void greet() {\n String x = 'hi';\n }\n}\n"; | ||
| let tree = parse_path(source, Language::Apex, Path::new("Hello.cls")) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. foxguard · .expect() can panic at runtime — use proper error handling with ? or match |
||
| .expect("Apex parser should produce a tree"); | ||
|
|
||
| assert!(!tree.root_node().has_error()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_clojure_without_errors() { | ||
| let source = "(defn greet [name]\n (println \"hello\" name))\n"; | ||
| let tree = parse_path(source, Language::Clojure, Path::new("core.clj")) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. foxguard · .expect() can panic at runtime — use proper error handling with ? or match |
||
| .expect("Clojure parser should produce a tree"); | ||
|
|
||
| assert!(!tree.root_node().has_error()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_html_without_errors() { | ||
| let source = "<html>\n <body>\n <a href=\"/x\">link</a>\n </body>\n</html>\n"; | ||
| let tree = parse_path(source, Language::Html, Path::new("index.html")) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. foxguard · .expect() can panic at runtime — use proper error handling with ? or match |
||
| .expect("HTML parser should produce a tree"); | ||
|
|
||
| assert!(!tree.root_node().has_error()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_xml_without_errors() { | ||
| let source = "<?xml version=\"1.0\"?>\n<root>\n <child id=\"1\">text</child>\n</root>\n"; | ||
| let tree = parse_path(source, Language::Xml, Path::new("data.xml")) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. foxguard · .expect() can panic at runtime — use proper error handling with ? or match |
||
| .expect("XML parser should produce a tree"); | ||
|
|
||
| assert!(!tree.root_node().has_error()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_dart_without_errors() { | ||
| let source = "void main() {\n print('hello');\n}\n"; | ||
| let tree = parse_path(source, Language::Dart, Path::new("main.dart")) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. foxguard · .expect() can panic at runtime — use proper error handling with ? or match |
||
| .expect("Dart parser should produce a tree"); | ||
|
|
||
| assert!(!tree.root_node().has_error()); | ||
| } | ||
|
|
||
| #[test] | ||
| fn parses_ocaml_without_errors() { | ||
| let source = "let () = print_endline \"Hello, world\"\n"; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Section labeling is now misleading for these entries.
This table is under “missing language grammars,” but the listed reasons are generic-mode and taint-mode support gaps, not strictly grammar gaps. Please retitle/reword this section so prioritization isn’t skewed.
Suggested doc tweak
🤖 Prompt for AI Agents