summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2012-05-04 20:19:39 -0400
committerAdrian Thurston <thurston@complang.org>2012-05-04 22:09:00 -0400
commitd53be0d4dc6e8cb6309385c7c1addf0edc5cc280 (patch)
tree557f464894fcc94cb8404b62b33a65d41ae96cc2
parent6919861f539c7a4e5fa7d0b6bbb43d163945df42 (diff)
downloadcolm-d53be0d4dc6e8cb6309385c7c1addf0edc5cc280.tar.gz
When constructing we need to pull ignores from the shadow tree.
-rw-r--r--colm/pdabuild.cc44
1 files changed, 24 insertions, 20 deletions
diff --git a/colm/pdabuild.cc b/colm/pdabuild.cc
index 347ec093..b6beda54 100644
--- a/colm/pdabuild.cc
+++ b/colm/pdabuild.cc
@@ -1535,12 +1535,14 @@ void mapNodes( Program *prg, int &count, Kid *kid )
if ( kid != 0 ) {
pt(kid->tree)->state = count++;
- IgnoreList *ignoreList = treeLeftIgnore( prg, kid->tree );
- if ( ignoreList != 0 ) {
- Kid *ignore = ignoreList->child;
- while ( ignore != 0 ) {
- count += 1;
- ignore = ignore->next;
+ if ( pt(kid->tree)->shadow != 0 ) {
+ IgnoreList *ignoreList = treeLeftIgnore( prg, pt(kid->tree)->shadow->tree );
+ if ( ignoreList != 0 ) {
+ Kid *ignore = ignoreList->child;
+ while ( ignore != 0 ) {
+ count += 1;
+ ignore = ignore->next;
+ }
}
}
@@ -1568,23 +1570,25 @@ void fillNodes( Program *prg, Bindings *bindings, long &bindId,
node.length = stringLength( kid->tree->tokdata );
node.data = stringData( kid->tree->tokdata );
- /* Ignore items. */
- IgnoreList *ignoreList = treeLeftIgnore( prg, kid->tree );
- Kid *ignore = ignoreList == 0 ? 0 : ignoreList->child;
- node.ignore = ignore == 0 ? -1 : ind;
+ if ( pt(kid->tree)->shadow != 0 ) {
+ /* Ignore items. */
+ IgnoreList *ignoreList = treeLeftIgnore( prg, pt(kid->tree)->shadow->tree );
+ Kid *ignore = ignoreList == 0 ? 0 : ignoreList->child;
+ node.ignore = ignore == 0 ? -1 : ind;
- while ( ignore != 0 ) {
- PatReplNode &node = nodes[ind++];
+ while ( ignore != 0 ) {
+ PatReplNode &node = nodes[ind++];
- memset( &node, 0, sizeof(PatReplNode) );
- node.id = ignore->tree->id;
- node.prodNum = ignore->tree->prodNum;
- node.next = ignore->next == 0 ? -1 : ind;
-
- node.length = stringLength( ignore->tree->tokdata );
- node.data = stringData( ignore->tree->tokdata );
+ memset( &node, 0, sizeof(PatReplNode) );
+ node.id = ignore->tree->id;
+ node.prodNum = ignore->tree->prodNum;
+ node.next = ignore->next == 0 ? -1 : ind;
+
+ node.length = stringLength( ignore->tree->tokdata );
+ node.data = stringData( ignore->tree->tokdata );
- ignore = ignore->next;
+ ignore = ignore->next;
+ }
}
/* The captured attributes. */