case class Success[A] extends Result[Nothing, A] with Product with Serializable
Returned when a parser succeeded.
- A
The type of expected success result
- Alphabetic
- By Inheritance
- Success
- Serializable
- Serializable
- Product
- Equals
- Result
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
contains[B >: A](elem: B): Boolean
Returns
true
if this is aSuccess
and its value is equal toelem
(as determined by==
), returnsfalse
otherwise.Returns
true
if this is aSuccess
and its value is equal toelem
(as determined by==
), returnsfalse
otherwise.- elem
the element to test.
- returns
true
if this is aSuccess
value equal toelem
.
- Definition Classes
- Result
- Since
1.7.0
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
exists(p: (A) ⇒ Boolean): Boolean
Returns
false
ifFailure
or returns the result of the application of the given predicate to theSuccess
value.Returns
false
ifFailure
or returns the result of the application of the given predicate to theSuccess
value.- Definition Classes
- Result
- Since
1.7.0
-
def
filterOrElse[Err_ >: Nothing](p: (A) ⇒ Boolean, msg: ⇒ Err_): Result[Err_, A]
Returns
Success
with the existing value ofSuccess
if this is aSuccess
and the given predicatep
holds for the right value, orFailure(msg)
if this is aSuccess
and the given predicatep
does not hold for the right value, orFailure
with the existing value ofFailure
if this is aFailure
.Returns
Success
with the existing value ofSuccess
if this is aSuccess
and the given predicatep
holds for the right value, orFailure(msg)
if this is aSuccess
and the given predicatep
does not hold for the right value, orFailure
with the existing value ofFailure
if this is aFailure
.- Definition Classes
- Result
- Since
1.7.0
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
flatMap[B, Err_ >: Nothing](f: (A) ⇒ Result[Err_, B]): Result[Err_, B]
Binds the given function across
Success
.Binds the given function across
Success
.- f
The function to bind across
Success
.
- Definition Classes
- Result
- Since
1.7.0
-
def
flatten[B, Err_ >: Nothing](implicit ev: <:<[A, Result[Err_, B]]): Result[Err_, B]
Returns the right value if this is right or this value if this is left
Returns the right value if this is right or this value if this is left
Equivalent to
flatMap(id => id)
- Definition Classes
- Result
- Since
1.7.0
-
def
fold[B](ferr: (Nothing) ⇒ B, fa: (A) ⇒ B): B
Applies
fa
if this is aFailure
orfb
if this is aSuccess
.Applies
fa
if this is aFailure
orfb
if this is aSuccess
.- ferr
the function to apply if this is a
Failure
- fa
the function to apply if this is a
Success
- returns
the results of applying the function
- Definition Classes
- Result
- Since
1.7.0
-
def
forall(f: (A) ⇒ Boolean): Boolean
Returns
true
ifFailure
or returns the result of the application of the given predicate to theSuccess
value.Returns
true
ifFailure
or returns the result of the application of the given predicate to theSuccess
value.- Definition Classes
- Result
- Since
1.7.0
-
def
foreach[U](f: (A) ⇒ U): Unit
Executes the given side-effecting function if this is a
Success
.Executes the given side-effecting function if this is a
Success
.- f
The side-effecting function to execute.
- Definition Classes
- Result
- Since
1.7.0
-
def
get: A
Returns the results's value.
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getOrElse[B >: A](or: ⇒ B): B
Returns the value from this
Success
or the given argument if this is aFailure
.Returns the value from this
Success
or the given argument if this is aFailure
.- Definition Classes
- Result
- Since
1.7.0
-
def
isFailure: Boolean
Returns
true
if this is aFailure
,false
otherwise. -
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isSuccess: Boolean
Returns
true
if this is aSuccess
,false
otherwise. -
def
map[B](f: (A) ⇒ B): Result[Nothing, B]
The given function is applied if this is a
Success
.The given function is applied if this is a
Success
.- Definition Classes
- Result
- Since
1.7.0
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
orElse[B >: A, Err_ >: Nothing](or: ⇒ Result[Err_, B]): Result[Err_, B]
Returns this
Success
or the given argument if this is aFailure
.Returns this
Success
or the given argument if this is aFailure
.- Definition Classes
- Result
- Since
1.7.0
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toEither: Either[Nothing, A]
Converts the
Result
into aEither
whereFailure
maps to aLeft[Err]
Converts the
Result
into aEither
whereFailure
maps to aLeft[Err]
- Definition Classes
- Result
- Since
1.7.0
-
def
toOption: Option[A]
Returns a
Some
containing theSuccess
value if it exists or aNone
if this is aFailure
.Returns a
Some
containing theSuccess
value if it exists or aNone
if this is aFailure
.- Definition Classes
- Result
- Since
1.7.0
-
def
toSeq: Seq[A]
Returns a
Seq
containing theSuccess
value if it exists or an emptySeq
if this is aFailure
.Returns a
Seq
containing theSuccess
value if it exists or an emptySeq
if this is aFailure
.- Definition Classes
- Result
- Since
1.7.0
-
def
toTry: Try[A]
Converts the
Result
into aTry
whereFailure
maps to a plainException
Converts the
Result
into aTry
whereFailure
maps to a plainException
- Definition Classes
- Result
- Since
1.7.0
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
- val x: A
This is the documentation for Parsley.
Package structure
The parsley package contains the
Parsley
class, as well as theResult
,Success
, andFailure
types. In addition to these, it also contains the following packages and "modules" (a module is defined as being an object which mocks a package):parsley.Parsley
contains the bulk of the core "function-style" combinators, as well as the implicit classes which enable the "method-style" combinators.parsley.combinator
contains many helpful combinators that simplify some common parser patterns.parsley.character
contains the combinators needed to read characters and strings, as well as combinators to match specific sub-sets of characters.parsley.debug
contains debugging combinators, helpful for identifying faults in parsers.parsley.io
contains extension methods to run parsers with input sourced from IO sources.parsley.expr
contains the following sub modules:parsley.expr.chain
contains combinators used in expression parsingparsley.expr.precedence
is a builder for expression parsers built on a precedence table.parsley.implicits
contains several implicits to add syntactic sugar to the combinators. These are sub-categorised into the following sub modules:parsley.implicits.character
contains implicits to allow you to use character and string literals as parsers.parsley.implicits.combinator
contains implicits related to combinators, such as the ability to make any parser into aParsley[Unit]
automatically.parsley.implicits.lift
enables postfix application of the lift combinator onto a function (or value).parsley.implicits.zipped
enables boths a reversed form of lift where the function appears on the right and is applied on a tuple (useful when type inference has failed) as well as a.zipped
method for building tuples out of several combinators.parsley.errors
contains modules to deal with error messages, their refinement and generation.parsley.errors.combinator
provides combinators that can be used to either produce more detailed errors as well as refine existing errors.parsley.lift
contains functions which lift functions that work on regular types to those which now combine the results of parsers returning those same types. these are ubiquitous.parsley.registers
contains combinators that interact with the context-sensitive functionality in the form of registers.parsley.token
contains theLexer
class that provides a host of helpful lexing combinators when provided with the description of a language.parsley.unsafe
contains unsafe (and not thread-safe) ways of speeding up the execution of a parser.