diff --git a/CoreHelpers.tl b/CoreHelpers.tl index 812f70c..fffc380 100644 --- a/CoreHelpers.tl +++ b/CoreHelpers.tl @@ -11,7 +11,7 @@ function CoreHelpers.defineWord(dict: Dictionary, str: string, func: function(En end function CoreHelpers.standardInputRefill(): string - io.write("\n") + io.write("\nok> ") local input = io.read().."\n" return input end diff --git a/CoreWords.tl b/CoreWords.tl index a2bab9f..bebcba8 100644 --- a/CoreWords.tl +++ b/CoreWords.tl @@ -327,6 +327,17 @@ local function forthRepeat(e: Environment) patchBranch(e) end +local function stringLiteral(e: Environment) + local str: string | nil = "" + local chr: string | nil = "" + if not e.activeInputStream:curr() then e.activeDataStack:push("") end + while(not (chr == "\"") and chr ~= nil) do + str = str..(chr as string) + chr = e.activeInputStream:next() + end + e.activeInputStream:next() + e.activeDataStack:push(str as string) +end local CoreWords = Dictionary:new() local addInfo = WordInfo:new(add, false) @@ -373,6 +384,7 @@ defineWord(CoreWords,"=", cmpe, false) defineWord(CoreWords,">=", cmpgte, false) defineWord(CoreWords,">", cmpgt, false) defineWord(CoreWords,"<>", cmpne, false) +defineWord(CoreWords,"S\"", stringLiteral, false) CoreWords:define("+", addInfo)