more keyword pseudocode
This commit is contained in:
parent
9b88b4eca6
commit
b3b59c8f9c
|
@ -287,6 +287,15 @@ pub(crate) fn compile_for(
|
||||||
redirect_modes: RedirectModes,
|
redirect_modes: RedirectModes,
|
||||||
io_reg: RegId,
|
io_reg: RegId,
|
||||||
) -> Result<(), CompileError> {
|
) -> Result<(), CompileError> {
|
||||||
|
// Pseudocode:
|
||||||
|
//
|
||||||
|
// %stream_reg <- <in_expr>
|
||||||
|
// LOOP: iterate %io_reg, %stream_reg, END
|
||||||
|
// store-variable $var, %io_reg
|
||||||
|
// %io_reg <- <...block...>
|
||||||
|
// drain %io_reg
|
||||||
|
// jump LOOP
|
||||||
|
// END:
|
||||||
let invalid = || CompileError::InvalidKeywordCall {
|
let invalid = || CompileError::InvalidKeywordCall {
|
||||||
keyword: "for".into(),
|
keyword: "for".into(),
|
||||||
span: call.head,
|
span: call.head,
|
||||||
|
@ -379,6 +388,10 @@ pub(crate) fn compile_return(
|
||||||
redirect_modes: RedirectModes,
|
redirect_modes: RedirectModes,
|
||||||
io_reg: RegId,
|
io_reg: RegId,
|
||||||
) -> Result<(), CompileError> {
|
) -> Result<(), CompileError> {
|
||||||
|
// Pseudocode:
|
||||||
|
//
|
||||||
|
// %io_reg <- <arg_expr>
|
||||||
|
// return %io_reg
|
||||||
if let Some(arg_expr) = call.positional_nth(0) {
|
if let Some(arg_expr) = call.positional_nth(0) {
|
||||||
compile_expression(
|
compile_expression(
|
||||||
working_set,
|
working_set,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user