public void GameStateChange_TagChange()
        {
            TagChange tagChange = null;
            var       parser    = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => tagChange = args as TagChange;

            parser.Parse(new Line("Power", "D 00:31:50.8318211 PowerTaskList.DebugPrintPower() -     TAG_CHANGE Entity=Epix tag=RESOURCES_USED value=2"));
            Assert.IsNotNull(tagChange);
            Assert.IsNull(tagChange.EntityId);
            Assert.AreEqual("Epix", tagChange.EntityName);
            Assert.AreEqual(GameTag.RESOURCES_USED, tagChange.Tag);
            Assert.AreEqual(2, tagChange.Value);

            parser.Parse(new Line("Power", "D 00:31:50.8318211 PowerTaskList.DebugPrintPower() -     TAG_CHANGE Entity=2 tag=RESOURCES_USED value=2"));
            Assert.IsNotNull(tagChange);
            Assert.AreEqual(2, tagChange.EntityId);
            Assert.AreEqual(GameTag.RESOURCES_USED, tagChange.Tag);
            Assert.AreEqual(2, tagChange.Value);

            tagChange = null;
            parser.Parse(new Line("Power", "D 00:31:50.8568882 PowerTaskList.DebugPrintPower() -     TAG_CHANGE Entity=[entityName=Vilefin Inquisitor id=60 zone=HAND zonePos=4 cardId=OG_006 player=2] tag=ZONE value=PLAY"));
            Assert.IsNotNull(tagChange);
            Assert.AreEqual(60, tagChange.EntityId);
            Assert.AreEqual(GameTag.ZONE, tagChange.Tag);
            Assert.AreEqual((int)Zone.PLAY, tagChange.Value);
        }
        public GameEventManager(Game game, ILogInput logInput, IGameDataProvider gameData)
        {
            _game     = game;
            _gameData = gameData;

            _arenaWatcher                 = new ArenaWatcher(gameData);
            _arenaWatcher.RunComplete    += game.Arena.OnArenaRunComplete;
            _arenaWatcher.CardPicked     += game.Arena.OnArenaDraftPick;
            _arenaWatcher.ChoicesChanged += game.Arena.OnArenaDraftChoices;
            _arenaWatcher.DeckComplete   += game.Arena.OnArenaDraftComplete;

            _packWatcher             = new PackWatcher(gameData);
            _packWatcher.PackOpened += game.OnPackOpened;

            _dungeonRunWatcher = new DungeonRunWatcher(new DungeonRunData(game, gameData));
            _dungeonRunWatcher.DungeonRunMatchStarted += game.OnDungeonRunMatchStarted;
            _dungeonRunWatcher.DungeonRunDeckUpdated  += game.OnDungeonRunDeckUpdated;

            _friendlyChallengeWatcher = new FriendlyChallengeWatcher(gameData);
            _friendlyChallengeWatcher.FriendlyChallenge += game.OnFriendlyChallenge;

            var logParserManager = new LogParserManager();

            var powerParser = new PowerParser(new DefaultGameInfoProvider(game));

            powerParser.CreateGame       += () => game.OnCreateGame(null);
            powerParser.PowerTaskListLog += args => game.OnGameTimeChanged(args.Line.Time);
            powerParser.GameStateChange  += mod => game.CurrentGame?.Apply(mod);
            powerParser.BlockStart       += block => game.GameStateEvents.OnBlockStart(block, game.CurrentGame);
            powerParser.BlockEnd         += block => game.GameStateEvents.OnBlockEnd(block, game.CurrentGame);
            powerParser.GameStateLog     += args => game.CurrentGame?.AppendLog(args);
            powerParser.SetupComplete    += game.OnSetupComplete;
            logParserManager.RegisterParser(powerParser);

            var decksParser = new DecksParser();

            decksParser.FindingGame += game.OnQueuedForGame;
            decksParser.EditedDeck  += game.Collection.OnDeckEdited;
            decksParser.FoundDecks  += game.Collection.OnDecksLoaded;
            logParserManager.RegisterParser(decksParser);

            var loadingScreenParser = new LoadingScreenParser();

            loadingScreenParser.ModeChanged += game.OnModeChanged;
            loadingScreenParser.ModeChanged += LoadingScreenParser_OnModeChanged;
            logParserManager.RegisterParser(loadingScreenParser);

            var arenaParser = new ArenaParser();

            arenaParser.ArenaRunComplete += () => _arenaWatcher.Update();
            logParserManager.RegisterParser(arenaParser);

            var rachelleParser = new RachelleParser();

            rachelleParser.DeckDeleted      += game.Collection.OnDeckDeleted;
            rachelleParser.GoldProgressWins += game.OnGoldProgressWins;
            logParserManager.RegisterParser(rachelleParser);

            logInput.NewLines += eventArgs => logParserManager.Parse(eventArgs.Lines);
        }
