Re-arrange source code and tests
This commit is contained in:
41
Sources/SwiftUIMath/Internal/Syntax/Atoms/Style.swift
Normal file
41
Sources/SwiftUIMath/Internal/Syntax/Atoms/Style.swift
Normal file
@@ -0,0 +1,41 @@
|
||||
import Foundation
|
||||
|
||||
extension Math {
|
||||
final class Style: Atom {
|
||||
enum Level: Int {
|
||||
case display
|
||||
case text
|
||||
case script
|
||||
case scriptOfScript
|
||||
|
||||
var isScript: Bool {
|
||||
switch self {
|
||||
case .script, .scriptOfScript:
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
var isNotScript: Bool {
|
||||
!isScript
|
||||
}
|
||||
|
||||
func next() -> Level {
|
||||
Level(rawValue: rawValue + 1) ?? .display
|
||||
}
|
||||
}
|
||||
|
||||
var level: Level
|
||||
|
||||
init(_ style: Style) {
|
||||
self.level = style.level
|
||||
super.init(style)
|
||||
}
|
||||
|
||||
init(level: Level = .display) {
|
||||
self.level = level
|
||||
super.init(type: .style)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user