CharacterParsers

parsley.token.text.CharacterParsers
abstract class CharacterParsers

This class defines a uniform interface for defining parsers for character literals, independent of how whitespace should be handled after the literal.

Attributes

Since

4.0.0

Note

implementations of this class found within Lexer may employ sharing and refine the defs in this class into val or lazy val when overriding.

Source
Character.scala
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

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.

Attributes

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

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
Source
Character.scala

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 Char is exactly large enough to hold any BMP character. It may also contain escape sequences, but only those which result in BMP characters.

Attributes

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

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
Source
Character.scala

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.

Attributes

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

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)
Source
Character.scala

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.

Attributes

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

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
Source
Character.scala