Exemple #3
0
        public void Execute(string input)
        {
            _inputHistory.Add(input);

            /*TODO: Add method to get previous input history
             * Examine Powershell commandlet implementation.
             * should execute just fire a commandlet and then send a callback to the caller (UnityPowerConsole) when the command is done?
             * TODO: Implement first draft of a Command Manager. Load commands from assembly/namespace, allow execution of commands
             * TODO: Make a variable context instead of using a dictionary directly
             * TODO: Handle reflection
             */
            try
            {
                var parseResult = PowerParser.ParseInput(input);

                _lastValue = HandleParseType(parseResult);


                //_history.Add(parseResult);
                //_host.Write(parseResult.ParsedType.ToString());
                _host.Write(_lastValue?.ToString() ?? _host.FormatColor("NULL", OutputColorType.Accented)); //TODO: Use output formatters - don't output null - let handlers output null explicit if needed
            }
            catch (PowerParser.IncompleteParseException exception)
            {
                _host.WriteError(
                    $"{exception.Message}\n{_host.FormatColor($"Remainder: {exception.Input.Substring(exception.Position)}", OutputColorType.Default)}");
            }
            catch (Exception exception)
            {
                _host.WriteError($"[{exception}]: {exception.Message}");
            }
        }
        public void BlockStart_CanParseAllLines()
        {
            var validType   = 0;
            var validTarget = 0;
            var data        = TestData.Load("LogTests/TestData/data_1.json");
            var lines       = File.ReadLines(data.LogFile).Where(x => x.Contains("PowerTaskList") && x.Contains("BLOCK_START")).ToList();
            var targets     = lines.Where(x => x.Contains("Target=") && !x.Contains("Target=0") && !x.Contains("Target= ")).ToList();
            var parser      = new PowerParser(new MockGameInfo());

            parser.BlockStart += args =>
            {
                if (args.Type != null)
                {
                    validType++;
                }
                if (args.Target != null && args.Target.Id > 0)
                {
                    validTarget++;
                }
            };
            foreach (var line in lines)
            {
                parser.Parse(new Line("Power", line));
            }
            Assert.AreEqual(197, lines.Count);
            Assert.AreEqual(197, validType);
            Assert.AreEqual(19, targets.Count);
            Assert.AreEqual(19, validTarget);
        }
Exemple #5
0
        public void NamedCommandExecuted()
        {
            _context.CommandContext.RegisterCommand <TestCommand>();
            var parseResult = PowerParser.ParseInput("Test-Command \"Hello World\" -SubstringIndex 6");

            var result = CommandExecuter.Execute(parseResult.Value as pstudio.PowerConsole.Parser.Command, _context, _host);

            Assert.AreEqual("World", result);
        }
