Skip to content

Commit

Permalink
Update SoulverCore framework (v1.2.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
zcohan committed Feb 8, 2021
1 parent a53338e commit 659f47b
Show file tree
Hide file tree
Showing 88 changed files with 18,921 additions and 2,992 deletions.
2 changes: 0 additions & 2 deletions MacSample/MacSample/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ class AppDelegate: NSObject, NSApplicationDelegate {

func applicationDidFinishLaunching(_ aNotification: Notification) {

/* Uncomment to run all the examples */

SoulverCoreExamples.runAllExamples()

}
Expand Down
25 changes: 24 additions & 1 deletion MacSample/MacSample/SoulverCoreExamples.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SoulverCoreExamples {
SoulverCoreExamples().usingAEuropeanLocale()
SoulverCoreExamples().disablingBracketComments()
SoulverCoreExamples().customizingHowAmbiguousExpressionsAreHandled()
SoulverCoreExamples().findingADate()

// Multi-line examples
SoulverCoreExamples().simpleMultiLineCalculation()
Expand Down Expand Up @@ -195,6 +196,28 @@ class SoulverCoreExamples {
}


func findingADate() {

var customization = EngineCustomization.standard

// With this option, SoulverCore will attempt to parse a date from the expression (when ordinarily it might interpret it as plain arithmatic or a unit calculation)

customization.featureFlags.seeksFutureDate = true

let calculator = Calculator(customization: customization)

// 11th of March (or 3rd of November in the US), not 11 divided by 3

if let date = calculator.dateFor("11/03")?.date {

print("Found a date \(DateFormatter.localizedString(from: date, dateStyle: .medium, timeStyle: .none))")


}

}


// MARK: - Multi-Line Calculations

func simpleMultiLineCalculation() {
Expand Down Expand Up @@ -340,6 +363,6 @@ class SoulverCoreExamples {

}



}
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let package = Package(
targets: [
.binaryTarget(
name: "SoulverCore",
url: "https://github.com/soulverteam/SoulverCore/releases/download/1.2.0/SoulverCore.xcframework.zip",
checksum: "bfde93a1070e905c7d2737e14f50f4e7b7e01cc9daf963f0ea7628a4f7138d6c"),
url: "https://github.com/soulverteam/SoulverCore/releases/download/1.2.1/SoulverCore.xcframework.zip",
checksum: "564cf25c293b0cc778525d94acf2b8119f60fab707f5ce614b1f5406e17957f0"),
]
)
22 changes: 11 additions & 11 deletions SoulverCore.xcframework/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<array>
<dict>
<key>LibraryIdentifier</key>
<string>macos-arm64_x86_64</string>
<string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key>
<string>SoulverCore.framework</string>
<key>SupportedArchitectures</key>
Expand All @@ -15,11 +15,13 @@
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>macos</string>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-maccatalyst</string>
<string>macos-arm64_x86_64</string>
<key>LibraryPath</key>
<string>SoulverCore.framework</string>
<key>SupportedArchitectures</key>
Expand All @@ -28,36 +30,34 @@
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
<string>macos</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string>
<string>ios-arm64</string>
<key>LibraryPath</key>
<string>SoulverCore.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict>
<dict>
<key>LibraryIdentifier</key>
<string>ios-arm64</string>
<string>ios-arm64_x86_64-maccatalyst</string>
<key>LibraryPath</key>
<string>SoulverCore.framework</string>
<key>SupportedArchitectures</key>
<array>
<string>arm64</string>
<string>x86_64</string>
</array>
<key>SupportedPlatform</key>
<string>ios</string>
<key>SupportedPlatformVariant</key>
<string>maccatalyst</string>
</dict>
</array>
<key>CFBundlePackageType</key>
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ public class VariableList : Swift.CustomDebugStringConvertible, Swift.Equatable,
get
}
}
public struct Substance : Swift.Equatable {
public let name: Swift.String
public let value: Foundation.Decimal
public var rateValue: SoulverCore.UnitRate {
get
}
public static func == (a: SoulverCore.Substance, b: SoulverCore.Substance) -> Swift.Bool
}
public enum DatespanType {
case season
case quarter
Expand Down Expand Up @@ -412,6 +420,10 @@ extension Int {
}
public struct EngineCustomization : Swift.Equatable, Swift.Hashable {
public let locale: Foundation.Locale
public let calendar: Foundation.Calendar
public var timeZone: Foundation.TimeZone {
get
}
public var customVariables: [SoulverCore.Variable]
public var customUnits: [SoulverCore.CustomUnit] {
get
Expand All @@ -431,9 +443,10 @@ public struct EngineCustomization : Swift.Equatable, Swift.Hashable {
get
set
}
public var holidays: [SoulverCore.Holiday]
public var unitSystem: SoulverCore.UnitMeasurementSystem
public var featureFlags: SoulverCore.EngineFeatureFlags
public init(locale: Foundation.Locale)
public init(locale: Foundation.Locale, calendar: Foundation.Calendar? = nil)
public func hash(into hasher: inout Swift.Hasher)
public static func == (lhs: SoulverCore.EngineCustomization, rhs: SoulverCore.EngineCustomization) -> Swift.Bool
public static var standard: SoulverCore.EngineCustomization {
Expand Down Expand Up @@ -797,6 +810,9 @@ public class Calculator {
public protocol CustomFunctionEvaluator {
func evaluate(customFunction: SoulverCore.CustomFunction, with parameters: [SoulverCore.EvaluationResult]) -> SoulverCore.EvaluationResult
}
extension Calculator {
public func dateFor(_ expression: Swift.String, with variableList: SoulverCore.VariableList? = nil) -> (date: Foundation.Date, result: SoulverCore.CalculationResult)?
}
extension IndexSet {
public func isJust(_ integer: Swift.Int) -> Swift.Bool
public var onlyFirst: Foundation.IndexSet {
Expand Down Expand Up @@ -1013,11 +1029,12 @@ public enum TokenType : Swift.CaseIterable {
case pi
case typeName
case conditionalKeyword
case colon
case function
case timezone
case substance
case comma
case dot
case colon
case label
case fraction
case converter
Expand All @@ -1029,6 +1046,7 @@ public enum TokenType : Swift.CaseIterable {
case datespan
case dateWord
case dateQualifier
case ordinalSuffix
case relativePlaceWord
case numberWord
case unitExpression
Expand Down Expand Up @@ -1116,6 +1134,8 @@ public enum TokenSubType {
case dateWordQuarterOfYear
case dateWordAm
case dateWordPm
case dateWordMidday
case dateWordMidnight
case dateWordSummer
case dateWordAutumn
case dateWordWinter
Expand Down Expand Up @@ -1180,6 +1200,9 @@ indirect public enum EvaluationResult {
case error(SoulverCore.EvaluationError)
case variable(SoulverCore.Variable)
case unit(SoulverCore.SVUnit)
case substance(SoulverCore.Substance)
case datespan(SoulverCore.Datespan)
case timezone(Foundation.TimeZone)
case pending
case failed
case none
Expand All @@ -1201,6 +1224,9 @@ indirect public enum EvaluationResult {
public var unitValue: SoulverCore.SVUnit? {
get
}
public var substanceValue: SoulverCore.Substance? {
get
}
public var rateValue: SoulverCore.UnitRate? {
get
}
Expand Down Expand Up @@ -1542,10 +1568,14 @@ extension Array {
public mutating func move(from oldIndex: Swift.Array<Element>.Index, to newIndex: Swift.Array<Element>.Index)
}
infix operator ~ : AdditionPrecedence
public struct CustomFunctionArgument {
public struct WordFunctionArgument {
public let matchedToken: SoulverCore.Token
public let functionArgument: SoulverCore.EvaluationResult
}
@_hasMissingDesignatedInitializers public class FunctionSubstitutionUtility {
public class func functionArgumentsForCustomFunction(token: SoulverCore.Token) -> [SoulverCore.WordFunctionArgument]?
@objc deinit
}
public let UntokenizedLineReference: Swift.String
public enum UnitMeasurementSystem : Swift.String, Swift.RawRepresentable, Swift.Equatable {
case customaryUS
Expand All @@ -1572,14 +1602,6 @@ open class StandardEvaluator : SoulverCore.Evaluator {
}
public protocol TokenMetadata {
}
public struct CustomFunctionTokenMetadata : SoulverCore.TokenMetadata {
public var functionArguments: [SoulverCore.CustomFunctionArgument] {
get
}
public var arguments: [SoulverCore.EvaluationResult] {
get
}
}
public struct DynamicVariableTokenMetadata : SoulverCore.TokenMetadata {
public let dynamicVariable: SoulverCore.DynamicVariable
public let value: SoulverCore.CalculationResult
Expand Down Expand Up @@ -1660,6 +1682,7 @@ public struct EngineFeatureFlags : Swift.Equatable, Swift.Hashable, Swift.Codabl
public var variableDeclarations: Swift.Bool
public var bracketComments: Swift.Bool
public var inAmbiguityPreferSomethingToNothing: Swift.Bool
public var seeksFutureDate: Swift.Bool
public var leftToRightOperatorEvaluation: Swift.Bool
public init()
public init(units: Swift.Bool, wordFunctions: Swift.Bool, variableDeclarations: Swift.Bool, bracketComments: Swift.Bool, calendarCalculations: Swift.Bool, leftToRightOperatorEvaluation: Swift.Bool, inAmbiguityPreferSomethingToNothing: Swift.Bool)
Expand Down Expand Up @@ -1808,6 +1831,9 @@ extension String {
public func foundationLocalized() -> Swift.String
public func localized(bundle: Foundation.Bundle = .main) -> Swift.String
}
public struct Holiday {
public init(day: Swift.Int, month: Swift.Int, year: Swift.Int)
}
@objc @_inheritsConvenienceInitializers open class AsynchronousOperation : Foundation.Operation {
@objc override dynamic public var isAsynchronous: Swift.Bool {
@objc get
Expand Down
Binary file not shown.
Loading

0 comments on commit 659f47b

Please sign in to comment.