コード例 #1
0
 /// <summary>
 /// Implements moving the current data pointer to a new line number
 /// </summary>
 /// <param name="lineNumber">line number to move to, null moves to beginning of program.</param>
 public void RestoreToLineNumber(int?lineNumber)
 {
     _currentDataLine = lineNumber.HasValue
         ? _programRepository.GetLine(lineNumber.Value)
         : _programRepository.GetFirstLine();
     ReadInputParser.Clear();
     _faulted = false;
 }
コード例 #2
0
ファイル: Input.cs プロジェクト: johnmbaughman/ClassicBasic
 /// <summary>
 /// Initializes a new instance of the <see cref="Input"/> class.
 /// </summary>
 /// <param name="runEnvironment">Run time environment.</param>
 /// <param name="expressionEvaluator">Expression evaluator.</param>
 /// <param name="variableRepository">Variable repository.</param>
 /// <param name="teletype">Teletype to use.</param>
 public Input(
     IRunEnvironment runEnvironment,
     IExpressionEvaluator expressionEvaluator,
     IVariableRepository variableRepository,
     ITeletype teletype)
     : base("INPUT", TokenClass.Statement)
 {
     _runEnvironment      = runEnvironment;
     _expressionEvaluator = expressionEvaluator;
     _variableRepository  = variableRepository;
     _teletype            = teletype;
     _readInputParser     = new ReadInputParser(ReadLine);
 }
コード例 #3
0
 private void SetupSut()
 {
     _inputQueue = new Queue <string>();
     _sut        = new ReadInputParser(() => _inputQueue.Dequeue());
     _sut.Clear();
     _variableRepository  = new VariableRepository();
     _numericVariables[0] = _variableRepository.GetOrCreateVariable("A", new short[] { });
     _numericVariables[1] = _variableRepository.GetOrCreateVariable("B", new short[] { });
     _numericVariables[2] = _variableRepository.GetOrCreateVariable("C", new short[] { });
     _stringVariables[0]  = _variableRepository.GetOrCreateVariable("A$", new short[] { });
     _stringVariables[1]  = _variableRepository.GetOrCreateVariable("B$", new short[] { });
     _stringVariables[2]  = _variableRepository.GetOrCreateVariable("C$", new short[] { });
 }
コード例 #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DataStatementReader"/> class.
 /// </summary>
 /// <param name="runEnvironment">Run environment.</param>
 /// <param name="programRepository">Program repository to use.</param>
 public DataStatementReader(IRunEnvironment runEnvironment, IProgramRepository programRepository)
 {
     _runEnvironment    = runEnvironment;
     _programRepository = programRepository;
     ReadInputParser    = new ReadInputParser(GetNextDataStatement);
 }