diff options
author | Adrian Thurston <thurston@complang.org> | 2012-05-21 13:52:03 -0400 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2012-05-21 13:53:18 -0400 |
commit | 3c9d8627320e86f09bf5d2d63164fad56052443c (patch) | |
tree | eb069d3f256082fb5b02016aed75f2dc3802f39f | |
parent | bc21bf772a661e872740b57ec07c5b57ac5359a1 (diff) | |
download | colm-3c9d8627320e86f09bf5d2d63164fad56052443c.tar.gz |
clone elimination.
Clone elimination on calls pushIgnore.
-rw-r--r-- | colm/tree.c | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/colm/tree.c b/colm/tree.c index 4068d8ee..8c4c7264 100644 --- a/colm/tree.c +++ b/colm/tree.c @@ -454,7 +454,6 @@ Tree *pushLeftIgnore( Program *prg, Tree *pushTo, Tree *leftIgnore ) return pushTo; } - static void remLeftIgnore( Program *prg, Tree **sp, Tree *tree ) { assert( tree->flags & AF_LEFT_IGNORE ); @@ -561,23 +560,7 @@ Tree *constructReplacementTree( Kid *kid, Tree **bindings, Program *prg, long pa leftIgnore->id = LEL_ID_IGNORE; leftIgnore->child = ignore; - tree = splitTree( prg, tree ); - - if ( tree->flags & AF_LEFT_IGNORE ) { - /* The token already has a left-ignore. Merge by attaching it as a - * right ignore of the new list. */ - Kid *curIgnore = treeLeftIgnoreKid( prg, tree ); - insRightIgnore( prg, leftIgnore, curIgnore->tree ); - - /* Replace the current ignore. */ - curIgnore->tree->refs -= 1; - curIgnore->tree = leftIgnore; - treeUpref( leftIgnore ); - } - else { - /* Attach the ignore list. */ - insLeftIgnore( prg, tree, leftIgnore ); - } + tree = pushLeftIgnore( prg, tree, leftIgnore ); } ignore = nodes[pat].rightIgnore; @@ -589,23 +572,7 @@ Tree *constructReplacementTree( Kid *kid, Tree **bindings, Program *prg, long pa rightIgnore->id = LEL_ID_IGNORE; rightIgnore->child = ignore; - tree = splitTree( prg, tree ); - - if ( tree->flags & AF_RIGHT_IGNORE ) { - /* The token already has a right-ignore. Merge by attaching it as a - * right ignore of the new list. */ - Kid *curIgnore = treeRightIgnoreKid( prg, tree ); - insLeftIgnore( prg, rightIgnore, curIgnore->tree ); - - /* Replace the current ignore. */ - curIgnore->tree->refs -= 1; - curIgnore->tree = rightIgnore; - treeUpref( rightIgnore ); - } - else { - /* Attach the ignore list. */ - insRightIgnore( prg, tree, rightIgnore ); - } + tree = pushRightIgnore( prg, tree, rightIgnore ); } } else { @@ -655,7 +622,6 @@ Tree *constructReplacementTree( Kid *kid, Tree **bindings, Program *prg, long pa tree->flags |= AF_LEFT_IGNORE; } - int i; for ( i = 0; i < lelInfo[tree->id].numCaptureAttr; i++ ) { long ci = pat+1+i; |