summaryrefslogtreecommitdiff
path: root/src/loadcolm.cc
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-10-05 11:15:52 -0400
committerAdrian Thurston <thurston@complang.org>2015-10-05 11:21:55 -0400
commit904ac5cc1675b19249750e3f5492cba720dda4c5 (patch)
tree097fa6eb549809d993ec3ba2e89fdc658becc598 /src/loadcolm.cc
parentf19e2b452e5dc2a14a48fe71fa26796b5678b147 (diff)
downloadcolm-904ac5cc1675b19249750e3f5492cba720dda4c5.tar.gz
added syntax dedicated to reductions
This avoids interferrence with existing parsing code. Calling the commit/reduce code only if the reduce construct is used.
Diffstat (limited to 'src/loadcolm.cc')
-rw-r--r--src/loadcolm.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/loadcolm.cc b/src/loadcolm.cc
index c0e06468..dedb4353 100644
--- a/src/loadcolm.cc
+++ b/src/loadcolm.cc
@@ -1780,7 +1780,7 @@ struct LoadColm
ConsItemList *list = walkAccumulate( codeFactor.accumulate() );
expr = parseCmd( codeFactor.PARSE().loc(), false, false, objField,
- typeRef, init, list, used );
+ typeRef, init, list, used, false );
break;
}
case code_factor::ParseTree: {
@@ -1792,7 +1792,7 @@ struct LoadColm
ConsItemList *list = walkAccumulate( codeFactor.accumulate() );
expr = parseCmd( codeFactor.PARSE_TREE().loc(), true, false, objField,
- typeRef, init, list, used );
+ typeRef, init, list, used, false );
break;
}
case code_factor::ParseStop: {
@@ -1804,7 +1804,18 @@ struct LoadColm
ConsItemList *list = walkAccumulate( codeFactor.accumulate() );
expr = parseCmd( codeFactor.PARSE_STOP().loc(), false, true, objField,
- typeRef, init, list, used );
+ typeRef, init, list, used, false );
+ break;
+ }
+ case code_factor::Reduce: {
+ /* The type we are parsing. */
+ type_ref typeRefTree = codeFactor.type_ref();
+ TypeRef *typeRef = walkTypeRef( typeRefTree );
+ FieldInitVect *init = walkOptFieldInit( codeFactor.opt_field_init() );
+ ConsItemList *list = walkAccumulate( codeFactor.accumulate() );
+
+ expr = parseCmd( codeFactor.REDUCE().loc(), false, false, 0,
+ typeRef, init, list, used, true );
break;
}
case code_factor::Cons: {