public ModLibraryHandler(ModFileLoader <WingmanMod> loader, ModLoadOptions loadOpts, ModParser parser) { _loader = loader; _fileOpts = loadOpts; _parser = parser; // _index = index; }
public void Should_parse_mod_file_archive() { DISetup.SetupContainer(); var sb = new StringBuilder(); sb.AppendLine(@"name=""AI Species Limit"""); sb.AppendLine(@"archive=""path"""); sb.AppendLine(@"user_dir=""dir"""); sb.AppendLine(@"replace_path=""replace"""); sb.AppendLine(@"tags={"); sb.AppendLine(@" ""Gameplay"""); sb.AppendLine(@" ""Fixes"""); sb.AppendLine(@"}"); sb.AppendLine(@"picture=""thumbnail.png"""); sb.AppendLine(@"supported_version=""2.5.*"""); sb.AppendLine(@"remote_file_id=""1830063425"""); sb.AppendLine(@"version = ""version"""); sb.AppendLine(@"dependencies = {"); sb.AppendLine(@" ""fake"""); sb.AppendLine(@"}"); var parser = new ModParser(new CodeParser(new Logger())); var result = parser.Parse(sb.ToString().Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries)); result.FileName.Should().Be("path"); }
public void ModsHiding1() { _modParser = new ModParser(); var mods = Mods.Dt | Mods.Nc | Mods.Hd | Mods.Hr | Mods.Pf | Mods.Sd | Mods.Cm | Mods.Au; var result = _modParser.GetModsFromEnum((int)mods, true); Assert.IsTrue(result.Count(s => s == ',') == 4); Assert.IsFalse(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Dt).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Nc).ShortMod)); Assert.IsFalse(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Sd).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Pf).ShortMod)); Assert.IsFalse(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Au).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Cm).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Hd).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Hr).ShortMod)); Assert.IsTrue(result.Substring(result.Length - 1) != ","); Assert.IsTrue(result.Substring(result.Length - 1) != " "); }
public static bool HandleUrl(bool protocolHandler) { var idx = Environment.CommandLine.IndexOf(protocolHandler ? " url " : " install ", StringComparison.OrdinalIgnoreCase); if (idx == -1) { return(false); } var url = Environment.CommandLine.Substring(idx + (protocolHandler ? 5 : 9)); try { var mod = ModParser.DownloadMod(new Uri(url)); if (protocolHandler && MessageBox.Show($"Do you want to install the mod {mod.ModData.Name} by {mod.ModData.Author}?", buttons: MessageBoxButtons.YesNo) != DialogResult.Yes) { return(false); } Installation.Default.InstallMod(mod); Installation.Default.Apply(); if (!IsStandalone) { return(MessageBox.Show($"Successfully installed the mod {mod.ModData.Name} by {mod.ModData.Author}.\n\nDo you want to start the game now?", buttons: MessageBoxButtons.YesNo) == DialogResult.Yes); } MessageBox.Show($"Successfully installed the mod {mod.ModData.Name} by {mod.ModData.Author}."); } catch (Exception ex) { MessageBox.Show("Failed to install mod: " + ex); } return(false); }
public void GetModsFromInt1() { _modParser = new ModParser(); var mods = Mods.Dt | Mods.Hd; var result = _modParser.GetModsFromInt((int)mods); Assert.IsTrue(mods == result); }
public void IsModHidden1() { _modParser = new ModParser(); if (!_modParser.IsModHidden(Mods.Nv)) { _modParser.HiddenMods.Add(_modParser.AllMods.First(t => t.Value == Mods.Nv)); } Assert.IsTrue(_modParser.IsModHidden(Mods.Nv)); }
public void NoModText2() { _modParser = new ModParser(); var mods = Mods.Nm; var result = _modParser.GetModsFromEnum((int)mods, true); Assert.IsTrue(result.Count(s => s == ',') == 0); Assert.IsTrue(result == _modParser.ShortNoModText); }
public void NoModText1() { _modParser = new ModParser(); var mods = Mods.Omod; var result = _modParser.GetModsFromEnum((int)mods); Assert.IsTrue(result.Count(s => s == ',') == 0); Assert.IsTrue(result == _modParser.LongNoModText); }
public void GetModsFromEnum2() { _modParser = new ModParser(); var mods = Mods.Dt | Mods.Hd | Mods.Hr; var result = _modParser.GetModsFromEnum((int)mods, true); Assert.IsTrue(result.Count(s => s == ',') == 2); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Dt).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Hd).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Hr).ShortMod)); }
public SignatureFileBehaviour(IConfiguration config, ModParser parser, BrandProvider brand, AppInfoProvider info) { var section = config.GetSection("SignatureFiles"); var requestEmbed = config.GetValue <bool>("RequestEmbed", true); _files = section.Exists() ? section.Get <List <string> >() : new List <string>(); _enableRequestEmbed = requestEmbed; _parser = parser; _brand = brand; _info = info; }
public void GetModsFromInt2() { _modParser = new ModParser(); var mods = Mods.Dt | Mods.Hd; if (!_modParser.IsModHidden(Mods.Hd)) { _modParser.HiddenMods.Add(_modParser.AllMods.First(t => t.Value == Mods.Hd)); } var result = _modParser.GetModsFromInt((int)mods); Assert.IsTrue(result == Mods.Dt); }
public void NoModText4() { _modParser = new ModParser(); var mods = Mods.Nm; _modParser.LongNoModText = "No mods enabled"; Assert.IsTrue(_modParser.LongNoModText == "No mods enabled"); _modParser.ShortNoModText = "N/A"; Assert.IsTrue(_modParser.ShortNoModText == "N/A"); var result = _modParser.GetModsFromEnum((int)mods, true); Assert.IsTrue(result.Count(s => s == ',') == 0); Assert.IsTrue(result == _modParser.ShortNoModText); }
public void GetModsFromEnum3() { _modParser = new ModParser(); var mods = Mods.Dt | Mods.Hd | Mods.Hr; if (!_modParser.IsModHidden(Mods.Hr)) { _modParser.HiddenMods.Add(_modParser.AllMods.First(t => t.Value == Mods.Hr)); } var result = _modParser.GetModsFromEnum((int)mods, true); Assert.IsTrue(result.Count(s => s == ',') == 1); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Dt).ShortMod)); Assert.IsTrue(result.Contains(_modParser.AllMods.First(t => t.Value == Mods.Hd).ShortMod)); }
public void Should_parse_mod_file() { DISetup.SetupContainer(); var sb = new StringBuilder(); sb.AppendLine(@"name=""AI Species Limit"""); sb.AppendLine(@"path=""path"""); sb.AppendLine(@"user_dir=""dir"""); sb.AppendLine(@"replace_path=""replace"""); sb.AppendLine(@"tags={"); sb.AppendLine(@" ""Gameplay"""); sb.AppendLine(@" ""Fixes"""); sb.AppendLine(@"}"); sb.AppendLine(@"picture=""thumbnail.png"""); sb.AppendLine(@"supported_version=""2.5.*"""); sb.AppendLine(@"remote_file_id=""1830063425"""); sb.AppendLine(@"version = ""version"""); sb.AppendLine(@"dependencies = {"); sb.AppendLine(@" ""fake"""); sb.AppendLine(@"}"); var parser = new ModParser(new CodeParser(new Logger())); var result = parser.Parse(sb.ToString().Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries)); result.Dependencies.Count().Should().Be(1); result.Dependencies.First().Should().Be("fake"); result.FileName.Should().Be("path"); result.Name.Should().Be("AI Species Limit"); result.Picture.Should().Be("thumbnail.png"); result.RemoteId.Should().Be(1830063425); result.Tags.Count().Should().Be(2); result.Tags.First().Should().Be("Gameplay"); result.Tags.Last().Should().Be("Fixes"); result.Version.Should().Be("2.5.*"); result.UserDir.Count().Should().Be(1); result.UserDir.FirstOrDefault().Should().Be("dir"); result.ReplacePath.Count().Should().Be(1); result.ReplacePath.FirstOrDefault().Should().Be("replace"); }
private ObservableCollection <ModItem> AddModsToList(string path) { var templist = new ObservableCollection <ModItem>(); var modParser = new ModParser(); modParser.LoadAllScripts(path); var mods = modParser.JSMods; try { foreach (var item in mods) { templist.Add(new ModItem() { Id = mods.IndexOf(item), Enabled = true, Name = item.Name, CurrentVersion = string.IsNullOrEmpty(item.Version) ? "1.0.0" : item.Version, LatestVersion = string.IsNullOrEmpty(item.Version) ? "1.0.0" : item.Version, Author = item.Author, Section = item.Section, Description = item.Description, FileName = item.FileName, DependsOn = item.DependsOnMods == null ? "" : string.Join(",", item.DependsOnMods?.ToArray()), Dependencies = item.Dependencies == null ? "" : string.Join(",", item.Dependencies?.ToArray()) }); } return(templist); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(new ObservableCollection <ModItem>()); }
void parseModFiles(string path, ModSource source, bool isDirectory) { var fileInfo = Reader.GetFileInfo(path, Shared.Constants.DescriptorFile); if (fileInfo == null) { fileInfo = Reader.GetFileInfo(path, $"*{Shared.Constants.ModExtension}"); if (fileInfo == null) { return; } } var mod = Mapper.Map <IMod>(ModParser.Parse(fileInfo.Content)); mod.FileName = path.Replace("\\", "/"); mod.FullPath = path.StandardizeDirectorySeparator(); mod.IsLocked = fileInfo.IsReadOnly; mod.Source = source; var cleanedPath = path; if (!isDirectory) { cleanedPath = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)); } var localPath = $"{Shared.Constants.ModDirectory}/{cleanedPath.Split(Path.DirectorySeparatorChar, StringSplitOptions.RemoveEmptyEntries).LastOrDefault()}{Shared.Constants.ModExtension}"; switch (mod.Source) { case ModSource.Local: setDescriptorPath(mod, localPath, localPath); break; case ModSource.Steam: if (mod.RemoteId.GetValueOrDefault() == 0) { if (!isDirectory) { var modParentDirectory = Path.GetDirectoryName(path); mod.RemoteId = GetSteamModId(modParentDirectory, isDirectory); } else { mod.RemoteId = GetSteamModId(path, isDirectory); } } setDescriptorPath(mod, $"{Shared.Constants.ModDirectory}/{Constants.Steam_mod_id}{mod.RemoteId}{Shared.Constants.ModExtension}", localPath); break; case ModSource.Paradox: if (!isDirectory) { var modParentDirectory = Path.GetDirectoryName(path); mod.RemoteId = GetPdxModId(modParentDirectory, isDirectory); } else { mod.RemoteId = GetPdxModId(path, isDirectory); } setDescriptorPath(mod, $"{Shared.Constants.ModDirectory}/{Constants.Paradox_mod_id}{mod.RemoteId}{Shared.Constants.ModExtension}", localPath); break; default: break; } mods.Add(mod); }
/// <summary> /// Gets the installed mods internal. /// </summary> /// <param name="game">The game.</param> /// <param name="ignorePatchMods">if set to <c>true</c> [ignore patch mods].</param> /// <returns>IEnumerable<IMod>.</returns> /// <exception cref="ArgumentNullException">game</exception> protected virtual IEnumerable <IMod> GetInstalledModsInternal(IGame game, bool ignorePatchMods) { if (game == null) { throw new ArgumentNullException("game"); } var mods = Cache.Get <IEnumerable <IMod> >(ModsCachePrefix, ConstructModsCacheKey(game, ignorePatchMods)); if (mods != null) { return(mods); } else { var result = new List <IMod>(); var installedMods = Reader.Read(Path.Combine(game.UserDirectory, Shared.Constants.ModDirectory)); if (installedMods?.Count() > 0) { foreach (var installedMod in installedMods.Where(p => p.Content.Count() > 0)) { var mod = Mapper.Map <IMod>(ModParser.Parse(installedMod.Content)); if (ignorePatchMods && IsPatchModInternal(mod)) { continue; } mod.DescriptorFile = $"{Shared.Constants.ModDirectory}/{installedMod.FileName}"; mod.Source = GetModSource(installedMod); if (mod.Source == ModSource.Paradox) { mod.RemoteId = GetPdxModId(installedMod.FileName); } if (string.IsNullOrWhiteSpace(mod.FileName)) { mod.FileName = string.Empty; mod.FullPath = string.Empty; } else { if (Path.IsPathFullyQualified(mod.FileName)) { mod.FullPath = mod.FileName; } else { // Check user directory and workshop directory. var userDirectoryMod = Path.Combine(game.UserDirectory, mod.FileName); var workshopDirectoryMod = Path.Combine(game.WorkshopDirectory, mod.FileName); if (File.Exists(userDirectoryMod) || Directory.Exists(userDirectoryMod)) { mod.FullPath = userDirectoryMod; } else if (File.Exists(workshopDirectoryMod) || Directory.Exists(workshopDirectoryMod)) { mod.FullPath = workshopDirectoryMod; } } } // Validate if path exists mod.IsValid = File.Exists(mod.FullPath) || Directory.Exists(mod.FullPath); mod.Game = game.Type; result.Add(mod); } } Cache.Set <IEnumerable <IMod> >(ModsCachePrefix, ConstructModsCacheKey(game, ignorePatchMods), result); return(result); } }
public ModPresetLoader(IEnumerable <IGameSource> gameSources, PakFileProvider pakFileProvider, ModParser parser) { _gameSources = gameSources; _pakFileProvider = pakFileProvider; _parser = parser; }
/// <summary> /// Gets the installed mods internal. /// </summary> /// <param name="game">The game.</param> /// <param name="ignorePatchMods">if set to <c>true</c> [ignore patch mods].</param> /// <returns>IEnumerable<IMod>.</returns> /// <exception cref="ArgumentNullException">game</exception> protected virtual IEnumerable <IMod> GetInstalledModsInternal(IGame game, bool ignorePatchMods) { if (game == null) { throw new ArgumentNullException(nameof(game)); } var mods = Cache.Get <IEnumerable <IMod> >(new CacheGetParameters() { Region = ModsCacheRegion, Prefix = game.Type, Key = GetModsCacheKey(ignorePatchMods) }); if (mods != null) { return(mods); } else { var result = new List <IMod>(); var installedMods = Reader.Read(Path.Combine(game.UserDirectory, Shared.Constants.ModDirectory)); if (installedMods?.Count() > 0) { foreach (var installedMod in installedMods.Where(p => p.Content.Any())) { var mod = Mapper.Map <IMod>(ModParser.Parse(installedMod.Content)); if (ignorePatchMods && IsPatchModInternal(mod)) { continue; } mod.Name = string.IsNullOrWhiteSpace(mod.Name) ? string.Empty : mod.Name; mod.IsLocked = installedMod.IsReadOnly; mod.DescriptorFile = $"{Shared.Constants.ModDirectory}/{installedMod.FileName}"; mod.Source = GetModSource(installedMod); if (mod.Source == ModSource.Paradox) { mod.RemoteId = GetPdxModId(installedMod.FileName); } if (string.IsNullOrWhiteSpace(mod.FileName)) { mod.FileName = string.Empty; mod.FullPath = string.Empty; } else { if (Path.IsPathFullyQualified(mod.FileName)) { mod.FullPath = mod.FileName.StandardizeDirectorySeparator(); } else { // Check user directory and workshop directory. var userDirectoryMod = new List <string>() { Path.Combine(game.CustomModDirectory, mod.FileName), Path.Combine(game.UserDirectory, mod.FileName) }.GroupBy(p => p).Select(p => p.First()); var workshopDirectoryMod = game.WorkshopDirectory.Select(p => Path.Combine(p, mod.FileName)).GroupBy(p => p).Select(p => p.First()); if (userDirectoryMod.Any(p => File.Exists(p) || Directory.Exists(p))) { mod.FullPath = userDirectoryMod.FirstOrDefault(p => File.Exists(p) || Directory.Exists(p)).StandardizeDirectorySeparator(); } else if (workshopDirectoryMod.Any(p => File.Exists(p) || Directory.Exists(p))) { mod.FullPath = workshopDirectoryMod.FirstOrDefault(p => File.Exists(p) || Directory.Exists(p)).StandardizeDirectorySeparator(); } } } // Validate if path exists mod.IsValid = File.Exists(mod.FullPath) || Directory.Exists(mod.FullPath); mod.Game = game.Type; result.Add(mod); } } Cache.Set(new CacheAddParameters <IEnumerable <IMod> >() { Region = ModsCacheRegion, Prefix = game.Type, Key = GetModsCacheKey(ignorePatchMods), Value = result }); return(result); } }
public MergeLoader(PakFileProvider pakFileProvider, IEnumerable <IGameSource> gameSources, ModParser parser) { _pakFileProvider = pakFileProvider; _gameSources = gameSources; _parser = parser; }
public MergeReportWriter(ModParser parser) { _parser = parser; }
public void IsModHidden2() { _modParser = new ModParser(); Assert.IsFalse(_modParser.IsModHidden(Mods.Dt)); }
private void repairAProjectToolStripMenuItem_Click(object sender, EventArgs e) { CommonOpenFileDialog fb = new CommonOpenFileDialog(); fb.IsFolderPicker = true; fb.Title = "Please select the directory that your project resides in."; fb.EnsurePathExists = true; CommonFileDialogResult rs = fb.ShowDialog(); if (rs == CommonFileDialogResult.Cancel) { return; } // Get the path. string dir = fb.FileName; // Check if it is empty or if the user clicked Cancel. if (string.IsNullOrEmpty(dir) || !Directory.Exists(dir)) { return; } // Check if it is a valid project. if (!Directory.Exists(dir + "/Package") || !File.Exists(dir + "/data.sqlite")) { MessageBox.Show("The selected project is not a valid project.", "Repairing Mod Builder project", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Ask if the user wants to generate a new database, or to just add the tables. DialogResult result = MessageBox.Show("Should the existing database be truncated? Answering no will instead try to add all missing data.", "Reparing project", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (result == DialogResult.Cancel) { return; } // New instance of the mod editor. modEditor me = new modEditor(); // Fiddle with the database. me.generateSQL(dir, (result == DialogResult.Yes), ModParser.parsePackageInfo(dir + "/Package/package-info.xml")); // Do /Source and /Package exist? if (!Directory.Exists(dir + "/Source")) { Directory.CreateDirectory(dir + "/Source"); } if (!Directory.Exists(dir + "/Package")) { Directory.CreateDirectory(dir + "/Package"); } // Ask if the user wants to load the project. result = MessageBox.Show("Your project has been repaired. Do you want to load the project now?", "Project repaired", MessageBoxButtons.YesNo, MessageBoxIcon.Question); // Yes? Load the project. if (result == DialogResult.Yes) { PackageWorker.bootstrapLoad(dir); } /* * { * // Show a loadProject dialog. * loadProject lp = new loadProject(); * lp.Show(); * * // Load the project. * bool stat = lp.openProjDir(dir); * * // Check the status. * if (stat == false) * MessageBox.Show("An error occured while loading the project.", "Loading project", MessageBoxButtons.OK, MessageBoxIcon.Error); * * // Close the loadProject dialog. * lp.Close(); * }*/ }
public static bool Parse(SyntaxContext context, int position) { var list = context.list; var offset = 0; var index = position; var count = 0; var isMissed = false; while (ParenParser.Parse(context, index)) { ; } while (TableIParser.Parse(context, index)) { ; } while (TableSParser.Parse(context, index)) { ; } while (ListParser.Parse(context, index)) { ; } while (PropertyParser.Parse(context, index)) { ; } while (IndexParser.Parse(context, index)) { ; } while (CallParser.Parse(context, index)) { ; } while (NotParser.Parse(context, index)) { ; } while (LengthParser.Parse(context, index)) { ; } while (NegateParser.Parse(context, index)) { ; } while (PowerParser.Parse(context, index)) { ; } while (MultiplyParser.Parse(context, index)) { ; } while (DivisionParser.Parse(context, index)) { ; } while (ModParser.Parse(context, index)) { ; } while (AddParser.Parse(context, index)) { ; } while (SubtractParser.Parse(context, index)) { ; } if (!list[index].isRightValue) { return(false); } else { // ignored } offset += 1; index = position + offset; if (!ParserHelper.IsOperator(list[index], "<")) { return(false); } else { // ignored } offset += 1; index = position + offset; while (ParenParser.Parse(context, index)) { ; } while (TableIParser.Parse(context, index)) { ; } while (TableSParser.Parse(context, index)) { ; } while (ListParser.Parse(context, index)) { ; } while (PropertyParser.Parse(context, index)) { ; } while (IndexParser.Parse(context, index)) { ; } while (CallParser.Parse(context, index)) { ; } while (NotParser.Parse(context, index)) { ; } while (LengthParser.Parse(context, index)) { ; } while (NegateParser.Parse(context, index)) { ; } while (PowerParser.Parse(context, index)) { ; } while (MultiplyParser.Parse(context, index)) { ; } while (DivisionParser.Parse(context, index)) { ; } while (ModParser.Parse(context, index)) { ; } while (AddParser.Parse(context, index)) { ; } while (SubtractParser.Parse(context, index)) { ; } if (!list[index].isRightValue) { return(false); } else { // ignored } offset += 1; index = position + offset; context.Insert(position, ExpressionCreator.CreateLess(list, position, offset)); context.Remove(position + 1, offset); return(true); }
public static bool Parse(SyntaxContext context, int position) { var list = context.list; var offset = 0; var index = position; var count = 0; var isMissed = false; if (!ParserHelper.IsKeyword(list[index], "for")) { return(false); } else { // ignored } offset += 1; index = position + offset; if (list[index].type != Expression.Type.Word) { return(false); } else { // ignored } offset += 1; index = position + offset; if (!ParserHelper.IsOperator(list[index], "=")) { return(false); } else { // ignored } offset += 1; index = position + offset; while (FunctionAParser.Parse(context, index)) { ; } while (ParenParser.Parse(context, index)) { ; } while (TableIParser.Parse(context, index)) { ; } while (TableSParser.Parse(context, index)) { ; } while (ListParser.Parse(context, index)) { ; } while (PropertyParser.Parse(context, index)) { ; } while (IndexParser.Parse(context, index)) { ; } while (CallParser.Parse(context, index)) { ; } while (NotParser.Parse(context, index)) { ; } while (LengthParser.Parse(context, index)) { ; } while (NegateParser.Parse(context, index)) { ; } while (PowerParser.Parse(context, index)) { ; } while (MultiplyParser.Parse(context, index)) { ; } while (DivisionParser.Parse(context, index)) { ; } while (ModParser.Parse(context, index)) { ; } while (AddParser.Parse(context, index)) { ; } while (SubtractParser.Parse(context, index)) { ; } while (ConcatParser.Parse(context, index)) { ; } while (LessParser.Parse(context, index)) { ; } while (GreaterParser.Parse(context, index)) { ; } while (LessEqualParser.Parse(context, index)) { ; } while (GreaterEqualParser.Parse(context, index)) { ; } while (EqualParser.Parse(context, index)) { ; } while (NotEqualParser.Parse(context, index)) { ; } while (AndParser.Parse(context, index)) { ; } while (OrParser.Parse(context, index)) { ; } if (!list[index].isRightValue) { return(false); } else { // ignored } offset += 1; index = position + offset; if (!ParserHelper.IsOperator(list[index], ",")) { return(false); } else { // ignored } offset += 1; index = position + offset; while (FunctionAParser.Parse(context, index)) { ; } while (ParenParser.Parse(context, index)) { ; } while (TableIParser.Parse(context, index)) { ; } while (TableSParser.Parse(context, index)) { ; } while (ListParser.Parse(context, index)) { ; } while (PropertyParser.Parse(context, index)) { ; } while (IndexParser.Parse(context, index)) { ; } while (CallParser.Parse(context, index)) { ; } while (NotParser.Parse(context, index)) { ; } while (LengthParser.Parse(context, index)) { ; } while (NegateParser.Parse(context, index)) { ; } while (PowerParser.Parse(context, index)) { ; } while (MultiplyParser.Parse(context, index)) { ; } while (DivisionParser.Parse(context, index)) { ; } while (ModParser.Parse(context, index)) { ; } while (AddParser.Parse(context, index)) { ; } while (SubtractParser.Parse(context, index)) { ; } while (ConcatParser.Parse(context, index)) { ; } while (LessParser.Parse(context, index)) { ; } while (GreaterParser.Parse(context, index)) { ; } while (LessEqualParser.Parse(context, index)) { ; } while (GreaterEqualParser.Parse(context, index)) { ; } while (EqualParser.Parse(context, index)) { ; } while (NotEqualParser.Parse(context, index)) { ; } while (AndParser.Parse(context, index)) { ; } while (OrParser.Parse(context, index)) { ; } if (!list[index].isRightValue) { return(false); } else { // ignored } offset += 1; index = position + offset; if (!ParserHelper.IsKeyword(list[index], "do")) { return(false); } else { // ignored } offset += 1; index = position + offset; while (ModuleParser.Parse(context, index)) { ; } if (list[index].type != Expression.Type.Module) { return(false); } else { // ignored } offset += 1; index = position + offset; if (!ParserHelper.IsKeyword(list[index], "end")) { return(false); } else { // ignored } offset += 1; index = position + offset; context.Insert(position, ExpressionCreator.CreateFor(list, position, offset)); context.Remove(position + 1, offset); return(true); }