implicit final class OperatorSugar[P, +A] extends AnyRef
This class enables "operator-style" alternative combinators on parsers.
This extension class exposes a collection of "operator-style" combinators on values that are convertible to parsers that are plain syntactic sugar for other functionality in the library; they are potentially less readable than the combinators they replace, so should be used sparingly.
- P
the type of base value that this class is used on (the conversion to
Parsley) is summoned automatically.
- Source
- extension.scala
- Since
4.0.0
- Alphabetic
- By Inheritance
- OperatorSugar
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
-
new
OperatorSugar(p: P)(implicit con: (P) ⇒ Parsley[A])
This constructor should not be called manually, it is designed to be used via Scala's implicit resolution.
This constructor should not be called manually, it is designed to be used via Scala's implicit resolution.
- p
the value that this class is enabling methods on.
- con
a conversion that allows values convertible to parsers to be used.
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
def
*: Parsley[List[A]]
This combinator, pronounced "star", will parse this parser zero or more times returning a list of the parsed results.
This combinator, pronounced "star", will parse this parser zero or more times returning a list of the parsed results.
Equivalent to
many, but as a postfix operator:many(p)is the same asp.*.- Note
an alias for
many.- See also
manyfor more details.
-
def
+: Parsley[List[A]]
This combinator, pronounced "plus", will parse this parser one or more times returning a list of the parsed results.
This combinator, pronounced "plus", will parse this parser one or more times returning a list of the parsed results.
Equivalent to
some, but as a postfix operator:some(p)is the same asp.+.- Note
an alias for
some.- See also
somefor more details.
-
def
-(q: Parsley[_]): Parsley[A]
This combinator, pronounced "and not", first parses its argument
q, and if it fails, it will parse this parser, returning its result.This combinator, pronounced "and not", first parses its argument
q, and if it fails, it will parse this parser, returning its result.First
qis parsed, which will never consume input regardless of failure or success. If it failed, then this parser is executed and its result is returned. If eitherqsucceeds or this parser fails, the combinator fails.- q
the parser to quotient this parser by.
- returns
a parser that only parses this parser if
qcannot parse.
// a less efficient version of a keyword: it's more efficient to not have to read the entire keyword twice def keyword(kw: String): Parsley[Unit] = { string(kw).void - identifier }
Example: -
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
?: Parsley[Option[A]]
This combinator, pronounced "option", will try parsing this parser wrapping its result in
Some, and returnNoneif it fails.This combinator, pronounced "option", will try parsing this parser wrapping its result in
Some, and returnNoneif it fails.Equivalent to
option, but as a postfix operator:option(p)is the same asp.?.- Note
an alias for
option.- See also
optionfor more details.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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()
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unary_!: Parsley[Unit]
This combinator, pronounced "not", will succeed when this parser fails, and vice-versa, never consuming input.
This combinator, pronounced "not", will succeed when this parser fails, and vice-versa, never consuming input.
Equivalent to
notFollowedBy, but as a prefix operator:notFollowedBy(p)is the same as!p.- Note
an alias for
notFollowedBy.- See also
notFollowedByfor more details.
-
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()