pub struct JavaAdapter;Expand description
Language adapter for Java source files.
Parses .java files with the tree-sitter-java grammar and extracts:
importsfromimportdeclarationsexportsfrom top-levelpublicclass and interface declarationssignaturesfrompublicmethod declarationspattern_hintsfor the patterns stage
§Examples
use sdivi_lang_java::JavaAdapter;
use sdivi_parsing::adapter::LanguageAdapter;
let adapter = JavaAdapter;
assert_eq!(adapter.language_name(), "java");
assert!(adapter.file_extensions().contains(&".java"));Trait Implementations§
Source§impl LanguageAdapter for JavaAdapter
impl LanguageAdapter for JavaAdapter
Source§fn parse_file(&self, path: &Path, content: String) -> FeatureRecord
fn parse_file(&self, path: &Path, content: String) -> FeatureRecord
Parses content and returns a FeatureRecord.
The tree-sitter CST is created, traversed, and dropped before this method returns. No tree-sitter type escapes into the returned record.
Source§fn language_name(&self) -> &'static str
fn language_name(&self) -> &'static str
Returns the canonical lower-case language name (e.g.
"rust").Source§fn file_extensions(&self) -> &[&'static str]
fn file_extensions(&self) -> &[&'static str]
Returns the file extensions handled by this adapter (e.g.
&[".rs"]). Read moreAuto Trait Implementations§
impl Freeze for JavaAdapter
impl RefUnwindSafe for JavaAdapter
impl Send for JavaAdapter
impl Sync for JavaAdapter
impl Unpin for JavaAdapter
impl UnsafeUnpin for JavaAdapter
impl UnwindSafe for JavaAdapter
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more