Lightweight data hierarchies using tuples
Here I'm using tuples to create a lightweight hierarchy for my data, giving me a nice structure without having to introduce any additional types:
struct CodeSegment {
var tokens: (
previous: String?,
current: String
)
var delimiters: (
previous: Character?
next: Character?
)
}
handle(segment.tokens.current)