protected override IEnumerable <BFCommand> ParseByRow(string row) { BFCommand prevCommand = default; for (int currentPos = 0; currentPos < row.Length;) { if (this.TryGetNextCommand(row, currentPos, out var command) && !prevCommand.IsBeginComment()) { yield return(command); prevCommand = command; currentPos += command.Length; continue; } else { command = this.GetTrivia(row, currentPos, prevCommand.IsBeginComment()); yield return(command); prevCommand = command; currentPos += command.Length; continue; } } }
public static bool IsExecutable(this BFCommand command) { return(!(command.IsUndefined() || command.IsTrivia() || command.IsBeginComment() || command.IsEndComment())); }