@@ -5,12 +5,13 @@ export function buildTreeStruct(monoLineString) {
conststringAsArray=monoLineString.split('');
constrawTree=leftParser(stringAsArray);
constoutOfScope=stringAsArray.length;
if (outOfScope)throw`fail to build tree from : "${monoLineString}" parsed: ${JSON.stringify(rawTree)} unparsed/failed: ${stringAsArray.join('')}`;
if (outOfScope)thrownewError(`fail to build tree from : "${monoLineString}" parsed: ${JSON.stringify(rawTree)} unparsed/failed: ${stringAsArray.join('')}`);
letlastTree,tree=rawTree;
do{
lastTree=JSON.stringify(tree);
tree=flattenTree(tree);
}while (JSON.stringify(tree)!==lastTree)
preRouteAlt(tree);
returntree;
}
...
...
@@ -18,7 +19,7 @@ export function buildTreeStruct(monoLineString) {
* leftParser stuff
*/
functionflushNoEmptyString(data){
if (data.str.length)data.tree.alt[data.tree.alt.length-1].step.push(data.str);
if (data.str.length)data.tree.alt[data.tree.alt.length-1].step.push({str:data.str});