Fixed Kalypso's scope lookup to handle ::, ported another test (+ got another one from having proper scope operator)

This commit is contained in:
Nathan Braswell
2016-02-05 13:56:29 -05:00
parent 464805b7aa
commit 778e03a929
3 changed files with 33 additions and 5 deletions

View File

@@ -149,11 +149,28 @@ obj string (Object, Serializable) {
return out;
}
fun lines(): vector::vector<string> {
fun split(delim: *char): vector::vector<string> return split(string(delim))
fun split(delim: string): vector::vector<string> {
var out.construct(): vector::vector<string>
var current = string("")
for (var i = 0; i < data.size; i++;) {
if (data[i] == '\n') {
if (i < data.size-delim.length() && slice(i, i+delim.length()) == delim) {
out.add(current)
current = string("")
i += delim.length()-1
} else {
current += data[i]
}
}
out.add(current)
return out
}
fun lines(): vector::vector<string> return split('\n')
fun split(delim: char): vector::vector<string> {
var out.construct(): vector::vector<string>
var current = string("")
for (var i = 0; i < data.size; i++;) {
if (data[i] == delim) {
out.add(current)
current = string("")
} else {