Exemple #1
0
        private List <BytecodeFound> IsWhile(List <TokensFound> tokens, int indented = 0)
        {
            var bytecodeFoundList = new List <BytecodeFound>();

            Size = 1;
            WhileLevel.Push(tokens[indented].Line);

            OperationsName.OperationsNameList.TryGetValue(tokens[indented].Token, out string opName);
            bytecodeFoundList.Add(CreateBytecodeFoundObject(opName));

            for (int index = indented + 2; index < tokens.Count; index += Size)
            {
                Size = 0;
                var list = GetBytecodeFound(tokens, index);
                if (list != null)
                {
                    list.ForEach(bytecode =>
                    {
                        Size++;
                        bytecodeFoundList.Add(bytecode);
                    });
                }
                else
                {
                    Size++;
                }
            }

            bytecodeFoundList.Add(CreateBytecodeFoundObject("POP_JUMP_IF_FALSE"));

            return(bytecodeFoundList);
        }