Struct Transpiler

Source
pub struct Transpiler {
    pub cfg: ErgConfig,
    /* private fields */
}
Expand description

Generates a PyScript from an String or other File inputs.

Fields§

§cfg: ErgConfig

Implementations§

Source§

impl Transpiler

Source

pub fn new(cfg: ErgConfig) -> Self

Source

pub fn new_with_cache( cfg: ErgConfig, mod_name: Str, shared: SharedCompilerResource, ) -> Self

Source

pub fn transpile( &mut self, src: String, mode: &str, ) -> Result<CompleteArtifact<TranspiledFile>, ErrorArtifact>

Source

pub fn transpile_from_ast( &mut self, ast: AST, mode: &str, ) -> Result<CompleteArtifact<TranspiledFile>, ErrorArtifact>

Source

pub fn transpile_module( &mut self, ) -> Result<CompleteArtifact<TranspiledFile>, ErrorArtifact>

Source

pub fn pop_mod_ctx(&mut self) -> Option<ModuleContext>

Source

pub fn dir(&mut self) -> HashMap<&VarName, &VarInfo>

Source

pub fn get_receiver_ctx(&self, receiver_name: &str) -> Option<&Context>

Source

pub fn get_var_info(&self, name: &str) -> Option<(&VarName, &VarInfo)>

Trait Implementations§

Source§

impl BuildRunnable<TranspiledFile> for Transpiler

Source§

impl Buildable<TranspiledFile> for Transpiler

Source§

impl ContextProvider for Transpiler

Source§

fn dir(&self) -> HashMap<&VarName, &VarInfo>

Source§

fn get_receiver_ctx(&self, receiver_name: &str) -> Option<&Context>

Source§

fn get_var_info(&self, name: &str) -> Option<(&VarName, &VarInfo)>

Source§

fn has(&self, name: &str) -> bool

Source§

impl Debug for Transpiler

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Transpiler

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl New for Transpiler

Source§

fn new(cfg: ErgConfig) -> Self

Source§

impl Runnable for Transpiler

Source§

const NAME: &'static str = "Erg transpiler"

Source§

type Err = CompileError

Source§

type Errs = CompileErrors

Source§

fn cfg(&self) -> &ErgConfig

Source§

fn cfg_mut(&mut self) -> &mut ErgConfig

Source§

fn finish(&mut self)

Source§

fn initialize(&mut self)

Erase all but immutable information.
Source§

fn clear(&mut self)

Erase information that will no longer be meaningful in the next iteration
Source§

fn exec(&mut self) -> Result<ExitStatus, Self::Errs>

Source§

fn eval(&mut self, src: String) -> Result<String, CompileErrors>

Source§

fn expect_block(&self, src: &str) -> BlockKind

Source§

fn input(&self) -> &Input

Source§

fn set_input(&mut self, input: Input)

Source§

fn start_message(&self) -> String

Source§

fn ps1(&self) -> String

Source§

fn ps2(&self) -> String

Source§

fn quit(&mut self, code: i32) -> !

Source§

fn quit_successfully(&mut self, output: BufWriter<StdoutLock<'_>>) -> !

Source§

fn run(cfg: ErgConfig) -> ExitStatus

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.