IndexedSymbolName
public struct IndexedSymbolName : CustomStringConvertible, Hashable
An IndexedSymbol designates either a terminal or a nonterminal.
IndexedSymbols are used to refer to terminals and nonterminals in grammar rules.
In order to distinguish between different occurrences of the same terminal / nonterminal, indexed symbols carry an optional index in addition to the actual name.
-
The name of the terminal or nonterminal that this indexed symbol designates.
Declaration
Swift
public let name: SymbolName -
An optional index to distinguish between different occurrences of the same terminal / nonterminal. A value of
0stands for this symbol having no index.Declaration
Swift
public let index: AnyHashable -
Constructs an indexed symbol.
Declaration
Swift
public init(_ name: SymbolName, _ index: AnyHashable = 0)Parameters
nameThe name of this indexed symbol.
indexAn optional index, to distinguish between different occurrences of the same terminal / nonterminal.
-
Whether this symbol has an index or not. An index of
0counts as having no index.Declaration
Swift
public var hasIndex: Bool { get }Return Value
falseifindexis0, otherwisetrue -
Declaration
Swift
public var description: String { get }
IndexedSymbolName Structure Reference