MarcoValue

public protocol MarcoValue : AnyObject, CustomStringConvertible

Marco value.

  • Element offset in a parent. Call MarcoDocument.updateOffsets() to initialize this property.

    Declaration

    Swift

    var offset: Int { get }
  • Element range.

    Declaration

    Swift

    var range: ClosedRange<Int> { get }
  • Value text.

    Declaration

    Swift

    var text: String { get }
  • Pass this element to the given visitor.

    Declaration

    Swift

    func accept<V, D, R>(_ visitor: V, data: D) -> R where V : MarcoVisitor, D == V.Data, R == V.ReturnType
  • asObject Extension method

    Safely casts this value to an object value.

    Declaration

    Swift

    public var asObject: MarcoObject? { get }
  • asArray Extension method

    Safely casts this value to an array value.

    Declaration

    Swift

    public var asArray: MarcoArray? { get }
  • asStringLiteral Extension method

    Safely casts this value to a string value.

    Declaration

    Swift

    public var asStringLiteral: MarcoStringLiteral? { get }
  • asString Extension method

    Safely casts this value to an string value, and returns the backing String if the cast was successful.

    Declaration

    Swift

    public var asString: String? { get }
  • asStringOrEmpty Extension method

    Safely casts this value to an string value, and returns the backing String if the cast was successful. Returns an empty String otherwise.

    Declaration

    Swift

    public var asStringOrEmpty: String { get }
  • asNumberLiteral Extension method

    Safely casts this value to a number value.

    Declaration

    Swift

    public var asNumberLiteral: MarcoNumberLiteral? { get }
  • asIntLiteral Extension method

    Safely casts this value to a integer value.

    Declaration

    Swift

    public var asIntLiteral: MarcoIntLiteral? { get }
  • asDoubleLiteral Extension method

    Safely casts this value to a double value.

    Declaration

    Swift

    public var asDoubleLiteral: MarcoDoubleLiteral? { get }
  • asInt Extension method

    Safely casts this value to an integer value, and returns the backing Int if the cast was successful.

    Declaration

    Swift

    public var asInt: Int? { get }
  • asIntOrZero Extension method

    Safely casts this value to an integer value, and returns the backing Int if the cast was successful. Returns 0 otherwise.

    Declaration

    Swift

    public var asIntOrZero: Int { get }
  • asDouble Extension method

    Safely casts this value to a double value, and returns the backing Double if the cast was successful.

    Declaration

    Swift

    public var asDouble: Double? { get }
  • asDoubleOrZero Extension method

    Safely casts this value to a double value, and returns the backing Double if the cast was successful. Returns 0.0 otherwise.

    Declaration

    Swift

    public var asDoubleOrZero: Double { get }
  • asBoolLiteral Extension method

    Safely casts this value to a boolean value.

    Declaration

    Swift

    public var asBoolLiteral: MarcoBoolLiteral? { get }
  • asBool Extension method

    Safely casts this value to a boolean value, and returns the backing Bool if the cast was successful.

    Declaration

    Swift

    public var asBool: Bool? { get }
  • asBoolOrFalse Extension method

    Safely casts this value to a boolean value, and returns the backing Bool if the cast was successful. Returns false otherwise.

    Declaration

    Swift

    public var asBoolOrFalse: Bool { get }
  • asBoolOrTrue Extension method

    Safely casts this value to a boolean value, and returns the backing Bool if the cast was successful. Returns true otherwise.

    Declaration

    Swift

    public var asBoolOrTrue: Bool { get }
  • asNullLiteral Extension method

    Safely casts this value to a null value.

    Declaration

    Swift

    public var asNullLiteral: MarcoNullLiteral? { get }
  • isNull Extension method

    True if this value is a null value.

    Declaration

    Swift

    public var isNull: Bool { get }
  • asColor(useAlpha:) Extension method

    Safely casts this value to a color integer value, and converts it into an NSColor.

    Declaration

    Swift

    public func asColor(useAlpha: Bool = false) -> NSColor?
  • asColor Extension method

    Safely casts this value to a color integer value, and converts it into an NSColor.

    Declaration

    Swift

    public var asColor: NSColor? { get }
  • description Extension method

    Declaration

    Swift

    public var description: String { get }
  • document Extension method

    Returns an underlying Marco document, or nil if the current value is not currently attached to a document.

    Declaration

    Swift

    public var document: MarcoDocument? { get }