Whis can be flattened into a single pattern matching.
```scala
val next = currentNode.defaultNextNode match {
  case None if (fragment.startsWith(":")) => {
    val nextNode = new PathMatchingNode()
    currentNode.setDefaultNextNode(nextNode)
    nextNode
  }
  case None => {
    val nextNode = new PathMatchingNode()
    currentNode.addNextNode(fragment, nextNode)
    nextNode
  }
  case Some(nextNode) => nextNode
}
```