parseTTLClause parses the TTL clause. allowMultiValues is used to determine whether to allow multiple TTL values.
(pos Pos, allowMultiValues bool)
| 1120 | // parseTTLClause parses the TTL clause. |
| 1121 | // allowMultiValues is used to determine whether to allow multiple TTL values. |
| 1122 | func (p *Parser) parseTTLClause(pos Pos, allowMultiValues bool) ([]*TTLExpr, error) { |
| 1123 | items := make([]*TTLExpr, 0) |
| 1124 | expr, err := p.parseTTLExpr(pos) |
| 1125 | if err != nil { |
| 1126 | return nil, err |
| 1127 | } |
| 1128 | items = append(items, expr) |
| 1129 | for allowMultiValues && !p.lexer.isEOF() && p.tryConsumeTokenKind(TokenKindComma) != nil { |
| 1130 | expr, err = p.parseTTLExpr(pos) |
| 1131 | if err != nil { |
| 1132 | return nil, err |
| 1133 | } |
| 1134 | items = append(items, expr) |
| 1135 | } |
| 1136 | return items, nil |
| 1137 | } |
| 1138 | |
| 1139 | func (p *Parser) tryParseTTLPolicy(pos Pos) (*TTLPolicy, error) { |
| 1140 | var rule *TTLPolicyRule |
no test coverage detected