diff options
Diffstat (limited to 'subex/subexast.go')
-rw-r--r-- | subex/subexast.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/subex/subexast.go b/subex/subexast.go index 5e63f03..9e7067b 100644 --- a/subex/subexast.go +++ b/subex/subexast.go @@ -181,3 +181,15 @@ func (ast SubexASTRange) compileWith(next SubexState) SubexState { next: next, } } + +// Run content and then assume that output is a series of numbers, sum them and output the total +// Will cast strings, booleans and null to numbers +type SubexASTSum struct { + content SubexAST +} +func (ast SubexASTSum) compileWith(next SubexState) SubexState { + return &SubexSumState { + inputState: ast.content.compileWith(&SubexNoneState{}), + next: next, + } +} |