Exemple #6
0
        public void PositionalCommandExecuted()
        {
            _context.CommandContext.RegisterCommand <AddNumberCommand>();
            var parseResult = PowerParser.ParseInput("Add-Number 2 5.0");

            var result = CommandExecuter.Execute(parseResult.Value as pstudio.PowerConsole.Parser.Command, _context, _host);

            Assert.AreEqual(7.0, result);
        }
        public void BlockEnd()
        {
            var blockEnd = false;
            var parser   = new PowerParser(new MockGameInfo());

            parser.BlockEnd += block => blockEnd = true;

            parser.Parse(new Line("Power", "D 00:30:21.2050280 PowerTaskList.DebugPrintPower() - BLOCK_END"));
            Assert.IsTrue(blockEnd);
        }
        public void GameStateChange_HideEntity()
        {
            HideEntity hideEntity = null;
            var        parser     = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => hideEntity = args as HideEntity;

            parser.Parse(new Line("Power", "D 00:30:21.1930218 PowerTaskList.DebugPrintPower() -     HIDE_ENTITY - Entity=[entityName=Divine Favor id=70 zone=HAND zonePos=3 cardId=EX1_349 player=2] tag=ZONE value=DECK"));
            Assert.IsNotNull(hideEntity);
            Assert.AreEqual(70, hideEntity.EntityId);
        }
        public void GameStateChange_ShowEntity()
        {
            ShowEntity showEntity = null;
            var        parser     = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => showEntity = args as ShowEntity;

            parser.Parse(new Line("Power", "D 00:30:21.0673837 PowerTaskList.DebugPrintPower() -     SHOW_ENTITY - Updating Entity=[entityName=UNKNOWN ENTITY [cardType=INVALID] id=72 zone=DECK zonePos=0 cardId= player=2] CardID=UNG_015"));
            Assert.IsNotNull(showEntity);
            Assert.AreEqual(72, showEntity.EntityId);
            Assert.AreEqual("UNG_015", showEntity.CardId);
        }
        public void GameStateChange_ChangeEntity()
        {
            ChangeEntity changeEntity = null;
            var          parser       = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => changeEntity = args as ChangeEntity;

            parser.Parse(new Line("Power", "D 13:14:00.5727617 PowerTaskList.DebugPrintPower() -     CHANGE_ENTITY - Updating Entity=[entityName=Shifting Scroll id=28 zone=HAND zonePos=7 cardId=LOOT_104 player=1] CardID=UNG_948"));
            Assert.IsNotNull(changeEntity);
            Assert.AreEqual(28, changeEntity.EntityId);
            Assert.AreEqual("UNG_948", changeEntity.CardId);
        }
        public void GameStateChange_Entity_PredictedCardId()
        {
            FullEntity entity = null;
            var        parser = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => entity = args as FullEntity;

            parser.Parse(new Line("Power", "D 00:31:50.9114028 PowerTaskList.DebugPrintPower() - BLOCK_START BlockType=POWER Entity=[entityName=King Togwaggle id=60 zone=PLAY zonePos=2 cardId=LOOT_541 player=2] EffectCardId= EffectIndex=0 Target=0 SubOption=-1"));
            parser.Parse(new Line("Power", "D 00:32:08.3649436 PowerTaskList.DebugPrintPower() -     FULL_ENTITY - Updating [entityName=UNKNOWN ENTITY [cardType=INVALID] id=61 zone=HAND zonePos=0 cardId= player=1] CardID="));
            Assert.IsNotNull(entity);
            Assert.AreEqual(CardIds.NonCollectible.Neutral.KingTogwaggle_KingsRansomToken, entity.Data.CardId);
        }
Exemple #12
0
        public void PipeChainExecuted()
        {
            _context.CommandContext.RegisterCommand <AddNumberCommand>();
            _context.CommandContext.RegisterCommand <SubtractNumberCommand>();
            _context.CommandContext.RegisterCommand <MultiplyNumberCommand>();
            _context.CommandContext.RegisterCommand <DivideNumberCommand>();

            var parseResult = PowerParser.ParseInput("Add-Number 3 7 | Subtract-Number 5 | Multiply-Number 4 | Divide-Number 40 -FlipArguments");
            var result      = CommandExecuter.ExecuteChain(parseResult.Value as PipeChain, _context, _host);

            Assert.AreEqual(2.0, result);
        }
        public void GameStateChange_TagChange_CreationTag()
        {
            TagChange tagChange = null;
            var       parser    = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => tagChange = args as TagChange;

            parser.Parse(new Line("Power", "D 00:31:50.9189508 PowerTaskList.DebugPrintPower() -         tag=CONTROLLER value=2"));
            Assert.IsNotNull(tagChange);
            Assert.IsTrue(tagChange.CreationTag);
            Assert.AreEqual(GameTag.CONTROLLER, tagChange.Tag);
            Assert.AreEqual(2, tagChange.Value);
        }
