SwiftSemantics Documentation Beta

Enumeration Precedence​Group.​Relation

public enum Relation

The relation of operators to operators in other precedence groups, which determines the order in which operators of different precedence groups are evaluated in absence of parentheses.

Consider the expression a ⧓ b ⧗ c. If the operator has a higher precedence than , then the expression is interpreted as (a ⧓ b) ⧗ c. If the operator has a lower precedence than , then the expression is interpreted as a ⧓ (b ⧗ c).

For example, Swift mathematical operators have the same inherent precedence as their corresponding arithmetic operations, such that 1 + 2 * 3 evaluates to 7 (1 + (2 * 3)) rather than 9 ((1 + 2) * 3).

%3 PrecedenceGroup.Relation PrecedenceGroup.Relation Codable Codable PrecedenceGroup.Relation->Codable Comparable Comparable PrecedenceGroup.Relation->Comparable Hashable Hashable PrecedenceGroup.Relation->Hashable

Member Of

PrecedenceGroup

An operator precedence group declaration.

Conforms To

Codable
Comparable
Hashable

Enumeration Cases

higher​Than

case higherThan(: [String])

The precedence group has higher precedence than the associated group names.

lower​Than

case lowerThan(: [String])

The precedence group has lower precedence than the associated group names.

Initializers

init(from:​)

public init(from decoder: Decoder) throws

init?(_:​)

public init?(_ node: PrecedenceGroupRelationSyntax)

Creates an instance initialized with the given syntax node.

Methods

<(lhs:​rhs:​)

public static func <(lhs: PrecedenceGroup.Relation, rhs: PrecedenceGroup.Relation) -> Bool

encode(to:​)

public func encode(to encoder: Encoder) throws