mirror of
https://github.com/Dummi26/mers.git
synced 2025-12-15 03:36:16 +01:00
updated site + added docs/builtins.md + statements can end with ',' to differentiate '1, -2' from '1 - 2' == '-1'.
This commit is contained in:
@@ -1603,7 +1603,7 @@ impl BuiltinFunction {
|
||||
let left = if left >= 0 {
|
||||
left as usize
|
||||
} else {
|
||||
(a.len() - 1).saturating_sub(left.abs() as _)
|
||||
a.len().saturating_sub(left.abs() as _)
|
||||
};
|
||||
if let Some(len) = len {
|
||||
if len >= 0 {
|
||||
|
||||
@@ -280,7 +280,8 @@ impl FormatGs for SStatement {
|
||||
write!(f, " -> ")?;
|
||||
force_opt.fmtgs(f, info, form, file)?;
|
||||
}
|
||||
self.statement.fmtgs(f, info, form, file)
|
||||
self.statement.fmtgs(f, info, form, file)?;
|
||||
write!(f, ",")
|
||||
}
|
||||
}
|
||||
impl Display for SStatement {
|
||||
|
||||
@@ -583,7 +583,7 @@ pub mod implementation {
|
||||
let mut start = String::new();
|
||||
loop {
|
||||
fn is_delimeter(ch: char) -> bool {
|
||||
matches!(ch, '}' | ']' | ')' | '.')
|
||||
matches!(ch, '}' | ']' | ')' | '.' | ',')
|
||||
}
|
||||
let nchar = match file.peek() {
|
||||
Some(ch) if is_delimeter(ch) => Some(ch),
|
||||
@@ -596,16 +596,18 @@ pub mod implementation {
|
||||
parse_statement(file)?,
|
||||
)));
|
||||
}
|
||||
Some(ch)
|
||||
if (ch.is_whitespace() || is_delimeter(ch)) && start.trim().is_empty() =>
|
||||
{
|
||||
return Err(ParseError {
|
||||
err: ParseErrors::StatementCannotStartWith(ch),
|
||||
location: *file.get_pos(),
|
||||
location_end: None,
|
||||
context: vec![],
|
||||
info: None,
|
||||
});
|
||||
}
|
||||
Some(ch) if ch.is_whitespace() || is_delimeter(ch) => {
|
||||
if start.trim().is_empty() {
|
||||
return Err(ParseError {
|
||||
err: ParseErrors::StatementCannotStartWith(ch),
|
||||
location: *file.get_pos(),
|
||||
location_end: None,
|
||||
context: vec![],
|
||||
info: None,
|
||||
});
|
||||
}
|
||||
file.skip_whitespaces();
|
||||
// parse normal statement
|
||||
let start = start.trim();
|
||||
@@ -853,6 +855,10 @@ pub mod implementation {
|
||||
// 080 .
|
||||
// most local (evaluated first)
|
||||
out = match (chain_level, file.peek()) {
|
||||
(_, Some(',')) => {
|
||||
file.next();
|
||||
break;
|
||||
}
|
||||
// 080 .
|
||||
(0..=80, Some('.'))
|
||||
if !matches!(
|
||||
|
||||
Reference in New Issue
Block a user