Skip to content

Commit

Permalink
feat: add scala support
Browse files Browse the repository at this point in the history
  • Loading branch information
makotot authored and HerringtonDarkholme committed Jul 6, 2023
1 parent 2cb842a commit 81267e8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/wasm_lang.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ pub enum WasmLang {
Python,
Ruby,
Rust,
Scala,
Toml,
Yaml,
}
Expand Down Expand Up @@ -66,6 +67,7 @@ impl FromStr for WasmLang {
"python" => Python,
"ruby" => Ruby,
"rust" => Rust,
"scala" => Scala,
"toml" => Toml,
"yaml" => Yaml,
_ => return Err(NotSupport(s.to_string())),
Expand Down Expand Up @@ -134,6 +136,7 @@ macro_rules! execute_lang_method {
W::JavaScript => L::JavaScript.$method($($pname,)*),
W::Python => L::Python.$method($($pname,)*),
W::Rust => L::Rust.$method($($pname,)*),
W::Scala => L::Scala.$method($($pname,)*),
W::TypeScript => L::TypeScript.$method($($pname,)*),
_ => StubLang.$method($($pname,)*),
}
Expand Down
Binary file added website/public/tree-sitter-scala.wasm
Binary file not shown.
4 changes: 3 additions & 1 deletion website/src/components/lang.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
type SupportedLang = keyof typeof parserPaths
import init, { setupParser, initializeTreeSitter, WASMConfig } from 'ast-grep-wasm'
import init, { setupParser, initializeTreeSitter } from 'ast-grep-wasm'

const parserPaths = {
javascript: 'tree-sitter-javascript.wasm',
Expand All @@ -18,6 +18,7 @@ const parserPaths = {
python: 'tree-sitter-python.wasm',
ruby: 'tree-sitter-ruby.wasm',
rust: 'tree-sitter-rust.wasm',
scala: 'tree-sitter-scala.wasm',
toml: 'tree-sitter-toml.wasm',
yaml: 'tree-sitter-yaml.wasm',
}
Expand All @@ -39,6 +40,7 @@ export const languageDisplayNames: Record<SupportedLang, string> = {
python: 'Python',
ruby: 'Ruby',
rust: 'Rust',
scala: 'Scala',
toml: 'TOML',
yaml: 'YAML',
}
Expand Down

0 comments on commit 81267e8

Please sign in to comment.