(blocks)
| 3396 | } |
| 3397 | |
| 3398 | function processBlock(blocks) { |
| 3399 | var m = null; |
| 3400 | var res = {}; |
| 3401 | var lines = null; |
| 3402 | var children = null; |
| 3403 | var currentObj = null; |
| 3404 | |
| 3405 | var level = -1; |
| 3406 | |
| 3407 | var processedBlocks = []; |
| 3408 | |
| 3409 | var isMap = true; |
| 3410 | |
| 3411 | for(var j = 0, lenJ = blocks.length; j < lenJ; ++j) { |
| 3412 | |
| 3413 | if(level != -1 && level != blocks[j].level) |
| 3414 | continue; |
| 3415 | |
| 3416 | processedBlocks.push(j); |
| 3417 | |
| 3418 | level = blocks[j].level; |
| 3419 | lines = blocks[j].lines; |
| 3420 | children = blocks[j].children; |
| 3421 | currentObj = null; |
| 3422 | |
| 3423 | for(var i = 0, len = lines.length; i < len; ++i) { |
| 3424 | var line = lines[i]; |
| 3425 | |
| 3426 | if(m = line.match(regex["key"])) { |
| 3427 | var key = m[1]; |
| 3428 | |
| 3429 | if(key[0] == '-') { |
| 3430 | key = key.replace(regex["item"], ""); |
| 3431 | if (isMap) { |
| 3432 | isMap = false; |
| 3433 | if (typeof(res.length) === "undefined") { |
| 3434 | res = []; |
| 3435 | } |
| 3436 | } |
| 3437 | if(currentObj != null) res.push(currentObj); |
| 3438 | currentObj = {}; |
| 3439 | isMap = true; |
| 3440 | } |
| 3441 | |
| 3442 | if(typeof m[2] != "undefined") { |
| 3443 | var value = m[2].replace(regex["trim"], ""); |
| 3444 | if(value[0] == '&') { |
| 3445 | var nb = processBlock(children); |
| 3446 | if(currentObj != null) currentObj[key] = nb; |
| 3447 | else res[key] = nb; |
| 3448 | reference_blocks[value.substr(1)] = nb; |
| 3449 | } else if(value[0] == '|') { |
| 3450 | if(currentObj != null) currentObj[key] = processLiteralBlock(children.shift()); |
| 3451 | else res[key] = processLiteralBlock(children.shift()); |
| 3452 | } else if(value[0] == '*') { |
| 3453 | var v = value.substr(1); |
| 3454 | var no = {}; |
| 3455 |
no test coverage detected