rustfmt
Signed-off-by: Ava Hahn <ava@aidanis.online>
This commit is contained in:
parent
ecbc47d4fe
commit
bc09cb07b1
17 changed files with 236 additions and 217 deletions
|
|
@ -17,8 +17,8 @@
|
|||
|
||||
use crate::eval::eval;
|
||||
use crate::lex::lex;
|
||||
use crate::segment::{Seg, Ctr};
|
||||
use crate::sym::{SymTable, ValueType, Args, Symbol};
|
||||
use crate::segment::{Ctr, Seg};
|
||||
use crate::sym::{Args, SymTable, Symbol, ValueType};
|
||||
use std::fs;
|
||||
use std::io;
|
||||
use std::rc::Rc;
|
||||
|
|
@ -29,28 +29,38 @@ fn prompt_default_callback(_: &Seg, _: &mut SymTable) -> Result<Ctr, String> {
|
|||
|
||||
/* loads defaults, evaluates config script */
|
||||
pub fn configure(filename: String, syms: &mut SymTable) -> Result<(), String> {
|
||||
syms.insert("CFG_RELISH_POSIX".to_string(), Symbol {
|
||||
name: String::from("CFG_RELISH_POSIX"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
value: ValueType::VarForm(Box::new(Ctr::String("0".to_string()))),
|
||||
});
|
||||
syms.insert(
|
||||
"CFG_RELISH_POSIX".to_string(),
|
||||
Symbol {
|
||||
name: String::from("CFG_RELISH_POSIX"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
value: ValueType::VarForm(Box::new(Ctr::String("0".to_string()))),
|
||||
},
|
||||
);
|
||||
|
||||
syms.insert("CFG_RELISH_ENV".to_string(), Symbol {
|
||||
name: String::from("CFG_RELISH_ENV"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
value: ValueType::VarForm(Box::new(Ctr::String("1".to_string()))),
|
||||
});
|
||||
syms.insert(
|
||||
"CFG_RELISH_ENV".to_string(),
|
||||
Symbol {
|
||||
name: String::from("CFG_RELISH_ENV"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
value: ValueType::VarForm(Box::new(Ctr::String("1".to_string()))),
|
||||
},
|
||||
);
|
||||
|
||||
syms.insert("CFG_RELISH_PROMPT".to_string(), Symbol {
|
||||
name: String::from("default relish prompt"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
value: ValueType::Internal(Rc::new(prompt_default_callback)),
|
||||
});
|
||||
syms.insert(
|
||||
"CFG_RELISH_PROMPT".to_string(),
|
||||
Symbol {
|
||||
name: String::from("default relish prompt"),
|
||||
args: Args::None,
|
||||
conditional_branches: false,
|
||||
value: ValueType::Internal(Rc::new(prompt_default_callback)),
|
||||
},
|
||||
);
|
||||
|
||||
let config_document = fs::read_to_string(filename).unwrap_or_else(|err: io::Error| err.to_string());
|
||||
let config_document =
|
||||
fs::read_to_string(filename).unwrap_or_else(|err: io::Error| err.to_string());
|
||||
let config_tree = lex(&config_document)?;
|
||||
let config_result = eval(&config_tree, syms)?;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue