public string Parse(Dictionary <int, string> comments = null, int StartLevel = -1) { string content = ""; //End here is the code is empty if (Code == null || !Code.Any()) { return(content); } //Make a local copy, so we do not remove the master comments Dictionary <int, string> localCopy = Comments?.ToDictionary(t => t.Key, t => t.Value); foreach (ICodeStruct item in Code) { try { content += item.Parse(localCopy, StartLevel) + "\n"; } catch (Exception) { //TODO: Add language support Logger.Errors.Add(new SyntaxError("Unknown error in script")); } } return(content); }
private void ParseCode(string s) { ParseParameters(s); var code = s.GetTextBetween('{', '}'); var lines = code.BeautifyMethod(); foreach (var line in lines) { Code.Add(new Line(line, this)); } if (Code.Any(x => x.hasReturn)) { ReturnType = Code.Single(x => x.hasReturn).ReturnType.Value; } }