abstract class Character extends AnyRef
This class defines a uniform interface for defining parsers for character literals, independent of how whitespace should be handled after the literal.
- Source
- Character.scala
- Since
4.0.0
- Note
implementations of this class found within
Lexermay employ sharing and refine thedefs in this class intovalorlazy valwhen overriding.
- Alphabetic
- By Inheritance
- Character
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
ascii: Parsley[Char]
This parser will parse a single character literal, which may contain any graphic ASCII character.
This parser will parse a single character literal, which may contain any graphic ASCII character. These are characters with ordinals in range 0 to 127 inclusive. It may also contain escape sequences, but only those which result in ASCII characters.
scala> ascii.parse("'a'") val res0 = Success('a') scala> ascii.parse("'£'") val res1 = Failure(...) // £'s ordinal is not less than 127 scala> ascii.parse("'λ'") val res2 = Failure(...) // λ's ordinal is not less than 127 scala> ascii.parse("'🙂'") val res3 = Failure(...) // 🙂's ordinal is not less than 127
- Since
4.0.0
- Note
the exact behaviour of this parser is decided by the implementations given in
Lexer, which will depend on user-defined configuration. Please see the relevant documentation of these specific objects.
Example: -
abstract
def
basicMultilingualPlane: Parsley[Char]
This parser will parse a single character literal, which may contain any graphic character that falls within the "Basic Multilingual Plane" (BMP).
This parser will parse a single character literal, which may contain any graphic character that falls within the "Basic Multilingual Plane" (BMP). This is defined as any UTF-16 character that fits into 16 bits. A Scala
Charis exactly large enough to hold any BMP character. It may also contain escape sequences, but only those which result in BMP characters.scala> basicMultilingualPlane.parse("'a'") val res0 = Success('a') scala> basicMultilingualPlane.parse("'£'") val res1 = Success('£') scala> basicMultilingualPlane.parse("'λ'") val res2 = Success('λ') scala> basicMultilingualPlane.parse("'🙂'") val res3 = Failure(...) // 🙂 has a 32-bit codepoint of larger than 0xffff
- Since
4.0.0
- Note
the exact behaviour of this parser is decided by the implementations given in
Lexer, which will depend on user-defined configuration. Please see the relevant documentation of these specific objects.
Example: -
abstract
def
fullUtf16: Parsley[Int]
This parser will parse a single character literal, which may contain any unicode graphic character as defined by up to two UTF-16 codepoints.
This parser will parse a single character literal, which may contain any unicode graphic character as defined by up to two UTF-16 codepoints. It may also contain escape sequences.
scala> fullUtf16.parse("'a'") val res0 = Success(97) scala> fullUtf16.parse("'£'") val res1 = Success(163) scala> fullUtf16.parse("'λ'") val res2 = Success(0x03BB) scala> fullUtf16.parse("'🙂'") val res3 = Success(0x1F642)
- Since
4.0.0
- Note
the exact behaviour of this parser is decided by the implementations given in
Lexer, which will depend on user-defined configuration. Please see the relevant documentation of these specific objects.
Example: -
abstract
def
latin1: Parsley[Char]
This parser will parse a single character literal, which may contain any graphic extended ASCII character.
This parser will parse a single character literal, which may contain any graphic extended ASCII character. These are characters with ordinals in range 0 to 255 inclusive. It may also contain escape sequences, but only those which result in extended ASCII characters.
scala> latin1.parse("'a'") val res0 = Success('a') scala> latin1.parse("'£'") val res1 = Success('£') scala> latin1.parse("'λ'") val res2 = Failure(...) // λ's ordinal is not less than 255 scala> latin1.parse("'🙂'") val res3 = Failure(...) // 🙂's ordinal is not less than 255
- Since
4.0.0
- Note
the exact behaviour of this parser is decided by the implementations given in
Lexer, which will depend on user-defined configuration. Please see the relevant documentation of these specific objects.
Example:
Concrete 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
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(): java.lang.String
- Definition Classes
- AnyRef → Any
-
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()