pub struct Parser { /* private fields */ }Expand description
High-performance parser using Node architecture (16 bytes/node). This is the optimized path for Phase 8 test suite evaluation.
Implementations§
Source§impl Parser
impl Parser
Sourcepub fn new(file_name: String, source_text: String) -> Self
pub fn new(file_name: String, source_text: String) -> Self
Create a new Parser for the given source file.
Sourcepub fn add_lib_file(&mut self, file_name: String, source_text: String)
pub fn add_lib_file(&mut self, file_name: String, source_text: String)
Add a lib file (e.g., lib.es5.d.ts) for global type resolution. The lib file will be parsed and bound, and its global symbols will be available during binding and type checking.
Sourcepub fn parse_source_file(&mut self) -> u32
pub fn parse_source_file(&mut self) -> u32
Parse the source file and return the root node index.
Sourcepub fn get_node_count(&self) -> usize
pub fn get_node_count(&self) -> usize
Get the number of nodes in the AST.
Sourcepub fn get_diagnostics_json(&self) -> String
pub fn get_diagnostics_json(&self) -> String
Get parse diagnostics as JSON.
Sourcepub fn bind_source_file(&mut self) -> String
pub fn bind_source_file(&mut self) -> String
Bind the source file and return symbol count.
Sourcepub fn check_source_file(&mut self) -> String
pub fn check_source_file(&mut self) -> String
Type check the source file and return diagnostics.
Sourcepub fn get_type_of_node(&mut self, node_idx: u32) -> String
pub fn get_type_of_node(&mut self, node_idx: u32) -> String
Get the type of a node as a string.
Sourcepub fn emit(&self) -> String
pub fn emit(&self) -> String
Emit the source file as JavaScript (ES5 target, auto-detect CommonJS for modules).
Sourcepub fn emit_modern(&self) -> String
pub fn emit_modern(&self) -> String
Emit the source file as JavaScript (ES6+ modern output).
Sourcepub fn generate_transforms(
&self,
target: u32,
module: u32,
) -> WasmTransformContext
pub fn generate_transforms( &self, target: u32, module: u32, ) -> WasmTransformContext
Generate transform directives based on compiler options.
Sourcepub fn emit_with_transforms(&self, context: &WasmTransformContext) -> String
pub fn emit_with_transforms(&self, context: &WasmTransformContext) -> String
Emit the source file using pre-computed transforms.
Sourcepub fn get_ast_json(&self) -> String
pub fn get_ast_json(&self) -> String
Get the AST as JSON (for debugging).
Sourcepub fn debug_type_lowering(&self, interface_name: &str) -> String
pub fn debug_type_lowering(&self, interface_name: &str) -> String
Debug type lowering - trace what happens when lowering an interface type
Sourcepub fn debug_interface_members(&self, interface_name: &str) -> String
pub fn debug_interface_members(&self, interface_name: &str) -> String
Debug interface parsing - dump interface members for diagnostics
Sourcepub fn debug_scopes(&self) -> String
pub fn debug_scopes(&self) -> String
Debug namespace scoping - dump scope info for all scopes
Sourcepub fn trace_parent_chain(&self, pos: u32) -> String
pub fn trace_parent_chain(&self, pos: u32) -> String
Trace the parent chain for a node at a given position
Sourcepub fn dump_var_decl(&self, var_decl_idx: u32) -> String
pub fn dump_var_decl(&self, var_decl_idx: u32) -> String
Dump variable declaration info for debugging
Sourcepub fn dump_all_nodes(&self, start: u32, count: u32) -> String
pub fn dump_all_nodes(&self, start: u32, count: u32) -> String
Dump all nodes for debugging
Sourcepub fn get_definition_at_position(
&mut self,
line: u32,
character: u32,
) -> Result<JsValue, JsValue>
pub fn get_definition_at_position( &mut self, line: u32, character: u32, ) -> Result<JsValue, JsValue>
Go to Definition: Returns array of Location objects.
Sourcepub fn get_references_at_position(
&mut self,
line: u32,
character: u32,
) -> Result<JsValue, JsValue>
pub fn get_references_at_position( &mut self, line: u32, character: u32, ) -> Result<JsValue, JsValue>
Find References: Returns array of Location objects.
Sourcepub fn get_completions_at_position(
&mut self,
line: u32,
character: u32,
) -> Result<JsValue, JsValue>
pub fn get_completions_at_position( &mut self, line: u32, character: u32, ) -> Result<JsValue, JsValue>
Completions: Returns array of CompletionItem objects.
Sourcepub fn get_hover_at_position(
&mut self,
line: u32,
character: u32,
) -> Result<JsValue, JsValue>
pub fn get_hover_at_position( &mut self, line: u32, character: u32, ) -> Result<JsValue, JsValue>
Hover: Returns HoverInfo object.
Sourcepub fn get_signature_help_at_position(
&mut self,
line: u32,
character: u32,
) -> Result<JsValue, JsValue>
pub fn get_signature_help_at_position( &mut self, line: u32, character: u32, ) -> Result<JsValue, JsValue>
Signature Help: Returns SignatureHelp object.
Sourcepub fn get_document_symbols(&mut self) -> Result<JsValue, JsValue>
pub fn get_document_symbols(&mut self) -> Result<JsValue, JsValue>
Document Symbols: Returns array of DocumentSymbol objects.
Sourcepub fn get_semantic_tokens(&mut self) -> Result<Vec<u32>, JsValue>
pub fn get_semantic_tokens(&mut self) -> Result<Vec<u32>, JsValue>
Semantic Tokens: Returns flat array of u32 (delta encoded).
Sourcepub fn prepare_rename(
&mut self,
line: u32,
character: u32,
) -> Result<JsValue, JsValue>
pub fn prepare_rename( &mut self, line: u32, character: u32, ) -> Result<JsValue, JsValue>
Rename - Prepare: Check if rename is valid at position.
Sourcepub fn get_rename_edits(
&mut self,
line: u32,
character: u32,
new_name: String,
) -> Result<JsValue, JsValue>
pub fn get_rename_edits( &mut self, line: u32, character: u32, new_name: String, ) -> Result<JsValue, JsValue>
Rename - Edits: Get workspace edits for rename.
Sourcepub fn get_code_actions(
&mut self,
start_line: u32,
start_char: u32,
end_line: u32,
end_char: u32,
) -> Result<JsValue, JsValue>
pub fn get_code_actions( &mut self, start_line: u32, start_char: u32, end_line: u32, end_char: u32, ) -> Result<JsValue, JsValue>
Code Actions: Get code actions for a range.
Sourcepub fn get_code_actions_with_context(
&mut self,
start_line: u32,
start_char: u32,
end_line: u32,
end_char: u32,
context: JsValue,
) -> Result<JsValue, JsValue>
pub fn get_code_actions_with_context( &mut self, start_line: u32, start_char: u32, end_line: u32, end_char: u32, context: JsValue, ) -> Result<JsValue, JsValue>
Code Actions: Get code actions for a range with diagnostics context.
Sourcepub fn get_lsp_diagnostics(&mut self) -> Result<JsValue, JsValue>
pub fn get_lsp_diagnostics(&mut self) -> Result<JsValue, JsValue>
Diagnostics: Get checker diagnostics in LSP format.
Trait Implementations§
Source§impl FromWasmAbi for Parser
impl FromWasmAbi for Parser
Source§impl IntoWasmAbi for Parser
impl IntoWasmAbi for Parser
Source§impl LongRefFromWasmAbi for Parser
impl LongRefFromWasmAbi for Parser
Source§impl OptionFromWasmAbi for Parser
impl OptionFromWasmAbi for Parser
Source§impl OptionIntoWasmAbi for Parser
impl OptionIntoWasmAbi for Parser
Source§impl RefFromWasmAbi for Parser
impl RefFromWasmAbi for Parser
Source§impl RefMutFromWasmAbi for Parser
impl RefMutFromWasmAbi for Parser
Source§impl TryFromJsValue for Parser
impl TryFromJsValue for Parser
Source§impl VectorFromWasmAbi for Parser
impl VectorFromWasmAbi for Parser
Source§impl VectorIntoWasmAbi for Parser
impl VectorIntoWasmAbi for Parser
impl SupportsConstructor for Parser
impl SupportsInstanceProperty for Parser
impl SupportsStaticProperty for Parser
Auto Trait Implementations§
impl !Freeze for Parser
impl !RefUnwindSafe for Parser
impl Send for Parser
impl Sync for Parser
impl Unpin for Parser
impl UnsafeUnpin for Parser
impl UnwindSafe for Parser
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.