Add support for self-modifying programs to core

This commit is contained in:
Nilay Majorwar
2022-01-26 20:01:53 +05:30
parent 45385a3266
commit 7b7475a4fb
4 changed files with 94 additions and 10 deletions

View File

@ -14,6 +14,14 @@ export type DocumentRange = {
charRange?: CharRange;
};
/** Type denoting a document edit */
export type DocumentEdit = {
/** Range to replace with the given text. Keep empty to insert text */
range: DocumentRange;
/** Text to replace the given range with */
text: string;
};
/** Source code token provider for the language, specific to Monaco */
export type MonacoTokensProvider = monaco.languages.IMonarchLanguage;
@ -30,6 +38,9 @@ export type StepExecutionResult<RS> = {
/** String to write to program output */
output?: string;
/** Self-modifying programs: edit to apply on code */
codeEdits?: DocumentEdit[];
/**
* Used to highlight next line to be executed in the editor.
* Passing `null` indicates reaching the end of program.