Skip to content

Advanced Usage

Dave DeLong edited this page Sep 20, 2016 · 3 revisions

Creating an Expression

An Expression is simply created using the init(string:) initializer:

let expression = try Expression(string: "1 + 2")

In addition to the String parameter, you may optionally supply a set of operators to use, as well as custom token resolution options.

Specifying a custom set of operators allows you to control the behavior of the % operator, define your own operator, or add new ways to recognize existing operators.