예제 #1
0
파일: File.cs 프로젝트: GabeScott/ILS
        public void LoadAllLinesAndExecute()
        {
            using (StreamReader sr = new StreamReader(fileName))
            {
                string temp = sr.ReadLine();
                LinePointer.SetFirstLine(beginFileTokenLineNumber);


                while (!FoundBeginFile(temp))
                {
                    fileLineTokens.Add(new TokenLine(temp.Trim()));
                    LinePointer.Increment();
                    temp = sr.ReadLine();
                    beginFileTokenLineNumber++;
                }


                while (temp != null)
                {
                    fileLineTokens.Add(new TokenLine(temp.Trim()));
                    LinePointer.Increment();
                    temp = sr.ReadLine();
                }

                LinePointer.SetFirstLine(beginFileTokenLineNumber);
            }

            LoadLineMarkers();
            ParseAndExecute();
        }
예제 #2
0
        private static void ReturnPointer(Token[] functionArguments)
        {
            if (functionArguments.Length > 0)
            {
                throw new ILSException("Return does not take arguments");
            }

            LinePointer.ReturnMostRecent();
        }
예제 #3
0
파일: File.cs 프로젝트: GabeScott/ILS
 private void ParseAndExecute()
 {
     while (LinePointer.GetCurrentLine() < fileLineTokens.Count)
     {
         int line = LinePointer.GetCurrentLine();
         fileLineTokens[line - 1].ParseAndExecute();
         LinePointer.Increment();
     }
 }
예제 #4
0
        public static void RunFunction(string function, Token[] functionArguments)
        {
            string output = GetOutput(functionArguments);

            FunctionName result;

            Enum.TryParse(function, out result);

            if (result == FunctionName.PRINT)
            {
                Console.Write(output);
            }

            else if (result == FunctionName.PRINTN)
            {
                Console.WriteLine(output);
            }

            else if (result == FunctionName.UPDATE)
            {
                UpdateVariable(functionArguments);
            }

            else if (result == FunctionName.JUMPTO)
            {
                LinePointer.InsertJump(GetLineJumpNumber(functionArguments));
            }

            else if (result == FunctionName.JUMPONCE)
            {
                LinePointer.InsertJumpOnce(GetLineJumpNumber(functionArguments));
            }

            else if (result == FunctionName.RETURN)
            {
                ReturnPointer(functionArguments);
            }
        }
예제 #5
0
 public ILSException(string m) : base("Exception thrown on line " + LinePointer.GetCurrentLine() + ": " + m)
 {
 }
예제 #6
0
파일: Logger.cs 프로젝트: GabeScott/ILS
 public static void LogErrorAndQuit(string errorMessage)
 {
     Console.WriteLine("Exception thrown on line " + LinePointer.GetCurrentLine() + ": " + errorMessage);
     Console.ReadKey();
     Environment.Exit(0);
 }
예제 #7
0
 public void Return(Token[] args)
 {
     LinePointer.ReturnMostRecent();
 }
예제 #8
0
        public void Jumponce(Token[] args)
        {
            int linenumber = GetLineJumpNumber(args);

            LinePointer.InsertJumpOnce(linenumber);
        }