Parseable

com.phasmidsoftware.gryphon.parse.Parseable
See theParseable companion object
trait Parseable[T]

A trait that defines a typeclass for parsing strings into objects of type T.

Classes or objects implementing this trait must provide an implementation for the parse method, which takes a string input and converts it into an instance of the type parameter T.

Type parameters

T

The type of the object that the input string will be parsed into.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes

Members list

Value members

Abstract methods

def message: String

Returns a message providing details about of type T.

Returns a message providing details about of type T.

Attributes

Returns

The message.

def none: T

Returns a default value of type T.

Returns a default value of type T.

Attributes

Returns

the default value of type T, typically representing an "empty" or "none" state.

def parse(input: String): Try[T]

Parses the input string into an instance of type T. The parsing process utilizes the logic provided by the implementation of the parse method in the corresponding Parseable[T] instance.

Parses the input string into an instance of type T. The parsing process utilizes the logic provided by the implementation of the parse method in the corresponding Parseable[T] instance.

Value parameters

input

the string to be parsed into an instance of type T

Attributes

Returns

Try wrapping the resulting parsed object of type T if successful, or Failure with the corresponding exception if parsing fails

def regex: Regex

The regular expression used for parsing a Parseable[T].

The regular expression used for parsing a Parseable[T].

Attributes

Returns

A compiled regular expression. By default, the result matches one or more word characters (\w+).