(fieldTypeDescriptor FieldTypeDescriptor)
| 491 | } |
| 492 | |
| 493 | func (binaryExpression *BinaryExpression) processRegexComparison(fieldTypeDescriptor FieldTypeDescriptor) (err error) { |
| 494 | isRegexComparison, regexString, regexPtr := binaryExpression.isRegexComparison(fieldTypeDescriptor) |
| 495 | if !isRegexComparison { |
| 496 | return |
| 497 | } |
| 498 | |
| 499 | regex, err := regexp.Compile(regexString.value.value) |
| 500 | if err != nil { |
| 501 | return GenerateExpressionError(regexString, "Invalid regex %v: %v", regexString.value.value, err) |
| 502 | } |
| 503 | |
| 504 | *regexPtr = &RegexLiteral{ |
| 505 | regex: regex, |
| 506 | regexString: regexString.value, |
| 507 | } |
| 508 | |
| 509 | return |
| 510 | } |
| 511 | |
| 512 | func (binaryExpression *BinaryExpression) isRegexComparison(fieldTypeDescriptor FieldTypeDescriptor) (isRegexComparison bool, regexString *StringLiteral, regexPtr *Expression) { |
| 513 | if binaryExpression.operator.operator.tokenType != QtkCmpRegexp { |
no test coverage detected