feat: with & for in render tag, closes #195

This commit is contained in:
harttle
2020-03-04 07:08:54 +08:00
parent aa27a6cd7b
commit 6ea6881f08
67 changed files with 1108 additions and 724 deletions
+3 -2
View File
@@ -4,14 +4,15 @@ import { Value } from './value'
import { Context } from '../context/context'
import { toValue } from '../util/underscore'
import { isOperator, precedence, operatorImpls } from './operator'
import { tokenize } from '../parser/expression-tokenizer'
import { Tokenizer } from '../parser/tokenizer'
export class Expression {
private operands: any[] = []
private postfix: string[]
public constructor (str = '') {
this.postfix = [...toPostfix(tokenize(str))]
const tokenizer = new Tokenizer(str)
this.postfix = [...toPostfix(tokenizer.readExpression())]
}
public * evaluate (ctx: Context) {
assert(ctx, 'unable to evaluate: context not defined')