Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
michelchan committed Oct 3, 2024
1 parent 1f79dee commit f5dde9a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 25 deletions.
7 changes: 3 additions & 4 deletions morphir/src/org/finos/morphir/ir/gen1/moduleName.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ package org.finos.morphir.ir.gen1

trait ModuleNameModule { self: NameModule with PathModule =>

/**
* A module name is a unique identifier for a module within a package. It is represented by a `Path`, which is a
* "list" of names.
*/
/** A module name is a unique identifier for a module within a package. It is represented by a `Path`, which is a
* "list" of names.
*/
sealed case class ModuleName(path: Path) { self =>

/// Construct a new module name by concatting the given module name to this one.
Expand Down
38 changes: 17 additions & 21 deletions morphir/src/org/finos/morphir/ir/gen1/name.scala
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,10 @@ import scala.annotation.tailrec

trait NameModule {

/**
* `Name` is an abstraction of human-readable identifiers made up of words. This abstraction allows us to use the same
* identifiers across various naming conventions used by the different frontend and backend languages Morphir
* integrates with.
*/
/** `Name` is an abstraction of human-readable identifiers made up of words. This abstraction allows us to use the
* same identifiers across various naming conventions used by the different frontend and backend languages Morphir
* integrates with.
*/
sealed case class Name private (toList: List[String]) {
self =>
// def :+(that: String): Name = Name(self.toList :+ that)
Expand All @@ -27,9 +26,9 @@ trait NameModule {

@tailrec
def loop(
prefix: List[String],
abbrev: List[String],
suffix: List[String]
prefix: List[String],
abbrev: List[String],
suffix: List[String]
): List[String] =
suffix match {
case Nil =>
Expand All @@ -51,9 +50,8 @@ trait NameModule {
loop(List.empty, List.empty, words.toList)
}

/**
* Maps segments of the `Name`.
*/
/** Maps segments of the `Name`.
*/
def mapParts(f: String => String): Name = Name(self.toList.map(f))

def mkString(f: String => String)(sep: String): String =
Expand Down Expand Up @@ -105,18 +103,16 @@ trait NameModule {

private val pattern = """([a-zA-Z][a-z]*|[0-9]+)""".r

/**
* Converts a list of strings into a name. NOTE: When this function is used, the strings are used as is to construct
* the name, and don't go through any processing. This behavior is desired here as it is consistent with Morphir's
* semantics for this function as defined in the `morphir-elm` project.
*/
/** Converts a list of strings into a name. NOTE: When this function is used, the strings are used as is to
* construct the name, and don't go through any processing. This behavior is desired here as it is consistent with
* Morphir's semantics for this function as defined in the `morphir-elm` project.
*/
def fromList(list: List[String]): Name = Name(list)

/**
* Converts a list of strings into a name. NOTE: When this function is used, the strings are used as is to construct
* the name, and don't go through any processing. This behavior is desired here as it is consistent with Morphir's
* semantics for this function as defined in the `morphir-elm` project.
*/
/** Converts a list of strings into a name. NOTE: When this function is used, the strings are used as is to
* construct the name, and don't go through any processing. This behavior is desired here as it is consistent with
* Morphir's semantics for this function as defined in the `morphir-elm` project.
*/
def fromList(list: String*): Name = fromList(list.toList)

def fromIterable(iterable: Iterable[String]): Name =
Expand Down

0 comments on commit f5dde9a

Please sign in to comment.