From 2c3f1edd81e620574edd46374c7ba8660913559b Mon Sep 17 00:00:00 2001 From: Hybrid Dog Date: Mon, 26 Jun 2017 19:39:20 +0200 Subject: [PATCH] Fix true and false --- README.md | 1 + parser.lua | 6 +++--- util/standartbefehlssatz_doc.lua | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 677130e..362fe44 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,7 @@ true/false: boolean (immediate) 12.6: number (immediate) $hello nwae: string (immediate) nodolla: either a label is called so (immediate) or it's a variable +If you want to use : in a string, you need to put it at the beginning of the line to not treat the left part as label ``` Types: diff --git a/parser.lua b/parser.lua index aefe561..7240c57 100644 --- a/parser.lua +++ b/parser.lua @@ -37,9 +37,9 @@ local function parse_zeile(marken, imms, z, ip) local arg = args[i]:trim() if #arg == 0 or arg == "false" then - arg = false + arg = -1 elseif arg == "true" then - arg = true + arg = -2 elseif arg:sub(1, 1) == "$" then imms[immn] = arg:sub(2) arg = immn @@ -74,7 +74,7 @@ local function zeileniter(text) end return function(programm) - local imms = {} + local imms = {[-2] = true, [-1] = false} local marken = {} -- Programm erkennen diff --git a/util/standartbefehlssatz_doc.lua b/util/standartbefehlssatz_doc.lua index e3335f1..b54b4de 100644 --- a/util/standartbefehlssatz_doc.lua +++ b/util/standartbefehlssatz_doc.lua @@ -31,7 +31,7 @@ local instr = { {"neg", "", "var = not var"}, {"neg", "", "str = str:rev()"}, {"inv", "", "num = 1 / num"}, - {"mod", ", ", "num = num % dv"}, + {"mod", ", ", "num = num mod dv"}, {"jmp", "[, ]", "If c is not false, the instruction pointer is set to p. To disallow infinite loops, the program is interrupted after changing the ip, the mod should then consider restarting it."}, {"call", "[, ]", "push the ip, then jmp p; used to execute subroutines"}, {"ret", "", "pop something, then jmp there; used to exit subroutines"},