Enum ast_grep_napi::FrontEndLanguage
source · [−]pub enum FrontEndLanguage {
Html,
JavaScript,
Tsx,
TypeScript,
}
Variants
Html
JavaScript
Tsx
TypeScript
Trait Implementations
sourceimpl Clone for FrontEndLanguage
impl Clone for FrontEndLanguage
sourcefn clone(&self) -> FrontEndLanguage
fn clone(&self) -> FrontEndLanguage
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl FromNapiValue for FrontEndLanguage
impl FromNapiValue for FrontEndLanguage
sourceunsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
unsafe fn from_napi_value(env: napi_env, napi_val: napi_value) -> Result<Self>
Safety Read more
fn from_unknown(value: JsUnknown) -> Result<Self, Error>
sourceimpl Language for FrontEndLanguage
impl Language for FrontEndLanguage
sourcefn get_ts_language(&self) -> TSLanguage
fn get_ts_language(&self) -> TSLanguage
tree sitter language to parse the source
sourcefn from_path<P>(_path: P) -> Option<Self>where
P: AsRef<Path>,
fn from_path<P>(_path: P) -> Option<Self>where
P: AsRef<Path>,
Return the file language from path. Return None if the file type is not supported.
sourcefn ast_grep<S>(&self, source: S) -> AstGrep<Self>where
S: AsRef<str>,
fn ast_grep<S>(&self, source: S) -> AstGrep<Self>where
S: AsRef<str>,
Create an
AstGrep
instance for the languagesourcefn skippable_kind_ids(&self) -> &'static [u16]
fn skippable_kind_ids(&self) -> &'static [u16]
ignore trivial tokens in language matching
sourcefn pre_process_pattern(&self, query: &'q str) -> Cow<'q, str>
fn pre_process_pattern(&self, query: &'q str) -> Cow<'q, str>
normalize pattern code before matching
e.g. remove expression_statement, or prefer parsing {} to object over block Read more
sourcefn 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 # Read more
sourcefn 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. Read more
sourcefn 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 Read more
sourceimpl ToNapiValue for FrontEndLanguage
impl ToNapiValue for FrontEndLanguage
sourceunsafe fn to_napi_value(env: napi_env, val: Self) -> Result<napi_value>
unsafe fn to_napi_value(env: napi_env, val: Self) -> Result<napi_value>
Safety Read more
sourceimpl TypeName for FrontEndLanguage
impl TypeName for FrontEndLanguage
sourceimpl ValidateNapiValue for FrontEndLanguage
impl ValidateNapiValue for FrontEndLanguage
impl Copy for FrontEndLanguage
Auto Trait Implementations
impl RefUnwindSafe for FrontEndLanguage
impl Send for FrontEndLanguage
impl Sync for FrontEndLanguage
impl Unpin for FrontEndLanguage
impl UnwindSafe for FrontEndLanguage
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more