Skip to content

Commit

Permalink
specialCharacterMapping in normalize
Browse files Browse the repository at this point in the history
  • Loading branch information
jgersdorf committed Jun 16, 2023
1 parent 6d9a5be commit f362b32
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion gowsdl.go
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,14 @@ var reservedWordsInAttr = map[string]string{
"string": "astring",
}

var specialCharacterMapping = map[string]string{
"+": "Plus",
"-": "Minus",
"@": "At",
"/": "Slash",
"$": "Dollar",
}

// Replaces Go reserved keywords to avoid compilation issues
func replaceReservedWords(identifier string) string {
value := reservedWords[identifier]
Expand Down Expand Up @@ -486,7 +494,9 @@ func normalize(value string) string {
return -1
}

value = strings.ReplaceAll(value, "+", "Plus")
for k, v := range specialCharacterMapping {
value = strings.ReplaceAll(value, k, v)
}

return strings.Map(mapping, value)
}
Expand Down

0 comments on commit f362b32

Please sign in to comment.