Commit c771b6d6 authored by Andrey Vetlugin's avatar Andrey Vetlugin

Cleanup

parent 20dad003
#!/usr/bin/env groovy
String unescape(String escaped) {
return escaped
}
// TODO implement this
//assert 'asdf' == unescape('"asdf"')
//assert 'as"df' == unescape('"as""df"')
//assert "" == '""'
assert unescape('asdf') == 'asdf'
//List<String> splitLine(String line) {
// return line.split(/,/)
//}
List<String> splitLine(String line) {
List<String> tokens = []
......@@ -34,6 +18,7 @@ List<String> splitLine(String line) {
tokenQuotes = []
isFirstCharacterInToken = true
} else {
// comma is the part of the token
currentToken += it
isFirstCharacterInToken = false
}
......@@ -44,15 +29,11 @@ List<String> splitLine(String line) {
currentToken += '"'
} else {
tokenQuotes << it
isFirstCharacterInToken = false
}
} else {
isFirstCharacterInToken = false
}
isFirstCharacterInToken = false
} else {
// simple character
currentToken += tokenQuotes.join('')
tokenQuotes = []
currentToken += it
isFirstCharacterInToken = false
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment