Skip to content

Commit

Permalink
Adding Go in PiranhaLanguage
Browse files Browse the repository at this point in the history
  • Loading branch information
dvmarcilio committed Dec 7, 2022
1 parent e1b0838 commit db4c6e6
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions polyglot/piranha/src/models/language.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,20 @@ impl From<&str> for PiranhaLanguage {
fn from(language: &str) -> Self {
match language {
"java" => PiranhaLanguage::default(),
"go" => PiranhaLanguage {
name: language.to_string(),
supported_language: SupportedLanguage::Go,
language: tree_sitter_go::language(),
rules: None,
edges: None,
scopes: vec![],
comment_nodes: vec![],
"go" => {
let rules: Rules = parse_toml(include_str!("../cleanup_rules/go/rules.toml"));
let edges: Edges = parse_toml(include_str!("../cleanup_rules/go/edges.toml"));
PiranhaLanguage {
name: language.to_string(),
supported_language: SupportedLanguage::Go,
language: tree_sitter_go::language(),
rules: Some(rules),
edges: Some(edges),
scopes: parse_toml::<ScopeConfig>(include_str!("../cleanup_rules/go/scope_config.toml"))
.scopes()
.to_vec(),
comment_nodes: vec!["comment".to_string()],
}
},
"kt" => {
let rules: Rules = parse_toml(include_str!("../cleanup_rules/kt/rules.toml"));
Expand All @@ -118,7 +124,7 @@ impl From<&str> for PiranhaLanguage {
.to_vec(),
comment_nodes: vec!["comment".to_string()],
}
}
},
"py" => PiranhaLanguage {
name: language.to_string(),
supported_language: SupportedLanguage::Python,
Expand Down

0 comments on commit db4c6e6

Please sign in to comment.