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:
GreasrySlug 2023-01-31 09:35:17 +09:00
parent 6dd71f12e9
commit 7d88cb9541
3 changed files with 247 additions and 65 deletions

View file

@ -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 {