pub enum LANG {
Show 21 variants
Mozjs,
Javascript,
Java,
Go,
Kotlin,
Lua,
Rust,
Tcl,
Cpp,
Csharp,
Elixir,
Python,
Tsx,
Typescript,
Bash,
Ccomment,
Preproc,
Perl,
Php,
Ruby,
Groovy,
}Expand description
The list of supported languages.
Every variant is always defined regardless of the Cargo
feature set: per-language features only gate the grammar
crate references, never the enum surface itself. Disabled
variants surface at runtime as
crate::MetricsError::LanguageDisabled from every entry
point that returns a Result.
Variants§
Mozjs
The Mozjs language is variant of the JavaScript language
Javascript
The JavaScript language
Java
The Java language
Go
The Go language
Kotlin
The Kotlin language
Lua
The Lua language
Rust
The Rust language
Tcl
The Tcl language
Cpp
The C/C++ language
Csharp
The C# language
Elixir
The Elixir language
Python
The Python language
Tsx
The Tsx language incorporates the JSX syntax inside TypeScript
Typescript
The TypeScript language
Bash
The Bash language
Ccomment
The Ccomment language is a variant of the C language focused on comments
Preproc
The PreProc language is a variant of the C/C++ language focused on macros
Perl
The Perl language
Php
The Php language
Ruby
The Ruby language
Groovy
The Groovy language
Implementations§
Source§impl LANG
impl LANG
Sourcepub fn into_enum_iter() -> impl Iterator<Item = LANG>
pub fn into_enum_iter() -> impl Iterator<Item = LANG>
Return an iterator over the supported languages.
§Examples
use big_code_analysis::LANG;
for lang in LANG::into_enum_iter() {
println!("{:?}", lang);
}Sourcepub fn get_name(&self) -> &'static str
pub fn get_name(&self) -> &'static str
Returns the name of a language as a &str.
§Examples
use big_code_analysis::LANG;
println!("{}", LANG::Rust.get_name());Sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Reports whether this variant’s grammar crate is compiled into the current build.
Returns false for variants whose per-language Cargo
feature is disabled; calling
Self::get_tree_sitter_language, crate::analyze,
or any other dispatcher with such a variant will
return crate::MetricsError::LanguageDisabled.
Sourcepub fn get_tree_sitter_language(&self) -> Result<Language, MetricsError>
pub fn get_tree_sitter_language(&self) -> Result<Language, MetricsError>
Returns the tree_sitter::Language grammar used by
this variant.
Useful when feeding a caller-built
tree_sitter::Parser into the
crate::metrics_from_tree / [crate::Parser::from_tree]
entry points — the language returned here is the one
the metric walker expects for kind_id matching, so
the trees agree structurally.
This method is part of the value-not-stable surface:
the underlying tree-sitter-* grammar pin may bump
in any minor release, which can change Language
equality on the caller side.
§Errors
Returns crate::MetricsError::LanguageDisabled when
the variant’s per-language Cargo feature is not
enabled in the current build (see the [features]
table in the root Cargo.toml).
§Examples
use big_code_analysis::LANG;
let _lang = LANG::Rust.get_tree_sitter_language().expect("rust feature enabled");Source§impl LANG
impl LANG
Sourcepub fn get_extensions(&self) -> &'static [&'static str]
pub fn get_extensions(&self) -> &'static [&'static str]
Returns the file extensions recognised for this language.
The returned list is the same one consulted by
get_from_ext and crate::get_language_for_file.
Helper variants without user-facing files (Ccomment,
Preproc) return an empty slice.
§Examples
use big_code_analysis::LANG;
assert!(LANG::Rust.get_extensions().contains(&"rs"));Trait Implementations§
impl Copy for LANG
impl Eq for LANG
impl StructuralPartialEq for LANG
Auto Trait Implementations§
impl Freeze for LANG
impl RefUnwindSafe for LANG
impl Send for LANG
impl Sync for LANG
impl Unpin for LANG
impl UnsafeUnpin for LANG
impl UnwindSafe for LANG
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.