# How do I create a Crystal::Path object?

**URL:** <https://forum.crystal-lang.org/t/how-do-i-create-a-crystal-path-object/5425>\
**Category:** Help & Support\
**Created:** [February 25, 2023, 7:49am UTC](https://forum.crystal-lang.org/t/how-do-i-create-a-crystal-path-object/5425 "2023-02-25T07:49:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![meatball133](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/meatball133/32/1869_2.png) [@meatball133](https://forum.crystal-lang.org/u/meatball133)\
**Post date:** [February 25, 2023, 7:49am UTC](https://forum.crystal-lang.org/t/how-do-i-create-a-crystal-path-object/5425/1 "2023-02-25T07:49:44Z")

</div>

I have found a way to create a generic Crystal::ASTNode.

But I also need to be able to generate a path, do some one know how?

This code generates a ASTNode:

```crystal
    if @@data.includes?(node.name)
      location = @@data.index(node.name)
      unless location.nil?
        node.name = Crystal::Parser.new("PLACEHOLDER_#{location + 1}").parse
      end
    else
      @@data << node.name
      node.name = Crystal::Parser.new("PLACEHOLDER_#{@@counter}").parse
      @@counter += 1
    end
    node

```

---

<div class="post-metadata">

**Author:** ![straight-shoota](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.crystal-lang.org/straight-shoota/32/36_2.png) [@straight-shoota](https://forum.crystal-lang.org/u/straight-shoota)\
**Post date:** [February 25, 2023, 1:37pm UTC](https://forum.crystal-lang.org/t/how-do-i-create-a-crystal-path-object/5425/2 "2023-02-25T13:37:57Z")

</div>

`Crystal::Path` has a simple constructor:

> <https://github.com/crystal-lang/crystal/blob/94c1f02d64ff8da176e82739321e911fc921dc9d/src/compiler/crystal/syntax/ast.cr#L1377-L1378>
