using System.Threading.Tasks;

namespace Codeless.Data.Internal {
  [DebuggerDisplay("{Value,nq}")]
  internal class ObjectPath : Collection<ObjectPath> {
    public static readonly ObjectPath Empty = new ObjectPath();
    private static readonly Regex re = new Regex(
      @"((?!^)\$)?([^$.()][^.]*)|\$\(([^)]+)\)");

    protected ObjectPath() { }

    public ObjectPath(string str) {
      CommonHelper.ConfirmNotNull(str, "str");
      for (Match m = re.Match(str); m.Success; m = m.NextMatch()) {