diff options
author | Adrian Thurston <thurston@colm.net> | 2018-12-17 14:10:50 +0200 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2018-12-17 14:11:53 +0200 |
commit | eccfd443ed78c614c396c542a07673c113f1ecd3 (patch) | |
tree | 297658178b1f24d53c476c9fa62f5a44b9a87d9a /src/loadcolm.cc | |
parent | fc1d61f4cab2260e90fcd468078eaa0d2046f372 (diff) | |
download | colm-eccfd443ed78c614c396c542a07673c113f1ecd3.tar.gz |
allow referencing a tree in reduction actions
syntax is $*N
Diffstat (limited to 'src/loadcolm.cc')
-rw-r--r-- | src/loadcolm.cc | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/loadcolm.cc b/src/loadcolm.cc index b622f3f2..1b0dba85 100644 --- a/src/loadcolm.cc +++ b/src/loadcolm.cc @@ -2474,6 +2474,12 @@ struct LoadColm rti->txt = item.RED_RHS_REF().text().c_str(); list.append( rti ); } + else if ( item.RED_TREE_REF() != 0 ) { + ReduceTextItem *rti = new ReduceTextItem; + rti->type = ReduceTextItem::TreeRef; + rti->txt = item.RED_TREE_REF().text().c_str(); + list.append( rti ); + } else if ( item.RED_RHS_LOC() != 0 ) { ReduceTextItem *rti = new ReduceTextItem; rti->type = ReduceTextItem::RhsLoc; @@ -2486,6 +2492,12 @@ struct LoadColm rti->n = atoi( item.RED_RHS_NREF().text().c_str() + 1 ); list.append( rti ); } + else if ( item.RED_TREE_NREF() != 0 ) { + ReduceTextItem *rti = new ReduceTextItem; + rti->type = ReduceTextItem::TreeRef; + rti->n = atoi( item.RED_TREE_NREF().text().c_str() + 2 ); + list.append( rti ); + } else if ( item.RED_RHS_NLOC() != 0 ) { ReduceTextItem *rti = new ReduceTextItem; rti->type = ReduceTextItem::RhsLoc; |