EscapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names.
(s string)
| 37 | |
| 38 | // EscapeAssertion escapes the dots in the assertion, because the expression evaluation doesn't support such variable names. |
| 39 | func EscapeAssertion(s string) string { |
| 40 | s = escapeAssertionRegex.ReplaceAllStringFunc(s, func(m string) string { |
| 41 | // Replace only the last dot with underscore (preserve the prefix character) |
| 42 | lastDotIdx := strings.LastIndex(m, ".") |
| 43 | if lastDotIdx > 0 { |
| 44 | return m[:lastDotIdx] + "_" |
| 45 | } |
| 46 | return m |
| 47 | }) |
| 48 | return s |
| 49 | } |
| 50 | |
| 51 | // RemoveComments removes the comments starting with # in the text. |
| 52 | func RemoveComments(s string) string { |
no outgoing calls
searching dependent graphs…