Exemple #14
0
        public void MandatoryCommandExecuted()
        {
            _context.CommandContext.RegisterCommand <MandatoryNamedCommand>();
            var parseResult = PowerParser.ParseInput("Mandatory-Named -Message 'Goodbye'");
            var result      = CommandExecuter.Execute(parseResult.Value as pstudio.PowerConsole.Parser.Command, _context, _host);

            Assert.AreEqual("Hello World", result);

            parseResult = PowerParser.ParseInput("Mandatory-Named -Message 'Goodbye' -Flag");
            result      = CommandExecuter.Execute(parseResult.Value as pstudio.PowerConsole.Parser.Command, _context, _host);

            Assert.AreEqual("Goodbye", result);
        }
        public void CreateGame()
        {
            var createGame = 0;
            var parser     = new PowerParser(new MockGameInfo());

            parser.CreateGame += () => createGame++;

            parser.Parse(new Line("Power", "D 00:29:50.5743926 GameState.DebugPrintPower() - CREATE_GAME"));
            Assert.AreEqual(1, createGame);

            parser.Parse(new Line("Power", "D 00:29:52.6023387 PowerTaskList.DebugPrintPower() -     CREATE_GAME"));
            Assert.AreEqual(1, createGame);
        }
        public void GameStateChange_Entity()
        {
            FullEntity entity = null;
            var        parser = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => entity = args as FullEntity;

            parser.Parse(new Line("Power", "D 00:29:52.7090966 PowerTaskList.DebugPrintPower() -     FULL_ENTITY - Updating [entityName=UNKNOWN ENTITY [cardType=INVALID] id=4 zone=DECK zonePos=0 cardId= player=1] CardID="));
            Assert.IsNotNull(entity);
            Assert.IsNotNull(entity.Data);
            Assert.AreEqual(4, entity.Data.Id);
            Assert.AreEqual(string.Empty, entity.Data.CardId);
            Assert.AreEqual(Zone.DECK, entity.Data.Zone);
        }
        public void GameStateChange_GameEntity()
        {
            FullEntity entity = null;
            var        parser = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => entity = args as FullEntity;

            parser.Parse(new Line("Power", "D 00:29:52.6063231 PowerTaskList.DebugPrintPower() -         GameEntity EntityID=1"));
            Assert.IsNotNull(entity);
            var data = entity.Data as GameEntityData;

            Assert.IsNotNull(data);
            Assert.AreEqual(1, data.Id);
        }
Exemple #18
0
        public void PositionalCommandIncorrectPositionalArgumentTypeExecuted()
        {
            _context.CommandContext.RegisterCommand <AddNumberCommand>();
            var parseResult = PowerParser.ParseInput("Add-Number 2 '2'");

            try
            {
                var result = CommandExecuter.Execute(parseResult.Value as pstudio.PowerConsole.Parser.Command, _context, _host);
                Assert.Fail();
            }
            catch (InvalidArgumentTypeException)
            {
            }
        }
Exemple #19
0
        public void PositionalCommandMissingArgumentExecuted()
        {
            _context.CommandContext.RegisterCommand <AddNumberCommand>();
            var parseResult = PowerParser.ParseInput("Add-Number 2 ");

            try
            {
                var result = CommandExecuter.Execute(parseResult.Value as pstudio.PowerConsole.Parser.Command, _context, _host);
                Assert.Fail();
            }
            catch (MissingMandatoryParameterException)
            {
            }
        }
        public void GameStateChange_PlayerEntity()
        {
            FullEntity entity = null;
            var        parser = new PowerParser(new MockGameInfo());

            parser.GameStateChange += args => entity = args as FullEntity;

            parser.Parse(new Line("Power", "D 00:29:52.6665096 PowerTaskList.DebugPrintPower() -         Player EntityID=3 PlayerID=2 GameAccountId=[hi=144115198130930503 lo=15856412]"));
            Assert.IsNotNull(entity);
            var data = entity.Data as PlayerEntityData;

            Assert.IsNotNull(data);
            Assert.AreEqual(2, data.PlayerId);
            Assert.AreEqual(3, data.Id);
        }
        public void SetupComplete()
        {
            var count  = 0;
            var parser = new PowerParser(new MockGameInfo());

            parser.SetupComplete += () => count++;

            parser.Parse(new Line("Power", "D 00:29:52.5947934 PowerTaskList.DebugDump() - ID=1 ParentID=0 PreviousID=0 TaskCount=88"));
            Assert.AreEqual(0, count);

            parser.Parse(new Line("Power", "D 00:29:55.3363610 PowerTaskList.DebugDump() - ID=2 ParentID=0 PreviousID=0 TaskCount=40"));
            Assert.AreEqual(1, count);

            parser.Parse(new Line("Power", "D 00:29:56.0075931 PowerTaskList.DebugDump() - ID=22 ParentID=0 PreviousID=0 TaskCount=1"));
            Assert.AreEqual(1, count);
        }
