def _until_demo(): """ demonstrate the until function """ print("get until what?") char = pmlr._read_keypress() pmlr._writer(char + "\n") y = pmlr.until(char) print("\n" + y)
def _forth_syntax_test(): """ in the programming language Forth, `function` definitons start at the beginning of a line with a `:` colon and go until the next semicolon. this is an example of how this module can be used in a Forth REPL to compile statements specially; it's implemented in catb0t/microcat as well. """ pmlr._writer("demo FORTH repl \n> ") firstchar = pmlr._read_keypress() pmlr._writer(firstchar) if firstchar != ":": print("\nreturned because first char wasn't ':'") return defn = firstchar + pmlr.until(";") + ";" pmlr._writer("\nrepl got:\n" + defn + "\n")