What have I undertook
added stuff, fixed more bugs, more documentation, more pain and suffering This is taking too long, but ill push through hahahahahahahahha
This commit is contained in:
parent
ced07851a7
commit
ac7118092a
0
New Text Document.txt
Normal file
0
New Text Document.txt
Normal file
@ -1 +0,0 @@
|
||||
hi
|
||||
@ -14,6 +14,52 @@ parseManager.methods={}
|
||||
parseManager.lastCall=nil
|
||||
parseManager.currentHandle=nil
|
||||
parseManager.currentHandleName=nil
|
||||
parseManager.state = {}
|
||||
parseManager.active = true
|
||||
function parseManager:mainRunner(block)
|
||||
local t = self:next(block)
|
||||
if not t then return nil end
|
||||
if t.Type=="text" then
|
||||
io.write(t.text)
|
||||
io.read()
|
||||
t=self:next()
|
||||
elseif t.Type=="condition" then
|
||||
t=self:next()
|
||||
elseif t.Type=="assignment" then
|
||||
t=self:next()
|
||||
elseif t.Type=="label" then
|
||||
t=self:next()
|
||||
elseif t.Type=="method" then
|
||||
t=self:next()
|
||||
elseif t.Type=="choice" then
|
||||
print(t.text)
|
||||
for i=1,#t.choices do
|
||||
print(i..". "..t.choices[i])
|
||||
end
|
||||
io.write("Choose#: ")
|
||||
cm=tonumber(io.read())
|
||||
t=self:next(nil,cm,nil,t)
|
||||
elseif t.Type=="end" then
|
||||
if t.text=="leaking" then -- go directly to the block right under the current block if it exists
|
||||
t=self:next()
|
||||
else
|
||||
os.exit()
|
||||
end
|
||||
elseif t.Type=="error" then
|
||||
error(t.text)
|
||||
else
|
||||
t=self:next()
|
||||
end
|
||||
-- if true return t, else return false
|
||||
return self.active and t
|
||||
end
|
||||
function parseManager:run(block)
|
||||
local dat = self:mainRunner(block)
|
||||
while dat do
|
||||
dat = self:mainRunner()
|
||||
end
|
||||
-- print("done")
|
||||
end
|
||||
function readonlytable(tab)
|
||||
return setmetatable({},{
|
||||
__index=tab,
|
||||
@ -28,9 +74,6 @@ function parseManager:debug(...)
|
||||
print("<DEBUG>",...)
|
||||
end
|
||||
end
|
||||
function parseManager:defualtRunner(func)
|
||||
--
|
||||
end
|
||||
function parseManager:newENV()
|
||||
local env={}
|
||||
function env:getParent()
|
||||
@ -1208,8 +1251,6 @@ function parseManager:next(block,choice)
|
||||
local args=self:dataToValue(data.args)
|
||||
local Func
|
||||
local Ext=false
|
||||
-- table.print(data.args)
|
||||
table.print(args)
|
||||
if type(data.Func)=="table" then
|
||||
Ext=true
|
||||
Func=self.currentENV[data.Func[1]][data.Func[2]]
|
||||
|
||||
14
test.dms
14
test.dms
@ -0,0 +1,14 @@
|
||||
ENTRY TEST
|
||||
[TEST]{
|
||||
newLightThread("TEST2")
|
||||
::loop::
|
||||
print("Hello!")
|
||||
sleep(.5)
|
||||
GOTO("loop")
|
||||
}
|
||||
[TEST2]{
|
||||
::loop::
|
||||
print("Hi!")
|
||||
sleep(1)
|
||||
GOTO("loop")
|
||||
}
|
||||
76
test.lua
76
test.lua
@ -1,36 +1,25 @@
|
||||
package.path="?/init.lua;lua/?/init.lua;lua/?.lua;"..package.path
|
||||
local bin = require("bin")
|
||||
--~ local multi = require("multi")
|
||||
local multi = require("multi")
|
||||
require("parseManager")
|
||||
require("bit")
|
||||
--~ parseManager:define({
|
||||
--~ rshift=function(self,a,b)
|
||||
--~ return bit.rshift(a,b)
|
||||
--~ end,
|
||||
--~ lshift=function(self,a,b)
|
||||
--~ return bit.lshift(a,b)
|
||||
--~ end,
|
||||
--~ testfunc=function(self,a,b,c)
|
||||
--~ print(tostring(a).." "..tostring(b).." "..tostring(c))
|
||||
--~ end
|
||||
--~ })
|
||||
test=parseManager:load("textadventure.dms")
|
||||
test=parseManager:load("test.dms")
|
||||
print(test:dump())
|
||||
t=test:next()
|
||||
while true do
|
||||
if not t then break end
|
||||
--Code would happen here anyway
|
||||
local runner = function(block,t)
|
||||
if not t then return nil end
|
||||
if t.Type=="text" then
|
||||
io.write(t.text)
|
||||
io.read()
|
||||
t=test:next()
|
||||
t=self:next()
|
||||
elseif t.Type=="condition" then
|
||||
t=test:next()
|
||||
t=self:next()
|
||||
elseif t.Type=="assignment" then
|
||||
t=test:next()
|
||||
t=self:next()
|
||||
elseif t.Type=="label" then
|
||||
t=test:next()
|
||||
t=self:next()
|
||||
elseif t.Type=="method" then
|
||||
t=test:next()
|
||||
t=self:next()
|
||||
elseif t.Type=="choice" then
|
||||
print(t.text)
|
||||
for i=1,#t.choices do
|
||||
@ -38,19 +27,52 @@ while true do
|
||||
end
|
||||
io.write("Choose#: ")
|
||||
cm=tonumber(io.read())
|
||||
t=test:next(nil,cm,nil,t)
|
||||
t=self:next(nil,cm,nil,t)
|
||||
elseif t.Type=="end" then
|
||||
if t.text=="leaking" then -- go directly to the block right under the current block if it exists
|
||||
t=test:next()
|
||||
t=self:next()
|
||||
else
|
||||
os.exit()
|
||||
end
|
||||
elseif t.Type=="error" then
|
||||
error(t.text)
|
||||
else
|
||||
t=test:next()
|
||||
t=self:next()
|
||||
end
|
||||
return t
|
||||
end
|
||||
--["vars"]={"\1%"..string.char(mathAss+64)}
|
||||
--cmds[#cmds+1]={Func="MOD",args={l,(r or "")}}
|
||||
--
|
||||
test.mainRunner = runner
|
||||
test.active = false
|
||||
multi:newThread("Parse Manager Main State",function()
|
||||
local dat = self:mainRunner(nil,self:next())
|
||||
while dat do
|
||||
thread.skip()
|
||||
dat = self:mainRunner(nil,dat)
|
||||
end
|
||||
end)
|
||||
function test:run()
|
||||
multi:mainloop()
|
||||
end
|
||||
test:define{
|
||||
sleep = function(self,n)
|
||||
thread.sleep(n)
|
||||
end,
|
||||
newLightThread = function(self,block)
|
||||
local state = parseManager:load(self.currentChunk.path)
|
||||
state.mainENV = self.mainENV
|
||||
state.mainRunner = runner
|
||||
multi:newThread("Parse Manager State",function()
|
||||
local dat = state:mainRunner(nil,state:next())
|
||||
while dat do
|
||||
thread.skip()
|
||||
dat = state:mainRunner(nil,dat)
|
||||
end
|
||||
end)
|
||||
end
|
||||
}
|
||||
--End of injecting
|
||||
--~ test:run()
|
||||
multi:newThread("",function()
|
||||
print("Threading works")
|
||||
end)
|
||||
multi:mainloop()
|
||||
|
||||
16
test2.lua
16
test2.lua
@ -1,8 +1,8 @@
|
||||
local GLOBAL, sThread = require("multi.integration.lanesManager").init()
|
||||
GLOBAL["Test"]=true
|
||||
multi:newSystemThread("NewThread",function(blck,path,name)
|
||||
print(GLOBAL["Test"])
|
||||
end)
|
||||
--~ local GLOBAL, sThread = require("multi.integration.lanesManager").init()
|
||||
--~ GLOBAL["Test"]=true
|
||||
--~ multi:newSystemThread("NewThread",function(blck,path,name)
|
||||
--~ print(GLOBAL["Test"])
|
||||
--~ end)
|
||||
--~ io.flush()
|
||||
--~ i = io.input()
|
||||
--~ i:seek("cur")
|
||||
@ -19,3 +19,9 @@ end)
|
||||
--~ io.write("\b")
|
||||
--~ io.flush()
|
||||
--~ io.read()
|
||||
bool = true
|
||||
function test()
|
||||
local t = {}
|
||||
return bool and t
|
||||
end
|
||||
print(test())
|
||||
|
||||
@ -6,25 +6,28 @@ ENTRY MAIN
|
||||
print("We cannot use the filesystem or the extendedDefine module! Exiting program!")
|
||||
QUIT()
|
||||
::define::
|
||||
// USING filesystem as bin
|
||||
// USING extendedDefine
|
||||
// setVar("name","Thread Test")
|
||||
// newThread("LoopTest")
|
||||
// in = getInput("Enter Something: ")
|
||||
// file = bin.new(in)
|
||||
// file:tofile("WeCanWriteEm.txt")
|
||||
"Let's test simple object creation"
|
||||
obj = []
|
||||
obj.test = say
|
||||
obj.test("Hello!")
|
||||
"Hmm..."
|
||||
USING filesystem as bin
|
||||
USING extendedDefine
|
||||
setVar("name","Thread Test")
|
||||
newThread("LoopTest")
|
||||
in = getInput("Enter Something: ")
|
||||
file = bin.new(in)
|
||||
file:tofile("WeCanWriteEm.txt")
|
||||
test(1,2)
|
||||
"We are here now"
|
||||
"why no work"
|
||||
"?"
|
||||
}
|
||||
// [LoopTest]{
|
||||
// a=0
|
||||
// name = getVar("name")
|
||||
// ::loop::
|
||||
// a=a+1
|
||||
// test("$name$ $a$")
|
||||
// sleep(1)
|
||||
// GOTO("loop")
|
||||
// }
|
||||
[test:function(a,b)]{
|
||||
print("This works right? $a$ $b$")
|
||||
return True
|
||||
}
|
||||
[LoopTest]{
|
||||
a=0
|
||||
name = getVar("name")
|
||||
::loop::
|
||||
a=a+1
|
||||
test("$name$ $a$")
|
||||
sleep(1)
|
||||
GOTO("loop")
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user