public ReadResults Parse(IStringReader reader, DispatcherResources resources, out Objective result) { result = default; ReadResults readResults; string objective; if (UseBedrock) { readResults = reader.ReadString(out objective); } else { readResults = reader.ReadUnquotedString(out objective); } if (!readResults.Successful) { return(readResults); } if (objective.Length > 16) { return(ReadResults.Failure(CommandError.ObjectiveNameTooLong())); } result = new Objective(objective); return(ReadResults.Success()); }
private ReadResults ReadKey(out string result) { Reader.SkipWhitespace(); if (!Reader.CanRead()) { result = default; return(ReadResults.Failure(CommandError.ExpectedKey().WithContext(Reader))); } return(Reader.ReadString(out result)); }
public void StartProcessing(string exitString) { var evalString = reader.ReadString() ?? string.Empty; while (evalString != exitString) { if (evalString.StartsWith("Run ")) { InterpreterBuilder .GetInterpreter(new [] { "File", evalString.Split(' ')[1] }) .StartProcessing(string.Empty); } evaluator.EvaluateString(evalString); evalString = reader.ReadString() ?? string.Empty; } foreach (var parameter in evaluator.Parameters) { writer.WriteLine($"{parameter.Key} = {parameter.Value}"); } }
public ReadResults Parse(IStringReader reader, DispatcherResources resources, out string result) { if (Type == StringType.GREEDY) { result = reader.GetRemaining(); reader.SetCursor(reader.GetLength()); return(ReadResults.Success()); } else if (Type == StringType.WORD) { return(reader.ReadUnquotedString(out result)); } else { return(reader.ReadString(out result)); } }
/// <exception cref="CommandSyntaxException" /> public override string Parse(IStringReader reader) { if (Type == StringArgType.GreedyPhrase) { var text = reader.Remaining; reader.Cursor = reader.TotalLength; return(text); } else if (Type == StringArgType.SingleWord) { return(reader.ReadUnquotedString()); } else { return(reader.ReadString()); } }
/// <summary> /// Reads a single string. /// </summary> /// <returns>Returns the string read. Never returns null.</returns> public string ReadString() { var stream = CurrentStream; return(_stringReader.ReadString(stream)); }