Stable ish 👍
This commit is contained in:
parent
ca279d07dc
commit
433ec4eb81
@ -1,4 +1,3 @@
|
|||||||
ENABLE leaking
|
|
||||||
[TEST]{
|
[TEST]{
|
||||||
"Jump was successful!"
|
"Jump was successful!"
|
||||||
--GOTO("HERE")
|
--GOTO("HERE")
|
||||||
@ -36,7 +35,8 @@ ENABLE leaking
|
|||||||
env=CreateENV()
|
env=CreateENV()
|
||||||
msg="Hi"
|
msg="Hi"
|
||||||
SetENV(env)
|
SetENV(env)
|
||||||
msg="Hello"
|
"BEFORE_CHANGE: $msg$"
|
||||||
|
msg=21+7
|
||||||
"IN_HERE $msg$"
|
"IN_HERE $msg$"
|
||||||
env=GetDefualtENV()
|
env=GetDefualtENV()
|
||||||
SetENV(env)
|
SetENV(env)
|
||||||
@ -44,7 +44,10 @@ ENABLE leaking
|
|||||||
test=CallMe("This","is a test!")
|
test=CallMe("This","is a test!")
|
||||||
"FENV: $test$"
|
"FENV: $test$"
|
||||||
"Did it work!"
|
"Did it work!"
|
||||||
QUIT()
|
"HMMM"
|
||||||
|
test=CallMe("This","is a test too!")
|
||||||
|
"FENV: $test$"
|
||||||
|
EXIT()
|
||||||
}
|
}
|
||||||
[CallMe:function(args1,args2)]{
|
[CallMe:function(args1,args2)]{
|
||||||
"function was called!"
|
"function was called!"
|
||||||
|
|||||||
@ -77,7 +77,7 @@ namespace parseManager
|
|||||||
void debug(object msg)
|
void debug(object msg)
|
||||||
{
|
{
|
||||||
if (_flags["debugging"])
|
if (_flags["debugging"])
|
||||||
Console.WriteLine("DEBUGGING: "+msg);
|
Console.WriteLine("DEBUGGING: " + msg);
|
||||||
}
|
}
|
||||||
void _Parse(string data)
|
void _Parse(string data)
|
||||||
{
|
{
|
||||||
@ -113,6 +113,7 @@ namespace parseManager
|
|||||||
try {
|
try {
|
||||||
StreamReader sr = File.OpenText(_filepath);
|
StreamReader sr = File.OpenText(_filepath);
|
||||||
_Parse(sr.ReadToEnd());
|
_Parse(sr.ReadToEnd());
|
||||||
|
sr.Close();
|
||||||
} catch (FileNotFoundException) {
|
} catch (FileNotFoundException) {
|
||||||
Console.WriteLine("File '" + _filepath + "' does not exist! Loading failled!");
|
Console.WriteLine("File '" + _filepath + "' does not exist! Loading failled!");
|
||||||
}
|
}
|
||||||
@ -122,6 +123,7 @@ namespace parseManager
|
|||||||
try {
|
try {
|
||||||
StreamReader sr = File.OpenText(filename);
|
StreamReader sr = File.OpenText(filename);
|
||||||
_Parse(sr.ReadToEnd());
|
_Parse(sr.ReadToEnd());
|
||||||
|
sr.Close();
|
||||||
} catch (FileNotFoundException) {
|
} catch (FileNotFoundException) {
|
||||||
Console.WriteLine("Load '" + filename + "' File not found. Loading failled!");
|
Console.WriteLine("Load '" + filename + "' File not found. Loading failled!");
|
||||||
}
|
}
|
||||||
@ -317,8 +319,10 @@ namespace parseManager
|
|||||||
}
|
}
|
||||||
var truth = truths[0];
|
var truth = truths[0];
|
||||||
if (truths.Length == 1 && truth) {
|
if (truths.Length == 1 && truth) {
|
||||||
|
//Console.WriteLine(funcif+"|"+ResolveVar(argsif)[0]);
|
||||||
InvokeNR(funcif, ResolveVar(argsif));
|
InvokeNR(funcif, ResolveVar(argsif));
|
||||||
} else if (truths.Length == 1) {
|
} else if (truths.Length == 1) {
|
||||||
|
//Console.WriteLine(funcelse + "|"+ResolveVar(argselse)[0]);
|
||||||
InvokeNR(funcelse, ResolveVar(argselse));
|
InvokeNR(funcelse, ResolveVar(argselse));
|
||||||
} else {
|
} else {
|
||||||
for (int i = 1; i < andors.Length; i++) {
|
for (int i = 1; i < andors.Length; i++) {
|
||||||
@ -331,10 +335,10 @@ namespace parseManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (truth) {
|
if (truth) {
|
||||||
Console.WriteLine(funcif);
|
//Console.WriteLine(funcif);
|
||||||
InvokeNR(funcif, ResolveVar(argsif));
|
InvokeNR(funcif, ResolveVar(argsif));
|
||||||
} else {
|
} else {
|
||||||
Console.WriteLine("|" + funcelse + "|");
|
//Console.WriteLine("|" + funcelse + "|");
|
||||||
InvokeNR(funcelse, ResolveVar(argselse));
|
InvokeNR(funcelse, ResolveVar(argselse));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -398,6 +402,7 @@ namespace parseManager
|
|||||||
tempReturn.SetText(_currentChunk.GetLine());
|
tempReturn.SetText(_currentChunk.GetLine());
|
||||||
return tempReturn;
|
return tempReturn;
|
||||||
}
|
}
|
||||||
|
return tempReturn;
|
||||||
}
|
}
|
||||||
public void AssignmentHandler(string[] vars, object[] types)
|
public void AssignmentHandler(string[] vars, object[] types)
|
||||||
{
|
{
|
||||||
@ -508,13 +513,13 @@ namespace parseManager
|
|||||||
}
|
}
|
||||||
public bool isVar(string val, out object v)
|
public bool isVar(string val, out object v)
|
||||||
{
|
{
|
||||||
object va;
|
debug("TESTING: " + val);
|
||||||
debug("TESTING: "+val);
|
if (_defualtENV == null) {
|
||||||
if(_defualtENV==null){
|
_defualtENV = _mainENV;
|
||||||
_defualtENV=_mainENV;
|
|
||||||
}
|
}
|
||||||
if (_defualtENV.TryGetValue(val, out va)) {
|
debug("GETTING VAL FROM ENV: " + _defualtENV[val]);
|
||||||
v = va;
|
if (_defualtENV[val] != null) {
|
||||||
|
v = _defualtENV[val];
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (val.EndsWith("]")) {
|
if (val.EndsWith("]")) {
|
||||||
@ -566,15 +571,6 @@ namespace parseManager
|
|||||||
{
|
{
|
||||||
_BLOCK = name;
|
_BLOCK = name;
|
||||||
_type = type;
|
_type = type;
|
||||||
if (type.Contains("function")) {
|
|
||||||
isFunc = true;
|
|
||||||
var func = Regex.Match(type, @"\((.+)\)");
|
|
||||||
args = GLOBALS.Split(func.Groups[1].Value);
|
|
||||||
_compiledlines.Add(new CMD("FUNC", new object[] {
|
|
||||||
"TRACEBACK",
|
|
||||||
new string[]{ }
|
|
||||||
})); // Append the traceback method to the chunk
|
|
||||||
}
|
|
||||||
_clean(cont);
|
_clean(cont);
|
||||||
}
|
}
|
||||||
public bool isFunction()
|
public bool isFunction()
|
||||||
@ -667,9 +663,9 @@ namespace parseManager
|
|||||||
} else if (FuncWReturn.ToString() != "") {
|
} else if (FuncWReturn.ToString() != "") {
|
||||||
var var1 = (FuncWReturn.Groups[1]).ToString();
|
var var1 = (FuncWReturn.Groups[1]).ToString();
|
||||||
var func = (FuncWReturn.Groups[2]).ToString();
|
var func = (FuncWReturn.Groups[2]).ToString();
|
||||||
var args = (FuncWReturn.Groups[3]).ToString();
|
var args2 = (FuncWReturn.Groups[3]).ToString();
|
||||||
var retargs = var1.Split(',');
|
var retargs = var1.Split(',');
|
||||||
var result = Regex.Split(args, ",(?=(?:[^\"'\\[\\]]*[\"'\\[\\]][^\"'\\[\\]]*[\"'\\[\\]])*[^\"'\\[\\]]*$)");
|
var result = Regex.Split(args2, ",(?=(?:[^\"'\\[\\]]*[\"'\\[\\]][^\"'\\[\\]]*[\"'\\[\\]])*[^\"'\\[\\]]*$)");
|
||||||
_compiledlines.Add(new CMD("FUNC_R", new object[] {
|
_compiledlines.Add(new CMD("FUNC_R", new object[] {
|
||||||
retargs,
|
retargs,
|
||||||
func,
|
func,
|
||||||
@ -677,8 +673,8 @@ namespace parseManager
|
|||||||
}));
|
}));
|
||||||
} else if (FuncWOReturn.ToString() != "") {
|
} else if (FuncWOReturn.ToString() != "") {
|
||||||
var func = (FuncWOReturn.Groups[1]).ToString();
|
var func = (FuncWOReturn.Groups[1]).ToString();
|
||||||
var args = (FuncWOReturn.Groups[2]).ToString();
|
var args2 = (FuncWOReturn.Groups[2]).ToString();
|
||||||
var result = Regex.Split(args, ",(?=(?:[^\"'\\[\\]]*[\"'\\[\\]][^\"'\\[\\]]*[\"'\\[\\]])*[^\"'\\[\\]]*$)");
|
var result = Regex.Split(args2, ",(?=(?:[^\"'\\[\\]]*[\"'\\[\\]][^\"'\\[\\]]*[\"'\\[\\]])*[^\"'\\[\\]]*$)");
|
||||||
_compiledlines.Add(new CMD("FUNC", new object[]{ func, result }));
|
_compiledlines.Add(new CMD("FUNC", new object[]{ func, result }));
|
||||||
} else if (pureLine.ToString() != "") {
|
} else if (pureLine.ToString() != "") {
|
||||||
_compiledlines.Add(new CMD("LINE", new object[]{ pureLine.ToString() }));
|
_compiledlines.Add(new CMD("LINE", new object[]{ pureLine.ToString() }));
|
||||||
@ -692,6 +688,15 @@ namespace parseManager
|
|||||||
_compiledlines.Add(new CMD("UNKNOWN", new object[]{ }));
|
_compiledlines.Add(new CMD("UNKNOWN", new object[]{ }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (_type.Contains("function")) {
|
||||||
|
isFunc = true;
|
||||||
|
var func = Regex.Match(_type, @"\((.+)\)");
|
||||||
|
args = GLOBALS.Split(func.Groups[1].Value);
|
||||||
|
_compiledlines.Add(new CMD("FUNC", new object[] {
|
||||||
|
"TRACEBACK",
|
||||||
|
new string[]{}
|
||||||
|
})); // Append the traceback method to the chunk
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public string GetName()
|
public string GetName()
|
||||||
{
|
{
|
||||||
@ -849,14 +854,15 @@ namespace parseManager
|
|||||||
}
|
}
|
||||||
if (!loop) {
|
if (!loop) {
|
||||||
object t;
|
object t;
|
||||||
|
if (env != null)
|
||||||
if (env.TryGetValue(cmd, out t)) {
|
if (env.TryGetValue(cmd, out t)) {
|
||||||
double te;
|
double te;
|
||||||
if (t.GetType().ToString().Contains("Double"))
|
if (t.GetType().ToString().Contains("Double"))
|
||||||
return (double)t;
|
return (double)t;
|
||||||
if(t.GetType().ToString().Contains("String"))
|
if (t.GetType().ToString().Contains("String"))
|
||||||
if (double.TryParse((string)t, out te)) {
|
if (double.TryParse((string)t, out te)) {
|
||||||
return te;
|
return te;
|
||||||
}
|
}
|
||||||
return double.NaN;
|
return double.NaN;
|
||||||
} else {
|
} else {
|
||||||
t = double.NaN; // It couldn't be done :'(
|
t = double.NaN; // It couldn't be done :'(
|
||||||
@ -878,7 +884,11 @@ namespace parseManager
|
|||||||
{
|
{
|
||||||
string str = "(";
|
string str = "(";
|
||||||
foreach (KeyValuePair<string, object> entry in _vars) {
|
foreach (KeyValuePair<string, object> entry in _vars) {
|
||||||
str += "[\"" + entry.Key + "\"] = " + entry.Value + ", ";
|
var val = entry.Value;
|
||||||
|
if (val.GetType().ToString().Contains("ENV")) {
|
||||||
|
val = "ENV";
|
||||||
|
}
|
||||||
|
str += "[\"" + entry.Key + "\"] = " + val + ", ";
|
||||||
}
|
}
|
||||||
foreach (KeyValuePair<int, object> entry in _varsI) {
|
foreach (KeyValuePair<int, object> entry in _varsI) {
|
||||||
str += "[" + entry.Key + "] = " + entry.Value + ", ";
|
str += "[" + entry.Key + "] = " + entry.Value + ", ";
|
||||||
@ -1119,7 +1129,10 @@ public class standardDefine
|
|||||||
}
|
}
|
||||||
public ENV CreateENV()
|
public ENV CreateENV()
|
||||||
{
|
{
|
||||||
return new ENV();
|
var temp = new ENV();
|
||||||
|
var PM = GLOBALS.GetPM();
|
||||||
|
temp.SetParent(PM.GetENV());
|
||||||
|
return temp;
|
||||||
}
|
}
|
||||||
public int GOTO(string label)
|
public int GOTO(string label)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user