*input* stdin hack for Computer Class #61

Closed
opened 2024-05-31 17:18:56 +00:00 by scott · 6 comments
Owner

Pulling this out as a separate issue. Only requires work in Ludus-web, does not touch the interpreter. Still keeping it in this repo for the time being, since it solves a problem in language design & use.

*input* should be replaced in the source code sent to the WASM interpreter with whatever the user has typed in the "input" box.

Ensure escaping is correct:

  • Quotes are escaped with \"
  • Open curly braces are escaped with \{, else the string will be treated as a template string.
Pulling this out as a separate issue. Only requires work in Ludus-web, does not touch the interpreter. Still keeping it in this repo for the time being, since it solves a problem in language design & use. `*input*` should be replaced in the source code sent to the WASM interpreter with whatever the user has typed in the "input" box. Ensure escaping is correct: * [x] Quotes are escaped with `\"` * [x] Open curly braces are escaped with `\{`, else the string will be treated as a template string.
matt was assigned by scott 2024-05-31 17:19:02 +00:00
scott added this to the Computer Class milestone 2024-05-31 17:19:04 +00:00
Owner

This is done and working.

However, I ended up not adding anything specific to escape those characters, since it looks like that is happening in the js run function somewhere already? quotes and braces in the input box don't seem to break anything, unless it is invalid ludus in the place where the input is substituted.

This is done and working. However, I ended up not adding anything specific to escape those characters, since it looks like that is happening in the js `run` function somewhere already? quotes and braces in the input box don't seem to break anything, unless it is invalid ludus in the place where the input is substituted.
Owner

@scott -- do you want to check it out before i close the issue? i might be missing something with the escape characters... it's pushed to main now -- a1c829e457

@scott -- do you want to check it out before i close the issue? i might be missing something with the escape characters... it's pushed to main now -- https://alea.ludus.dev/twc/ludus-web/commit/a1c829e457498b483f5e047e6946564a92bdfd28
Author
Owner

There was a bug: we weren't quoting the input that's been replaced. I haven't done more robust escape testing. But things are wired up now, in 27b95515b0

There was a bug: we weren't quoting the input that's been replaced. I haven't done more robust escape testing. But things are wired up now, in https://alea.ludus.dev/twc/ludus-web/commit/27b95515b03ccff837c82a1846b63b5f90f49056
Author
Owner

" and { need escaping; will do that tomorrow.

`"` and `{` need escaping; will do that tomorrow.
scott self-assigned this 2024-06-11 00:34:52 +00:00
matt was unassigned by scott 2024-06-11 00:34:52 +00:00
Owner

" and { need escaping; will do that tomorrow.

is this best done in the janet side? or in the js side?

> `"` and `{` need escaping; will do that tomorrow. is this best done in the janet side? or in the js side?
Author
Owner

Done at some point in ludus-web; fixed underlying scanning issue in 9584a21521.

Done at some point in ludus-web; fixed underlying scanning issue in https://alea.ludus.dev/twc/ludus/commit/9584a215211f1c17485e100e0fafdccc721cb8e8.
scott closed this issue 2024-06-14 19:26:14 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: twc/ludus#61
No description provided.