mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
add: vm struct for auto indent
Indents are important, so force them to be For this purpose, added the struct to classify and handle block kind
This commit is contained in:
parent
6dd71f12e9
commit
7d88cb9541
3 changed files with 247 additions and 65 deletions
|
@ -137,6 +137,25 @@ impl Input {
|
|||
pub fn repl() -> Self {
|
||||
Self::REPL(random())
|
||||
}
|
||||
pub fn lineno(&self) -> usize {
|
||||
GLOBAL_STDIN.lineno()
|
||||
}
|
||||
|
||||
pub fn block_begin(&self) -> usize {
|
||||
GLOBAL_STDIN.block_begin()
|
||||
}
|
||||
|
||||
pub fn set_block_begin(&self) {
|
||||
GLOBAL_STDIN.set_block_begin(self.lineno())
|
||||
}
|
||||
|
||||
pub fn insert_whitespace(&self, whitespace: &str) {
|
||||
GLOBAL_STDIN.insert_whitespace(whitespace);
|
||||
}
|
||||
|
||||
pub fn set_indent(&self, indent: usize) {
|
||||
GLOBAL_STDIN.set_indent(indent);
|
||||
}
|
||||
|
||||
pub fn path(&self) -> Option<&Path> {
|
||||
match self {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue