{␊ |
$pos = 0;␊ |
$stanzas = array();␊ |
$length = strlen($in);␊ |
␊ |
while ($pos < strlen($in)) {␊ |
while ($pos < $length) {␊ |
$stanza = array();␊ |
while ($pos < strlen($in)) {␊ |
while ($pos < $length) {␊ |
if ($in[$pos] == "\n") break;␊ |
␊ |
$stanzaLine = array('key' => '', 'values' => array(), 'hash' => null);␊ |
while ($pos < strlen($in)) {␊ |
while ($pos < $length) {␊ |
$ch = $in[$pos];␊ |
if ($ch == '"' || $ch == '[') break;␊ |
++$pos;␊ |
|
$stanzaLine['key'] .= $ch;␊ |
}␊ |
␊ |
// symbol w/o a value list␊ |
if ($pos >= $length || $in[$pos] == "\n") break;␊ |
␊ |
if ($in[$pos] == '[') {␊ |
unset($stanzaLine['values']);␊ |
++$pos; // opening square bracket␊ |
|
while ($in[$pos] == '"') {␊ |
++$pos; // opening quote␊ |
$stanzaLine['values'][$valCount] = '';␊ |
while ($pos < strlen($in)) {␊ |
while ($pos < $length) {␊ |
$ch = $in[$pos]; $pr = $in[$pos-1];␊ |
if ($ch == '"' && $pr != '\\') break;␊ |
++$pos;␊ |
|
}␊ |
++$pos; // closing quote␊ |
␊ |
if ($pos >= strlen($in))␊ |
if ($pos >= $length)␊ |
break;␊ |
␊ |
if ($in[$pos] == ' ') {␊ |