NewExpressionRaw constructs an expression containing the given raw tokens. There is no automatic validation that the given tokens produce a valid expression. Callers of thus function must take care to produce invalid expression tokens. Where possible, use the higher-level functions NewExpressionLit
(tokens Tokens)
| 37 | // contains a subslice that would normally be interpreted as a traversal under |
| 38 | // parsing. |
| 39 | func NewExpressionRaw(tokens Tokens) *Expression { |
| 40 | expr := newExpression() |
| 41 | // We copy the tokens here in order to make sure that later mutations |
| 42 | // by the caller don't inadvertently cause our expression to become |
| 43 | // invalid. |
| 44 | copyTokens := make(Tokens, len(tokens)) |
| 45 | copy(copyTokens, tokens) |
| 46 | expr.children.AppendUnstructuredTokens(copyTokens) |
| 47 | return expr |
| 48 | } |
| 49 | |
| 50 | // NewExpressionLiteral constructs an an expression that represents the given |
| 51 | // literal value. |
no test coverage detected