Exemple #22
0
        public void PipeChainExcessArgumentExecuted()
        {
            _context.CommandContext.RegisterCommand <AddNumberCommand>();
            _context.CommandContext.RegisterCommand <SubtractNumberCommand>();
            _context.CommandContext.RegisterCommand <MultiplyNumberCommand>();
            _context.CommandContext.RegisterCommand <DivideNumberCommand>();

            var parseResult = PowerParser.ParseInput("Add-Number 3 7 | Subtract-Number 5 5");

            try
            {
                CommandExecuter.ExecuteChain(parseResult.Value as PipeChain, _context, _host);
                Assert.Fail();
            }
            catch (UnexpectedPositionalArgument)
            {
            }
        }
Exemple #23
0
        public static TMeasurement Parse <TMeasurement>(double value, string type)
            where TMeasurement : IMeasurement
        {
            var runtimeType = typeof(TMeasurement);

            if (runtimeType == typeof(IEnergy))
            {
                return((TMeasurement)EnergyParser.Parse(value, type));
            }

            if (runtimeType == typeof(IPower))
            {
                return((TMeasurement)PowerParser.Parse(value, type));
            }

            if (runtimeType == typeof(IRatio))
            {
                return((TMeasurement)RatioParser.Parse(value, type));
            }

            if (runtimeType == typeof(ITemperature))
            {
                return((TMeasurement)TemperatureParser.Parse(value, type));
            }

            if (runtimeType == typeof(IHumidity))
            {
                return((TMeasurement)HumidityParser.Parse(value, type));
            }

            if (runtimeType == typeof(IIlluminance))
            {
                return((TMeasurement)IlluminanceParser.Parse(value, type));
            }

            if (runtimeType == typeof(IMeasurement))
            {
                return((TMeasurement)(IMeasurement) new ReadOnlyMeasurement(value, type));
            }

            throw new Exception("Could not determine type " + runtimeType.Name);
        }
        public void BlockStart()
        {
            IBlockData blockData = null;
            var        parser    = new PowerParser(new MockGameInfo());

            parser.BlockStart += args => blockData = args;

            parser.Parse(new Line("Power", "D 00:33:01.7253587 PowerTaskList.DebugPrintPower() - BLOCK_START BlockType=ATTACK Entity=[entityName=Vilefin Inquisitor id=60 zone=PLAY zonePos=2 cardId=OG_006 player=2] EffectCardId= EffectIndex=0 Target=[entityName=Jade Spirit id=40 zone=PLAY zonePos=2 cardId=CFM_715 player=1] SubOption=-1"));
            Assert.IsNotNull(blockData);
            Assert.AreEqual("OG_006", blockData.CardId);
            Assert.AreEqual(60, blockData.Id);
            Assert.IsNotNull(blockData.Target);
            Assert.AreEqual(40, blockData.Target.Id);
            Assert.AreEqual("CFM_715", blockData.Target.CardId);
            Assert.AreEqual(BlockType.ATTACK, blockData.Type);

            blockData = null;
            parser.Parse(new Line("Power", "D 00:33:04.6148508 PowerTaskList.DebugPrintPower() - BLOCK_START BlockType=TRIGGER Entity=Epix EffectCardId= EffectIndex=-1 Target=0 SubOption=-1 TriggerKeyword=0"));
            Assert.IsNotNull(blockData);
            Assert.IsNull(blockData.Target);
            Assert.AreEqual(BlockType.TRIGGER, blockData.Type);
        }
Exemple #25
0
 public void ItDoesNotThrowAnExceptionWhenParsingValidValues(string input)
 {
     PowerParser.Parse(input);
 }
Exemple #26
0
 public void ItThrowsAnExceptionWhenParsingInvalidValues(string input)
 {
     PowerParser.Parse(input);
 }
Exemple #27
0
        public void ItParsesTheValueProperly(string input, double expected)
        {
            var result = PowerParser.Parse(input);

            Assert.That(result.Value, Is.EqualTo(expected));
        }
Exemple #28
0
        public void ItParsesTheTypeProperly(string input, Type type)
        {
            var result = PowerParser.Parse(input);

            Assert.That(result.GetType(), Is.EqualTo(type));
        }
Exemple #29
0
        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);
        }
Exemple #30
0
        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);
        }