mirror of
https://github.com/Dummi26/mers.git
synced 2025-03-10 14:13:52 +01:00
default fn args are now empty instead of args [string ...]
This commit is contained in:
parent
7f3eccded8
commit
77178addac
@ -14,6 +14,9 @@ pub type GSInfo = Arc<GlobalScriptInfo>;
|
||||
|
||||
pub struct GlobalScriptInfo {
|
||||
pub libs: Vec<crate::libs::Lib>,
|
||||
|
||||
pub main_fn_args: Vec<(String, VType)>,
|
||||
|
||||
pub lib_fns: HashMap<String, (usize, usize)>,
|
||||
|
||||
pub enum_variants: HashMap<String, usize>,
|
||||
@ -92,6 +95,7 @@ impl Default for GlobalScriptInfo {
|
||||
Self {
|
||||
libs: vec![],
|
||||
lib_fns: HashMap::new(),
|
||||
main_fn_args: vec![],
|
||||
enum_variants: Self::default_enum_variants(),
|
||||
custom_type_names: HashMap::new(),
|
||||
custom_types: vec![],
|
||||
|
@ -5,9 +5,9 @@ mod parsing;
|
||||
mod pathutil;
|
||||
|
||||
pub use inlib::MyLib;
|
||||
pub use lang::{global_info::GlobalScriptInfo, val_data::*, val_type::*};
|
||||
pub use lang::{fmtgs, global_info::GlobalScriptInfo, val_data::*, val_type::*};
|
||||
pub use libs::comms::{ByteData, ByteDataA, Message, RespondableMessage};
|
||||
pub use parsing::*;
|
||||
pub use parsing::{parse::*, *};
|
||||
|
||||
pub mod prelude {
|
||||
pub use super::{
|
||||
|
@ -2,6 +2,7 @@ use lang::global_info::ColorFormatMode;
|
||||
use lang::global_info::GlobalScriptInfo;
|
||||
use lang::global_info::LogKind;
|
||||
use lang::val_data::VDataEnum;
|
||||
use lang::val_type::VSingleType;
|
||||
|
||||
use crate::lang::fmtgs::FormatGs;
|
||||
|
||||
@ -189,6 +190,10 @@ fn normal_main() {
|
||||
}
|
||||
}
|
||||
};
|
||||
info.main_fn_args = vec![(
|
||||
"args".to_string(),
|
||||
VSingleType::List(VSingleType::Any.into()).to(),
|
||||
)];
|
||||
match parsing::parse::parse_custom_info(&mut file, info) {
|
||||
Ok(script) => {
|
||||
if run {
|
||||
|
@ -31,6 +31,7 @@ impl Display for FilePosition {
|
||||
}
|
||||
|
||||
impl File {
|
||||
/// creates a file from its contents and its path. Path can be PathBuf::new(), but this disables relative MersLibs.
|
||||
pub fn new(data: String, path: PathBuf) -> Self {
|
||||
let data = if data.starts_with("#!") {
|
||||
&data[data.lines().next().unwrap().len()..].trim_start()
|
||||
|
@ -187,10 +187,7 @@ pub fn parse_step_interpret(
|
||||
ginfo: &GlobalScriptInfo,
|
||||
) -> Result<SFunction, ParseError> {
|
||||
let o = SFunction::new(
|
||||
vec![(
|
||||
"args".to_string(),
|
||||
VSingleType::List(VSingleType::Any.into()).to(),
|
||||
)],
|
||||
ginfo.main_fn_args.clone(),
|
||||
SStatementEnum::Block(parse_block_advanced(file, Some(false), true, true, false)?).to(),
|
||||
);
|
||||
if ginfo.log.after_parse.log() {
|
||||
|
Loading…
Reference in New Issue
Block a user