Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/prototype/AirlockPowerdown.tq
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ node1_htr_avail_16 :
# Inhibiting Node 1 B HTRS (1 to 6)

@pcs
{ foreach node in seq(6) }
{ foreach node in seq(1, 6) }
1. Check Availability
2. Perform { cmd("Inhibit") }
3. Check Availability
Expand All @@ -32,7 +32,7 @@ node1_htr_avail_79 :
# Inhibiting Node 1 B HTRS (7 to 9)

@pcs
{ foreach node in seq(9) }
{ foreach node in seq(7, 9) }
1. Check Availability
2. Perform { cmd("Inhibit") }
3. Check Availability
Expand Down
14 changes: 14 additions & 0 deletions src/parsing/checks/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1174,6 +1174,20 @@ echo "Done"```) }"#,
}))
);

// Test function with multiple integer parameters
input.initialize("{ seq(1, 6) }");
let result = input.read_code_block();
assert_eq!(
result,
Ok(Expression::Execution(Function {
target: Identifier("seq"),
parameters: vec![
Expression::Number(Numeric::Integral(1)),
Expression::Number(Numeric::Integral(6))
]
}))
);

// Test function with decimal quantity parameter
input.initialize("{ wait(2.5 s, \"yes\") }");
let result = input.read_code_block();
Expand Down
17 changes: 15 additions & 2 deletions src/parsing/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2433,9 +2433,22 @@ impl<'i> Parser<'i> {
inner.parse_string_pieces(inner.source)
})?;
params.push(Expression::String(parts));
} else if is_numeric(content) {
let numeric = outer.read_numeric()?;
} else if is_numeric_quantity(content) {
let numeric = outer.read_numeric_quantity()?;
params.push(Expression::Number(numeric));
} else if is_numeric_integral(content)
|| content
.as_bytes()
.first()
.is_some_and(|b| b.is_ascii_digit())
|| content.starts_with('-')
&& content
.as_bytes()
.get(1)
.is_some_and(|b| b.is_ascii_digit())
{
let decimal = outer.read_decimal_part()?;
params.push(Expression::Number(Numeric::Integral(decimal.number)));
} else {
let name = outer.read_identifier()?;
params.push(Expression::Variable(name));
Expand Down
Loading