mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
Merge branch 'main' into pylyzer-mode
This commit is contained in:
commit
3d69353bf6
9 changed files with 36 additions and 0 deletions
|
@ -386,6 +386,7 @@ pub trait Runnable: Sized + Default {
|
||||||
const NAME: &'static str;
|
const NAME: &'static str;
|
||||||
fn new(cfg: ErgConfig) -> Self;
|
fn new(cfg: ErgConfig) -> Self;
|
||||||
fn cfg(&self) -> &ErgConfig;
|
fn cfg(&self) -> &ErgConfig;
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig;
|
||||||
fn finish(&mut self); // called when the :exit command is received.
|
fn finish(&mut self); // called when the :exit command is received.
|
||||||
/// Erase all but immutable information.
|
/// Erase all but immutable information.
|
||||||
fn initialize(&mut self);
|
fn initialize(&mut self);
|
||||||
|
@ -397,6 +398,9 @@ pub trait Runnable: Sized + Default {
|
||||||
fn input(&self) -> &Input {
|
fn input(&self) -> &Input {
|
||||||
&self.cfg().input
|
&self.cfg().input
|
||||||
}
|
}
|
||||||
|
fn set_input(&mut self, input: Input) {
|
||||||
|
self.cfg_mut().input = input;
|
||||||
|
}
|
||||||
fn start_message(&self) -> String {
|
fn start_message(&self) -> String {
|
||||||
format!(
|
format!(
|
||||||
"{} {SEMVER} (tags/?:{GIT_HASH_SHORT}, {BUILD_DATE}) on {ARCH}/{OS}\n",
|
"{} {SEMVER} (tags/?:{GIT_HASH_SHORT}, {BUILD_DATE}) on {ARCH}/{OS}\n",
|
||||||
|
|
|
@ -40,6 +40,10 @@ impl Runnable for HIRBuilder {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
self.lowerer.cfg()
|
self.lowerer.cfg()
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
self.lowerer.cfg_mut()
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn finish(&mut self) {}
|
fn finish(&mut self) {}
|
||||||
|
|
|
@ -127,6 +127,10 @@ impl Runnable for Compiler {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
&self.cfg
|
&self.cfg
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
&mut self.cfg
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn finish(&mut self) {}
|
fn finish(&mut self) {}
|
||||||
|
|
|
@ -71,6 +71,10 @@ impl Runnable for ASTLowerer {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
&self.cfg
|
&self.cfg
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
&mut self.cfg
|
||||||
|
}
|
||||||
|
|
||||||
fn new(cfg: ErgConfig) -> Self {
|
fn new(cfg: ErgConfig) -> Self {
|
||||||
Self::new_with_cache(
|
Self::new_with_cache(
|
||||||
|
|
|
@ -124,6 +124,10 @@ impl Runnable for Transpiler {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
&self.cfg
|
&self.cfg
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
&mut self.cfg
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn finish(&mut self) {}
|
fn finish(&mut self) {}
|
||||||
|
|
|
@ -29,6 +29,10 @@ impl Runnable for ASTBuilder {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
self.runner.cfg()
|
self.runner.cfg()
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
self.runner.cfg_mut()
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn finish(&mut self) {}
|
fn finish(&mut self) {}
|
||||||
|
|
|
@ -33,6 +33,10 @@ impl Runnable for LexerRunner {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
&self.cfg
|
&self.cfg
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
&mut self.cfg
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn finish(&mut self) {}
|
fn finish(&mut self) {}
|
||||||
|
|
|
@ -183,6 +183,10 @@ impl Runnable for ParserRunner {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
&self.cfg
|
&self.cfg
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
&mut self.cfg
|
||||||
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn finish(&mut self) {}
|
fn finish(&mut self) {}
|
||||||
|
|
|
@ -48,6 +48,10 @@ impl Runnable for DummyVM {
|
||||||
fn cfg(&self) -> &ErgConfig {
|
fn cfg(&self) -> &ErgConfig {
|
||||||
&self.compiler.cfg
|
&self.compiler.cfg
|
||||||
}
|
}
|
||||||
|
#[inline]
|
||||||
|
fn cfg_mut(&mut self) -> &mut ErgConfig {
|
||||||
|
&mut self.compiler.cfg
|
||||||
|
}
|
||||||
|
|
||||||
fn new(cfg: ErgConfig) -> Self {
|
fn new(cfg: ErgConfig) -> Self {
|
||||||
let stream = if cfg.input.is_repl() {
|
let stream = if cfg.input.is_repl() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue