Symbol

parsley.token.symbol.Symbol
abstract class Symbol

This class defines a uniform interface for defining parsers for basic symbols, independent of how whitespace should be handled after the symbol.

Attributes

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

Members list

Value members

Abstract methods

def apply(name: String): Parsley[Unit]

This combinator parses a given string as a symbol and accounts for the possiblility that it is a defined hard keyword or operator.

This combinator parses a given string as a symbol and accounts for the possiblility that it is a defined hard keyword or operator.

A string is treated as a symbol by parsing it atomically (with attempt) as well as ensuring that if it is a known special symbol, like a keyword, that it is given the correct treatment. For keywords and operators, this means that the given string will only parse if it does not otherwise form a valid prefix of a larger legal identifier or operator.

Value parameters

name

the symbol to parse.

Attributes

Since

4.0.0

Source
Symbol.scala
def apply(name: Char): Parsley[Unit]

This combinator parses a given character as a symbol.

This combinator parses a given character as a symbol.

There is no special treatment of the given character as a keyword or operator. The result of the parser is ignored by returning Unit.

Value parameters

name

the symbol to parse.

Attributes

Since

4.0.0

Source
Symbol.scala

This combinator parses a given soft keyword atomically: the keyword is only valid if it is not followed directly by a character which would make it a larger valid identifier.

This combinator parses a given soft keyword atomically: the keyword is only valid if it is not followed directly by a character which would make it a larger valid identifier.

Soft keywords are keywords that are only reserved within certain contexts. The apply(String) combinator handles so-called hard keywords automatically, as the given string is checked to see what class of symbol it might belong to. However, soft keywords are not included in this set, as they are not always reserved in all situations. As such, when a soft keyword does need to be parsed, this combinator should be used to do it explicitly. Care should be taken to ensure that soft keywords take parsing priority over identifiers when they do occur.

Attributes

Since

4.0.0

Source
Symbol.scala

This combinator parses a given soft operator atomically: the operator is only valid if it is not followed directly by a character which would make it a larger valid operator (reserved or otherwise).

This combinator parses a given soft operator atomically: the operator is only valid if it is not followed directly by a character which would make it a larger valid operator (reserved or otherwise).

Soft operators are operators that are only reserved within certain contexts. The apply(String) combinator handles so-called hard operators automatically, as the given string is checked to see what class of symbol it might belong to. However, soft operators are not included in this set, as they are not always reserved in all situations. As such, when a soft operator does need to be parsed, this combinator should be used to do it explicitly.

Attributes

Since

4.0.0

Source
Symbol.scala

Concrete methods

final def apply(name: String, label: String): Parsley[Unit]

This combinator parses a given string as a symbol and accounts for the possiblility that it is a defined hard keyword or operator.

This combinator parses a given string as a symbol and accounts for the possiblility that it is a defined hard keyword or operator.

A string is treated as a symbol by parsing it atomically (with attempt) as well as ensuring that if it is a known special symbol, like a keyword, that it is given the correct treatment. For keywords and operators, this means that the given string will only parse if it does not otherwise form a valid prefix of a larger legal identifier or operator.

Additionally applies the given label as the name of the symbol.

Value parameters

label

the name to give to the symbol in error messages.

name

the symbol to parse.

Attributes

Since

4.0.0

Source
Symbol.scala
final def apply(name: Char, label: String): Parsley[Unit]

This combinator parses a given character as a symbol.

This combinator parses a given character as a symbol.

There is no special treatment of the given character as a keyword or operator. The result of the parser is ignored by returning Unit.

Additionally applies the given label as the name of the symbol.

Value parameters

label

the name to give to the symbol in error messages.

name

the symbol to parse.

Attributes

Since

4.0.0

Source
Symbol.scala

Concrete fields

final lazy val closingAngle: Parsley[Unit]

This parser parses a closing square bracket > as a symbol.

This parser parses a closing square bracket > as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val closingBrace: Parsley[Unit]

This parser parses a closing brace } as a symbol.

This parser parses a closing brace } as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val closingParen: Parsley[Unit]

This parser parses a closing parenthesis ) as a symbol.

This parser parses a closing parenthesis ) as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val closingSquare: Parsley[Unit]

This parser parses a closing square bracket ] as a symbol.

This parser parses a closing square bracket ] as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val colon: Parsley[Unit]

This parser parses a colon : as a symbol.

This parser parses a colon : as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val comma: Parsley[Unit]

This parser parses a comma , as a symbol.

This parser parses a comma , as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val dot: Parsley[Unit]

This parser parses a dot . as a symbol.

This parser parses a dot . as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala

This object can be imported from to expose a way of converting raw Scala string literals into a parser for that specific token.

This object can be imported from to expose a way of converting raw Scala string literals into a parser for that specific token.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val openAngle: Parsley[Unit]

This parser parses an open angle bracket < as a symbol.

This parser parses an open angle bracket < as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val openBrace: Parsley[Unit]

This parser parses an open brace { as a symbol.

This parser parses an open brace { as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val openParen: Parsley[Unit]

This parser parses an open parenthesis ( as a symbol.

This parser parses an open parenthesis ( as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val openSquare: Parsley[Unit]

This parser parses an open square bracket [ as a symbol.

This parser parses an open square bracket [ as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala
final lazy val semi: Parsley[Unit]

This parser parses a semicolon ; as a symbol.

This parser parses a semicolon ; as a symbol.

Attributes

Since

4.0.0

Source
Symbol.scala