pub enum SupportLang {
Show 23 variants
Bash,
C,
Cpp,
CSharp,
Css,
Go,
Elixir,
Haskell,
Html,
Java,
JavaScript,
Json,
Kotlin,
Lua,
Php,
Python,
Ruby,
Rust,
Scala,
Swift,
Tsx,
TypeScript,
Yaml,
}
Expand description
Represents all built-in languages.
Variants§
Bash
C
Cpp
CSharp
Css
Go
Elixir
Haskell
Html
Java
JavaScript
Json
Kotlin
Lua
Php
Python
Ruby
Rust
Scala
Swift
Tsx
TypeScript
Yaml
Implementations§
Source§impl SupportLang
impl SupportLang
pub const fn all_langs() -> &'static [SupportLang]
pub fn file_types(&self) -> Types
Trait Implementations§
Source§impl Clone for SupportLang
impl Clone for SupportLang
Source§fn clone(&self) -> SupportLang
fn clone(&self) -> SupportLang
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for SupportLang
impl Debug for SupportLang
Source§impl<'de> Deserialize<'de> for SupportLang
impl<'de> Deserialize<'de> for SupportLang
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for SupportLang
impl Display for SupportLang
Source§impl From<Bash> for SupportLang
impl From<Bash> for SupportLang
Source§impl From<C> for SupportLang
impl From<C> for SupportLang
Source§impl From<CSharp> for SupportLang
impl From<CSharp> for SupportLang
Source§impl From<Cpp> for SupportLang
impl From<Cpp> for SupportLang
Source§impl From<Css> for SupportLang
impl From<Css> for SupportLang
Source§impl From<Elixir> for SupportLang
impl From<Elixir> for SupportLang
Source§impl From<Go> for SupportLang
impl From<Go> for SupportLang
Source§impl From<Haskell> for SupportLang
impl From<Haskell> for SupportLang
Source§impl From<Html> for SupportLang
impl From<Html> for SupportLang
Source§impl From<Java> for SupportLang
impl From<Java> for SupportLang
Source§impl From<JavaScript> for SupportLang
impl From<JavaScript> for SupportLang
Source§fn from(_: JavaScript) -> Self
fn from(_: JavaScript) -> Self
Converts to this type from the input type.
Source§impl From<Json> for SupportLang
impl From<Json> for SupportLang
Source§impl From<Kotlin> for SupportLang
impl From<Kotlin> for SupportLang
Source§impl From<Lua> for SupportLang
impl From<Lua> for SupportLang
Source§impl From<Php> for SupportLang
impl From<Php> for SupportLang
Source§impl From<Python> for SupportLang
impl From<Python> for SupportLang
Source§impl From<Ruby> for SupportLang
impl From<Ruby> for SupportLang
Source§impl From<Rust> for SupportLang
impl From<Rust> for SupportLang
Source§impl From<Scala> for SupportLang
impl From<Scala> for SupportLang
Source§impl From<Swift> for SupportLang
impl From<Swift> for SupportLang
Source§impl From<Tsx> for SupportLang
impl From<Tsx> for SupportLang
Source§impl From<TypeScript> for SupportLang
impl From<TypeScript> for SupportLang
Source§fn from(_: TypeScript) -> Self
fn from(_: TypeScript) -> Self
Converts to this type from the input type.
Source§impl From<Yaml> for SupportLang
impl From<Yaml> for SupportLang
Source§impl FromStr for SupportLang
Implements the language names and aliases.
impl FromStr for SupportLang
Implements the language names and aliases.
Source§impl Hash for SupportLang
impl Hash for SupportLang
Source§impl Language for SupportLang
impl Language for SupportLang
fn kind_to_id(&self, kind: &str) -> u16
fn field_to_id(&self, field: &str) -> Option<u16>
Source§fn meta_var_char(&self) -> char
fn meta_var_char(&self) -> char
Configure meta variable special character
By default $ is the metavar char, but in PHP it can be #
Source§fn expando_char(&self) -> char
fn expando_char(&self) -> char
Some language does not accept $ as the leading char for identifiers.
We need to change $ to other char at run-time to make parser happy, thus the name expando.
By default this is the same as meta_var char so replacement is done at runtime.
Source§fn extract_meta_var(&self, source: &str) -> Option<MetaVariable>
fn extract_meta_var(&self, source: &str) -> Option<MetaVariable>
extract MetaVariable from a given source string
At runtime we need to use expand_char
fn build_pattern( &self, builder: &PatternBuilder<'_>, ) -> Result<Pattern, PatternError>
Source§impl LanguageExt for SupportLang
impl LanguageExt for SupportLang
Source§fn get_ts_language(&self) -> TSLanguage
fn get_ts_language(&self) -> TSLanguage
tree sitter language to parse the source
fn injectable_languages(&self) -> Option<&'static [&'static str]>
Source§fn extract_injections<L: LanguageExt>(
&self,
root: Node<'_, StrDoc<L>>,
) -> HashMap<String, Vec<TSRange>>
fn extract_injections<L: LanguageExt>( &self, root: Node<'_, StrDoc<L>>, ) -> HashMap<String, Vec<TSRange>>
get injected language regions in the root document. e.g. get JavaScripts in HTML
it will return a list of tuples of (language, regions).
The first item is the embedded region language, e.g. javascript
The second item is a list of regions in tree_sitter.
also see https://tree-sitter.github.io/tree-sitter/using-parsers#multi-language-documents
Source§impl PartialEq for SupportLang
impl PartialEq for SupportLang
Source§impl Serialize for SupportLang
impl Serialize for SupportLang
impl Copy for SupportLang
impl Eq for SupportLang
impl StructuralPartialEq for SupportLang
Auto Trait Implementations§
impl Freeze for SupportLang
impl RefUnwindSafe for SupportLang
impl Send for SupportLang
impl Sync for SupportLang
impl Unpin for SupportLang
impl UnwindSafe for SupportLang
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
Mutably borrows from an owned value. Read more