summaryrefslogtreecommitdiff
path: root/colm
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2013-03-27 18:48:45 -0400
committerAdrian Thurston <thurston@complang.org>2013-03-27 18:48:45 -0400
commit294b4ad138bf1749a6b9996b3021c5f3c7f652ff (patch)
treec280c9b24284b4a36fef70ed82babfe99c659ea6 /colm
parentb230516bb87648d9ed125a0083ba8242596b5efb (diff)
downloadcolm-294b4ad138bf1749a6b9996b3021c5f3c7f652ff.tar.gz
additional use of location in walking productions
Diffstat (limited to 'colm')
-rw-r--r--colm/colm.lm2
-rw-r--r--colm/load.cc17
2 files changed, 11 insertions, 8 deletions
diff --git a/colm/colm.lm b/colm/colm.lm
index 9de22214..c925d8a2 100644
--- a/colm/colm.lm
+++ b/colm/colm.lm
@@ -341,7 +341,7 @@ def opt_commit
| []
def prod
- [SQOPEN ProdElList: prod_el_list SQCLOSE
+ [Open: SQOPEN ProdElList: prod_el_list SQCLOSE
OptCommit: opt_commit
OptReduce: opt_reduce]
diff --git a/colm/load.cc b/colm/load.cc
index 8ffcbc94..f8955f86 100644
--- a/colm/load.cc
+++ b/colm/load.cc
@@ -779,24 +779,27 @@ struct LoadSource
return block;
}
- void walkProdList( LelDefList *lelDefList, prod_list ProdList )
+ void walkProdudction( LelDefList *lelDefList, prod Prod )
{
- if ( ProdList.ProdList() != 0 )
- walkProdList( lelDefList, ProdList.ProdList() );
-
ProdElList *list = new ProdElList;
- prod Prod = ProdList.Prod();
-
walkProdElList( list, Prod.ProdElList() );
CodeBlock *codeBlock = walkOptReduce( Prod.OptReduce() );
bool commit = Prod.OptCommit().Commit() != 0;
- Production *prod = BaseParser::production( internal, list, commit, codeBlock, 0 );
+ Production *prod = BaseParser::production( Prod.Open().loc() , list, commit, codeBlock, 0 );
prodAppend( lelDefList, prod );
}
+ void walkProdList( LelDefList *lelDefList, prod_list ProdList )
+ {
+ if ( ProdList.ProdList() != 0 )
+ walkProdList( lelDefList, ProdList.ProdList() );
+
+ walkProdudction( lelDefList, ProdList.Prod() );
+ }
+
ReOrItem *walkRegOrChar( reg_or_char regOrChar )
{
ReOrItem *orItem = 0;