[−][src]Trait swc_ecma_parser::Tokens
Clone should be cheap if you are parsing typescript because typescript syntax requires backtracking.
Required methods
pub fn set_ctx(&mut self, ctx: Context)
[src]
pub fn ctx(&self) -> Context
[src]
pub fn syntax(&self) -> Syntax
[src]
pub fn target(&self) -> JscTarget
[src]
pub fn set_expr_allowed(&mut self, allow: bool)
[src]
pub fn token_context(&self) -> &TokenContexts
[src]
pub fn token_context_mut(&mut self) -> &mut TokenContexts
[src]
pub fn set_token_context(&mut self, _c: TokenContexts)
[src]
pub fn add_error(&self, error: Error)
[src]
Implementors should use Rc<RefCell<Vec
It is required because parser should backtrack while parsing typescript code.
pub fn add_module_mode_error(&self, error: Error)
[src]
Add an error which is valid syntax in script mode.
This errors should be dropped if it's not a moduloe.
Implementor should check for if Context.module, and buffer errors if module is false. Also, implementors should move errors to the error buffer on set_ctx if the parser mode become module mode.