Version 1.3.2

Fixed bugs
Added new syntax to concat
str="!"
num=3
"Lets do this$str*3$"
becomes
"Lets do this!!!"
you can even replace 3 for num
This commit is contained in:
Ryan 2017-09-05 11:19:41 -04:00
parent 16ada0e707
commit f8c968cbaa
3 changed files with 27 additions and 6 deletions

View File

@ -29,6 +29,8 @@ THREAD testthread.txt
snd_select=loadSong("Audio/select.mp3") snd_select=loadSong("Audio/select.mp3")
playSong(bgm_song) playSong(bgm_song)
setFancyForm("left") setFancyForm("left")
str="!"
"Lets do this$str*3$"
LOAD() LOAD()
write("Name: ") write("Name: ")
name=getInput() name=getInput()

Binary file not shown.

View File

@ -561,13 +561,32 @@ namespace parseManagerCS
} }
public string parseHeader(string header) public string parseHeader(string header)
{ {
var results = Regex.Matches(header, @"(\$.*?\$)"); var results = Regex.Matches(header, @"\$([\S\*]+?)\$");
int len = results.Count; int len = results.Count;
string str; string str;
object temp; object temp;
object temp2;
int testnum;
for (int i = 0; i < len; i++) { for (int i = 0; i < len; i++) {
str = results[i].ToString(); str = results[i].Groups[1].Value;
if (isVar(str.Substring(1, str.Length - 2), out temp)) { if (str.Contains("*")) {
var test = Regex.Match(str, @"(.+?)\*(.+)");
var spart = test.Groups[1].Value;
var ipart = test.Groups[2].Value;
if(!isVar(spart, out temp)){
}
if (int.TryParse(ipart, out testnum)) {
str = def.repeat(this, temp.ToString(), (double)testnum);
header = header.Replace(results[i].ToString(), str);
} else if (isVar(ipart, out temp2)) {
str = def.repeat(this, temp.ToString(), (double)temp2);
header = header.Replace(results[i].ToString(), str);
} else {
PushError("When using the $varname*num$ expression num must be a number or a variable that is set to a number!");
}
}
if (isVar(str, out temp)) {
header = header.Replace(results[i].ToString(), temp.ToString()); header = header.Replace(results[i].ToString(), temp.ToString());
} else { } else {
header = header.Replace(results[i].ToString(), "null"); header = header.Replace(results[i].ToString(), "null");
@ -876,7 +895,6 @@ namespace parseManagerCS
_compiledlines.Add(new CMD("LINE", new object[]{ pureLine.ToString() })); _compiledlines.Add(new CMD("LINE", new object[]{ pureLine.ToString() }));
} else if (assignment.ToString() != "") { } else if (assignment.ToString() != "") {
var vars = GLOBALS.Split(assignment.Groups[1].ToString()); var vars = GLOBALS.Split(assignment.Groups[1].ToString());
Console.WriteLine(assignment.Groups[2]);
var tabTest = assignment.Groups[2].ToString(); var tabTest = assignment.Groups[2].ToString();
string[] vals = GLOBALS.Split(tabTest); string[] vals = GLOBALS.Split(tabTest);
//string[] vals = Regex.Split(assignment.Groups[2].ToString(), ",(?=(?:[^\"'\\[\\]]*[\"'\\[\\]][^\"'\\[\\]]*[\"'\\[\\]])*[^\"'\\[\\]]*$)"); //string[] vals = Regex.Split(assignment.Groups[2].ToString(), ",(?=(?:[^\"'\\[\\]]*[\"'\\[\\]][^\"'\\[\\]]*[\"'\\[\\]])*[^\"'\\[\\]]*$)");
@ -1423,7 +1441,8 @@ public class standardDefine
temp.SetParent(PM.GetENV()); temp.SetParent(PM.GetENV());
return temp; return temp;
} }
public string repeat(parseManager PM,string str, double n){ public string repeat(parseManager PM, string str, double n)
{
return string.Concat(Enumerable.Repeat(str, (int)n)); return string.Concat(Enumerable.Repeat(str, (int)n));
} }
public string getInput(parseManager PM) public string getInput(parseManager PM)