Fixed parsing of newline character in string expression #1430

This commit is contained in:
Mike Farah
2022-11-14 16:40:59 +11:00
parent 1fd96e168e
commit e02bb71948
3 changed files with 26 additions and 0 deletions
+4
View File
@@ -352,8 +352,12 @@ func nullValue() yqAction {
func stringValue() yqAction {
return func(rawToken lexer.Token) (*token, error) {
log.Debug("rawTokenvalue: %v", rawToken.Value)
value := unwrap(rawToken.Value)
log.Debug("unwrapped: %v", value)
value = strings.ReplaceAll(value, "\\\"", "\"")
value = strings.ReplaceAll(value, "\\n", "\n")
log.Debug("replaced: %v", value)
return &token{TokenType: operationToken, Operation: createValueOperation(value, value)}, nil
}
}